an internal error occurs when you try to `delete' a breakpoint during `stop' callback:
(gdb) python MyBP(spec="main")
Starting program: /home/kevin/a.out
/home/kevin/travail/srcs/git/gdb/gdb/breakpoint.c:4573: internal-error: bpstat_what: unhandled bptype -1120308712
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
I cannot replicate this, can you still replicate it Kevin?
(gdb) file ~/simple
> def stop(self):
> print "hello"
(gdb) py bp = b("main")
Breakpoint 1 at 0x400c48: file simple.c, line 4.
[Inferior 1 (process 715) exited normally]
(gdb) info breakpoints
No breakpoints or watchpoints.
> I cannot replicate this, can you still replicate it Kevin?
I double checked, GNU gdb (GDB) Fedora (7.3-43.fc15) does have the bug, so it was solved by the magic of time! Thanks for looking at it
I'm going to change this to wontfix. Because there may be other stop() callbacks yet to be processed on that breakpoint, you should not alter or delete the state of breakpoints. I've submitted a manual patch to explain what you can, or cannot do.
is this a good alternative ?
the documentation of gdb.post_event seems not very clear if you don't look at what is done internally -- I didn't -- but I think it should be safe to do it this way
Module name: src
Changes by: email@example.com 2011-10-07 13:23:19
gdb/doc : ChangeLog gdb.texinfo
2011-10-07 Phil Muldoon <firstname.lastname@example.org>
* gdb.texinfo (Breakpoints In Python): Clarify behavior in the
Yes, I believe so. But you are still in very dangerous waters. What happened if you deleted the breakpoint, but returned "True" from that function. At the very least any breakpoint event notification would be broken. GDB would call breakpoint stopped observers, but would not have a breakpoint to reference. There is nothing to stop you doing it in your scripts, but I would really be very careful.
(In reply to comment #4)
> is this a good alternative ?
> class MyBP(gdb.Breakpoint):
> def stop(self):
I think so.
> the documentation of gdb.post_event seems not very clear if you don't look at
> what is done internally -- I didn't -- but I think it should be safe to do it
> this way
Can you suggest how to fix the docs?