This is a regression from GDB 9 Since GDB started supporting multi-targets, we need to provide a PID to execute the inferior. The record subsystem was updated to save the ptid of the recorded inferior and use it, but resuming from a recording never got this update. This means that a fresh GDB session loading a precsave file would never populate the ptid field, and GDB asserts like so: ../../gdb/inferior.c:293: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed. Our testsuite never picked this up because if you load the precsave in a session that has already set the recorded ptid, things just work, and none of the precsave tests try a clean_restart to exercise a fresh session. I'm opening this bug so we can backport the solution (once accepted) for a GDB 15.2 release
The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=25c228409597bcb7114a9a839ac08db0ba995418 commit 25c228409597bcb7114a9a839ac08db0ba995418 Author: Hannes Domani <ssbssa@yahoo.de> Date: Mon Jul 15 16:29:36 2024 +0200 Fix loading a saved recording Currently you get this assertion failure if you try to execute the inferior after loading a saved recording, when no recording was done earlier in the same gdb session: ``` $ gdb -q c -ex "record restore test.rec" Reading symbols from c... [New LWP 26428] Core was generated by `/tmp/c'. Restored records from core file /tmp/test.rec. (gdb) c Continuing. ../../gdb/inferior.c:293: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ``` The change in step-precsave.exp triggers this bug, since now the recording is loaded in a new gdb session, where record_full_resume_ptid was never set. The fix is to simply set record_full_resume_ptid when resuming a loaded recording. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31971 Approved-By: Guinevere Larsen <blarsen@redhat.com>
Fixed.
The gdb-15-branch branch has been updated by Hannes Domani <ssbssa@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e7c91a1ff9e0f87f79f630296219765a6ab1f3e3 commit e7c91a1ff9e0f87f79f630296219765a6ab1f3e3 Author: Hannes Domani <ssbssa@yahoo.de> Date: Mon Jul 15 16:29:36 2024 +0200 Fix loading a saved recording Currently you get this assertion failure if you try to execute the inferior after loading a saved recording, when no recording was done earlier in the same gdb session: ``` $ gdb -q c -ex "record restore test.rec" Reading symbols from c... [New LWP 26428] Core was generated by `/tmp/c'. Restored records from core file /tmp/test.rec. (gdb) c Continuing. ../../gdb/inferior.c:293: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ``` The change in step-precsave.exp triggers this bug, since now the recording is loaded in a new gdb session, where record_full_resume_ptid was never set. The fix is to simply set record_full_resume_ptid when resuming a loaded recording. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31971 Approved-By: Guinevere Larsen <blarsen@redhat.com>