[PUSHED] gdb/sim: Assert that the simulator ptid is not null_ptid

Message ID 20200204164733.12564-1-andrew.burgess@embecosm.com
State New
Headers show
Series
  • [PUSHED] gdb/sim: Assert that the simulator ptid is not null_ptid
Related show

Commit Message

Andrew Burgess Feb. 4, 2020, 4:47 p.m.
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    | 5 +++++
 gdb/remote-sim.c | 1 +
 2 files changed, 6 insertions(+)

-- 
2.14.5

Patch

diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 281232cc4e5..b7ce4672a1a 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -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;
   }