[PATCH] [gdb/python] Handle bp creation and deletion in Breakpoint.stop

Andrew Burgess aburgess@redhat.com
Tue Dec 10 08:33:02 GMT 2024


Tom de Vries <tdevries@suse.de> writes:

> In the documentation of gdb.Breakpoint.stop [1] we read:
> ...
> You should not alter the execution state of the inferior (i.e., step, next,
> etc.), alter the current frame context (i.e., change the current active
> frame), or alter, add or delete any breakpoint.
> ...
>
> PR python/32423 reports that the failure mode of attempting to delete a
> breakpoint in gdb.Breakpoint.stop is:
> - actually deleting the breakpoint, followed by
> - a segfault.
>
> Improve the failure mode, by instead:
> - not deleting the breakpoint, and
> - throwing an error.
>
> Likewise for attempting to create a breakpoint.  Doing so reveals that
> gdb.python/py-finish-breakpoint.exp contains test-cases that add a breakpoint
> in Breakpoint.stop.  Drop these incorrect tests.

Do these tests actually cause issues other than violating the docs?
It's not clear if your "Likewise" here means, likewise creating
breakpoints causes problems like use after free, or just likewise doing
this violates the docs, so lets remove that functionality.

If possible I'd much rather we update the docs to cover the allowable
functionality, than restrict GDB to meet the docs.

Thanks,
Andrew



More information about the Gdb-patches mailing list