This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Temporary breakpoints delete notification


Hello,
I'm working on a gdb frontend [1] (using gdb/mi), and was just adding
support for temporary breakpoints.  The problem i'm running into is
that when gdb hits a temporary breakpoint, it removes the breakpoint
automatically (which is good and what I would expect), but as far as I
can tell, it doesn't notify us at all that a breakpoint has been
removed.  The reason that this is problematic is that we need to track
breakpoints locally so that we can display them graphically (e.g. an
icon in the margin of the source view and an entry in our breakpoint
list widget).  If the debugger removes breakpoints without telling us
about it, then the breakpoints that we think are set no longer match
the breakpoints that are actually set in the underlying gdb engine.

The first thought I had for a 'workaround' on this issue was to detect
when gdb had stopped due to a temporary breakpoint and just remove our
copy of the breakpoint, assuming that the breakpoint had already been
automatically deleted by the gdb engine.  However, this approach isn't
particularly easy either, because gdb doesn't ever tell us why we
broke when we hit a temporary breakpoint.  Compare the gdb/mi output
from hitting a temporary breakpoint:
*stopped,thread-id="1",frame={addr="0x080557bb",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbfca9c54"}],file="main.cc",fullname="/home/jonathon/Projects/xplot/src/main.cc",line="51"}
to the output from hitting a standard breakpoint:
*stopped,reason="breakpoint-hit",bkptno="1",thread-id="1",frame={addr="0x08055769",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbfca9c54"}],file="main.cc",fullname="/home/jonathon/Projects/xplot/src/main.cc",line="43"}

So when we hit a temporary breakpoint, gdb doesn't even give us a
reason (e.g. "breakpoint-hit") for stopping.  One option would be to
use the address / location given to us and look for a temporary
breakpoint in our list that matches that point, and if we find one
that matches assume that that's what caused us to stop and we should
remove it from our list.  That seems like a lot of assumptions to
make, however.  Is there a reason that gdb doesn't give us a reason
for stopping when it hits a temporary breakpoint?

Another potential workaround would be: any time we stop, query the
list of breakpoints to see if the list we keep locally matches the one
held by gdb.  This seems overly burdensome and inefficient, however.

So, is there any chance that gdb could notify us whenever it
automatically deletes breakpoints?  (Or, better yet, is there some way
to get gdb to give us this information that I have overlooked?)

thanks

[1] http://home.gna.org/nemiver/

--
jonner


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]