]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix loading a saved recording
authorHannes Domani <ssbssa@yahoo.de>
Mon, 15 Jul 2024 14:29:36 +0000 (16:29 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Mon, 15 Jul 2024 14:31:20 +0000 (16:31 +0200)
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>
gdb/record-full.c
gdb/testsuite/gdb.reverse/step-precsave.exp

index eb62d186fa5eadec2e009e808407c40e6e28cc9c..ab854e0133fecccefa7b9c519b887300c4f62e86 100644 (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;
 }
index d9377635dcf9577b6bb86570616a901844bfd9cf..9ae67b37f3fc302a226b786f7cabc5bafecd10ba 100644 (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"