]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: LoongArch: Add show-debug-regs maintenance command
This patch register the command "maint set show-debug-regs on/off"
and make it settable by the user. If show-debug-regs is enabled,
the debug register values are shown when GDB inserts or removes a
hardware breakpoint or watchpoint. This is helpful for the use and
development of hardware watchpoints.
With this patch, the effect of this maintenance command as follows:
lihui@bogon:~$ cat test.c
int a = 0;
int main()
{
a = 1;
return 0;
}
lihui@bogon:~$ gcc -g test.c -o test
lihui@bogon:~$ gdb test
...
(gdb) watch a
Hardware watchpoint 1: a
(gdb) maint set show-debug-regs on
(gdb) r
Starting program: /home/lihui/test
...
...
prepare_to_resume thread 41525
...
insert_watchpoint (addr=0x12000803c, len=4, type=hw-write-watchpoint):
BREAKPOINTs:
BP0: addr=0x0, ctrl=0x00000000, ref.count=0
BP1: addr=0x0, ctrl=0x00000000, ref.count=0
BP2: addr=0x0, ctrl=0x00000000, ref.count=0
BP3: addr=0x0, ctrl=0x00000000, ref.count=0
BP4: addr=0x0, ctrl=0x00000000, ref.count=0
BP5: addr=0x0, ctrl=0x00000000, ref.count=0
BP6: addr=0x0, ctrl=0x00000000, ref.count=0
BP7: addr=0x0, ctrl=0x00000000, ref.count=0
WATCHPOINTs:
WP0: addr=0x0, ctrl=0x00000000, ref.count=0
WP1: addr=0x0, ctrl=0x00000000, ref.count=0
WP2: addr=0x0, ctrl=0x00000000, ref.count=0
WP3: addr=0x0, ctrl=0x00000000, ref.count=0
WP4: addr=0x0, ctrl=0x00000000, ref.count=0
WP5: addr=0x0, ctrl=0x00000000, ref.count=0
WP6: addr=0x0, ctrl=0x00000000, ref.count=0
WP7: addr=0x12000803c, ctrl=0x00000610, ref.count=1
...
remove_watchpoint (addr=0x12000803c, len=4, type=hw-write-watchpoint):
BREAKPOINTs:
BP0: addr=0x0, ctrl=0x00000000, ref.count=0
BP1: addr=0x0, ctrl=0x00000000, ref.count=0
BP2: addr=0x0, ctrl=0x00000000, ref.count=0
BP3: addr=0x0, ctrl=0x00000000, ref.count=0
BP4: addr=0x0, ctrl=0x00000000, ref.count=0
BP5: addr=0x0, ctrl=0x00000000, ref.count=0
BP6: addr=0x0, ctrl=0x00000000, ref.count=0
BP7: addr=0x0, ctrl=0x00000000, ref.count=0
WATCHPOINTs:
WP0: addr=0x0, ctrl=0x00000000, ref.count=0
WP1: addr=0x0, ctrl=0x00000000, ref.count=0
WP2: addr=0x0, ctrl=0x00000000, ref.count=0
WP3: addr=0x0, ctrl=0x00000000, ref.count=0
WP4: addr=0x0, ctrl=0x00000000, ref.count=0
WP5: addr=0x0, ctrl=0x00000000, ref.count=0
WP6: addr=0x0, ctrl=0x00000000, ref.count=0
WP7: addr=0x0, ctrl=0x00000000, ref.count=0
Hardware watchpoint 1: a
Old value = 0
New value = 1
main () at test.c:5
5 return 0;
(gdb)
Signed-off-by: Hui Li <lihui@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>