Re: [PATCHv7 02/11] gdb: create_breakpoint: asserts relating to extra_string/parse_extra

Tom Tromey
2023-12-15T20:08:34Z

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> This commit makes one possibly breaking change: until this commit it
Andrew> was possible to create thread-specific dprintf breakpoint like this:

Andrew> (gdb) dprintf call_me, thread 1 "%s", "hello"
Andrew> Dprintf 2 at 0x401152: file /tmp/hello.c, line 8.
Andrew> (gdb) info breakpoints
Andrew> Num Type Disp Enb Address What
Andrew> 2 dprintf keep y 0x0000000000401152 in call_me at /tmp/hello.c:8 thread 1
Andrew> stop only in thread 1
Andrew> printf "%s", "hello"
Andrew> (gdb)

Andrew> This feature of dprintf was not documented, was not tested, and is
Andrew> slightly different in syntax to how we create thread specific
Andrew> breakpoints and/or watchpoints -- the thread condition appears after
Andrew> the first ','.

Andrew> I believe that this worked at all was simply by luck. We happen to
Andrew> pass the parse_extra flag as true from dprintf_command to
Andrew> create_breakpoint.

FWIW, I agree, this is just an accident of the implementation and not
something we should continue to support.

Tom