aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-mi-cmd.exp
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-09-07 13:45:40 +0100
committerAndrew Burgess <aburgess@redhat.com>2025-03-28 23:39:07 +0000
commite83f6121679065bc79aa0cd41225fde48b8b25d4 (patch)
tree686369ae72659760f42de6aaf4af858cd9758bc7 /gdb/testsuite/gdb.python/py-mi-cmd.exp
parent43ac3df61492b94bf13c11bd98c9f9541e92d3b0 (diff)
downloadbinutils-e83f6121679065bc79aa0cd41225fde48b8b25d4.zip
binutils-e83f6121679065bc79aa0cd41225fde48b8b25d4.tar.gz
binutils-e83f6121679065bc79aa0cd41225fde48b8b25d4.tar.bz2
gdb: reduce breakpoint-modified events for dprintf b/p
Consider this backtrace within GDB: #0 notify_breakpoint_modified (b=0x57d31d0) at ../../src/gdb/breakpoint.c:1083 #1 0x00000000005b6406 in breakpoint_set_commands (b=0x57d31d0, commands=...) at ../../src/gdb/breakpoint.c:1523 #2 0x00000000005c8c63 in update_dprintf_command_list (b=0x57d31d0) at ../../src/gdb/breakpoint.c:8641 #3 0x00000000005d3c4e in dprintf_breakpoint::re_set (this=0x57d31d0) at ../../src/gdb/breakpoint.c:12476 #4 0x00000000005d6347 in breakpoint_re_set () at ../../src/gdb/breakpoint.c:13298 Whenever breakpoint_re_set is called we re-build the commands that the dprintf b/p will execute and store these into the breakpoint. The commands are re-built in update_dprintf_command_list and stored into the breakpoint object in breakpoint_set_commands. Now sometimes these commands can change, dprintf_breakpoint::re_set explains one case where this can occur, and I'm sure there must be others. But in most cases the commands we recalculate will not change. This means that the breakpoint modified event which is emitted from breakpoint_set_commands is redundant. This commit aims to eliminate the redundant breakpoint modified events for dprintf breakpoints. This is done by adding a commands_equal call to the start of breakpoint_set_commands. The commands_equal function is a new function which compares two command_line objects and returns true if they are identical. Using this function we can check if the new commands passed to breakpoint_set_commands are identical to the breakpoint's existing commands. If the new commands are equal then we don't need to change anything on the new breakpoint, and the breakpoint modified event can be skipped. The test for this commit stops at a dlopen() call in the inferior, sets up a dprintf breakpoint, then uses 'next' to step over the dlopen() call. When the library loads GDB call breakpoint_re_set, which calls dprintf_breakpoint::re_set. But in this case we don't expect the calculated command string to change, so we don't expect to see the breakpoint modified event.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-mi-cmd.exp')
0 files changed, 0 insertions, 0 deletions