https://sourceware.org/bugzilla/show_bug.cgi?id=29278
Bug ID: 29278 Summary: gdb crashes on interrupt (non-stop mode, target extended-remote) Product: binutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: Manfred.Steiner at gmx dot at Target Milestone: --- binutils-gdb Version: 13.0.50.20220615-git When working with a AVR Stub in non-stop mode via target extended-remote, it is possible to start without program running (stub returns an empty thread list on qfThreadInfo request), or to detach from program. If you execute interrupt in this situation on gdb command line, gdb crashes with backtrace output. inferior.c:304: internal-error: find_inferior_pid: Assertion `pid != 0' failed. A problem internal to GDB has been detected, ... .../binutils-gdb/gdb/inferior.c:299 ... Looking inside source code shows the cause: file gdb/inferior.c:298: struct inferior * find_inferior_pid (process_stratum_target *targ, int pid) { /* Looking for inferior pid == 0 is always wrong, and indicative of a bug somewhere else. There may be more than one with pid == 0, for instance. */ gdb_assert (pid != 0); ... I think the comment is outdated and it would be better to replace the assert with: if (pid == 0) { return NULL; } because pid == 0 is a possible case in non-stop mode when using target extended-remote. Then the interrupt command would be ignored (or result in an error message when the stub returns an error). -- You are receiving this mail because: You are on the CC list for the bug.