[PATCH 1/1] gdb, python: fix python breakpoint with extra spec

Schimpe, Christina christina.schimpe@intel.com
Mon Jun 5 07:36:03 GMT 2023


Hi Keith, 

Thanks a lot for your review.

> If it is desired to be able to set breakpoint properties during construction, is
> expanding the ctor to accept a keyword not a viable, if not cleaner, option?

I understand, but still I am not sure. Let me try to explain.

> "Create a new breakpoint according to spec, which is a string naming the
> location of a breakpoint."
> 
> While it happens to work, "thread 1000" is not part of the location.

The entire section says: 
"Create a new breakpoint according to spec, which is a string naming the location of a breakpoint, or an expression that defines a watchpoint. The string should describe a location in a format recognized by the break command (see Setting Breakpoints) or, in the case of a watchpoint, by the watch command (see Setting Watchpoints)"

So I tried to figure out what this location format should look like and found this: https://sourceware.org/gdb/onlinedocs/gdb/Set-Breaks.html

"break locspec
Set a breakpoint at all the code locations in your program that result from resolving the given locspec. locspec can specify a function name, a line number, an address of an instruction, and more. See Location Specifications, for the various forms of locspec. The breakpoint will stop your program just before it executes the instruction at the address of any of the breakpoint’s code locations.
...

It is also possible to insert a breakpoint that will stop the program only if a specific thread (see Thread-Specific Breakpoints) or a specific task (see Ada Tasks) hits that breakpoint.
"

which finally brought me to Thread-Specific Breakpoints: https://sourceware.org/gdb/onlinedocs/gdb/Thread_002dSpecific-Breakpoints.html#Thread_002dSpecific-Breakpoints

"break locspec thread thread-id
break locspec thread thread-id if …
locspec specifies a code location or locations in your program. See Location Specifications, for details."

So from my understanding the suggested fix is doing what the documentation describes.

Christina
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


More information about the Gdb-patches mailing list