[Bug python/34379] New: Self deleting breakpoints crash gdb

"nathan.titirangi at gmail dot com via Gdb-prs" <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34379

            Bug ID: 34379
           Summary: Self deleting breakpoints crash gdb
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: nathan.titirangi at gmail dot com
  Target Milestone: ---

Tested on gdb version "GNU gdb (GDB) 18.0.50.20260709-git" and an older gdb
version.

Source the following python script

```py
import gdb

class CrashingBreakpoint(gdb.Breakpoint):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)

    def stop(self):
        self.delete()
        return False
```

And then place the breakpoint somewhere where it will be hit via `python
CrashingBreakpoint("*main+24")` or similar. When it is hit gdb will immediately
crash with the following backtrace:

Fatal signal: Segmentation fault
----- Backtrace -----
0x631993b4b691 gdb_internal_backtrace_1
      /home/nathan/Documents/code/binutils-gdb/gdb/bt-utils.c:122
0x631993b4b691 _Z22gdb_internal_backtracev
      /home/nathan/Documents/code/binutils-gdb/gdb/bt-utils.c:173
0x631993c9d8d3 handle_fatal_signal
      /home/nathan/Documents/code/binutils-gdb/gdb/event-top.c:1008
0x631993c9de79 handle_sigsegv
      /home/nathan/Documents/code/binutils-gdb/gdb/event-top.c:1085
0x70ac51c4532f ???
0x631993b221a5 _Z22bpstat_explains_signalP6bpstat10gdb_signal
      /home/nathan/Documents/code/binutils-gdb/gdb/breakpoint.c:4731
0x631993d3598b handle_signal_stop
      /home/nathan/Documents/code/binutils-gdb/gdb/infrun.c:7252
0x631993d3699d handle_stop_requested
      /home/nathan/Documents/code/binutils-gdb/gdb/infrun.c:5230
0x631993d3699d handle_stop_requested
      /home/nathan/Documents/code/binutils-gdb/gdb/infrun.c:5225
0x631993d3699d handle_inferior_event
      /home/nathan/Documents/code/binutils-gdb/gdb/infrun.c:6696
0x631993d384af _Z20fetch_inferior_eventv
      /home/nathan/Documents/code/binutils-gdb/gdb/infrun.c:4756
0x631994158185 gdb_wait_for_event
      /home/nathan/Documents/code/binutils-gdb/gdbsupport/event-loop.cc:694
0x631994158966 _Z16gdb_do_one_eventi
      /home/nathan/Documents/code/binutils-gdb/gdbsupport/event-loop.cc:216
0x631993d92379 _ZN6interp12do_one_eventEi
      /home/nathan/Documents/code/binutils-gdb/gdb/interps.h:90
0x631993d92379 start_event_loop
      /home/nathan/Documents/code/binutils-gdb/gdb/main.c:401
0x631993d92379 captured_command_loop
      /home/nathan/Documents/code/binutils-gdb/gdb/main.c:466
0x631993d94804 captured_main
      /home/nathan/Documents/code/binutils-gdb/gdb/main.c:1374
0x631993d94804 _Z8gdb_mainP18captured_main_args
      /home/nathan/Documents/code/binutils-gdb/gdb/main.c:1393
0x631993a78e6b main
      /home/nathan/Documents/code/binutils-gdb/gdb/gdb.c:38
---------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.