[binutils-gdb] sim: cris: override getpid callback

Michael Frysinger vapier@sourceware.org
Thu Jun 24 00:10:28 GMT 2021


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

commit e91488f739f0dbb93bfd9d96164c25d9674846c4
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Jun 20 23:42:20 2021 -0400

    sim: cris: override getpid callback
    
    The cris linux syscall layers assume getpid returns a constant,
    so add a custom function to provide that.

Diff:
---
 sim/cris/ChangeLog | 5 +++++
 sim/cris/traps.c   | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 78b106535ba..1f4bd8bb3c3 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* traps.c (cris_getpid): New function.
+	(cris_set_callbacks): Assign cris_getpid.
+
 2021-06-22  Mike Frysinger  <vapier@gentoo.org>
 
 	* sim-if.c: Include sim-hw.h.
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index f92bb7cdebe..fd7f9bc7ae2 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -3336,6 +3336,12 @@ cris_time (host_callback *cb ATTRIBUTE_UNUSED)
   return TARGET_TIME (current_cpu_for_cb_callback);
 }
 
+static int
+cris_getpid (host_callback *cb ATTRIBUTE_UNUSED)
+{
+  return TARGET_PID;
+}
+
 /* Set target-specific callback data. */
 
 void
@@ -3345,6 +3351,8 @@ cris_set_callbacks (host_callback *cb)
   cb->syscall_map = (CB_TARGET_DEFS_MAP *) syscall_map;
   cb->errno_map = (CB_TARGET_DEFS_MAP *) errno_map;
 
+  cb->getpid = cris_getpid;
+
   /* The kernel stat64 layout.  If we see a file > 2G, the "long"
      parameter to cb_store_target_endian will make st_size negative.
      Similarly for st_ino.  FIXME: Find a 64-bit type, and use it


More information about the Gdb-cvs mailing list