gdb deletes watchpoint for local variables in scope
Varun Kumar Erigila <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <BMXPR01MB1029F6BB649C642EC4E485438DFA9@BMXPR01MB1029.INDPRD01.PROD.OUTLOOK.COM> |
Hello everyone,
Gdb complains saying "Watchpoint <number> deleted because the program has left the block in which its expression is valid", even though the local variable is still in scope for RISC-V architecture.
Test Code: Compiler Explorer (godbolt.org)<https://godbolt.org/z/dhb5K5KK4>
Code compiled with clang(trunk):
* clang -g -static -c program.c
* riscv64-unknown-elf-gcc program.o -o program -march=rv64imac -mabi=lp64
Gdb(12.1):
* riscv64-unknown-elf-gdb program
* break main
* set can-use-hw-watchpoints 0
* watch q
* continue
* Watchpoint 2 deleted because the program has left the block in
* which its expression is valid.
* 0x00000000000101e0 in func () at watch_cond.c:2
Even though the variable q is still in scope in main, gdb prints this message immediately after func() returns.
I'm trying to debug gdb on update_watchpoint function where this message is originating from.
Any suggestions on why gdb is behaving so.
regards
Varun