gdb/sim: Assert that the simulator ptid is not null_ptid
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 4 Feb 2020 09:07:16 +0000 (09:07 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 4 Feb 2020 16:46:10 +0000 (16:46 +0000)
We assign the simulator inferior a fake ptid.  If this ptid is ever
set to null_ptid then we are going to run into problems - the
simulator ptid is what we return from gdbsim_target::wait, and this in
turn is used to look up the inferior data with a call to
find_inferior_pid, which asserts the pid is not 0 (which it is in
null_pid).

This commit adds an assert that the simulator's fake pid is not
null_ptid.  There should be no user visible changes after this commit.

gdb/ChangeLog:

* remote-sim.c (sim_inferior_data::sim_inferior_data): Assert that
we don't set the fake simulator ptid to the null_ptid.

Change-Id: I6e08effe70e70855aea13c9caf4fd6913d5af56d

gdb/ChangeLog
gdb/remote-sim.c

index 504961bdc900511bee5198b1f5b03e790e60b3ff..8080c47932cbb567e00950a19199baaf7137c84f 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-04  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * remote-sim.c (sim_inferior_data::sim_inferior_data): Assert that
+       we don't set the fake simulator ptid to the null_ptid.
+
 2020-02-03  Simon Marchi  <simon.marchi@efficios.com>
 
        * fork-child.c (gdb_startup_inferior): Use bool instead of int.
index 281232cc4e5bfa104d3a41cd0a72aea5de976ba9..b7ce4672a1a5a55100f1aaa7bca73f52b1ea3899 100644 (file)
@@ -86,6 +86,7 @@ struct sim_inferior_data {
     : gdbsim_desc (desc),
       remote_sim_ptid (next_pid, 0, next_pid)
   {
+    gdb_assert (remote_sim_ptid != null_ptid);
     ++next_pid;
   }
 
This page took 0.027662 seconds and 4 git commands to generate.