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>
This commit is contained in:
Hannes Domani 2024-07-15 16:29:36 +02:00
parent 134a0a106c
commit 25c2284095
2 changed files with 3 additions and 0 deletions

View file

@ -2073,6 +2073,7 @@ record_full_core_target::resume (ptid_t ptid, int step,
enum gdb_signal signal)
{
record_full_resume_step = step;
record_full_resume_ptid = ptid;
record_full_resumed = 1;
record_full_execution_dir = ::execution_direction;
}

View file

@ -69,6 +69,8 @@ with_timeout_factor 10 {
gdb_test "kill" "" "kill process, prepare to debug log file" \
"Kill the program being debugged\\? \\(y or n\\) " "y"
clean_restart ${binfile}
gdb_test "record restore $precsave" \
"Restored records from core file .*" \
"reload core file"