public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/sim: Assert that the simulator ptid is not null_ptid
@ 2020-02-04 16:46 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2020-02-04 16:46 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dcc9fbc6da9536f65c55dbb67f50ab3c2e086c6e

commit dcc9fbc6da9536f65c55dbb67f50ab3c2e086c6e
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Tue Feb 4 09:07:16 2020 +0000

    gdb/sim: Assert that the simulator ptid is not null_ptid
    
    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

Diff:
---
 gdb/ChangeLog    | 5 +++++
 gdb/remote-sim.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 504961b..8080c47 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 281232c..b7ce467 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;
   }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-04 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 16:46 [binutils-gdb] gdb/sim: Assert that the simulator ptid is not null_ptid Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).