summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-06-20 12:53:38 -0400
committerMike Frysinger <vapier@gentoo.org>2021-06-22 19:38:48 -0400
commit13b0d6e5a2d1f5d8580dfcb52d9496eb04cf2ca1 (patch)
treec4180d0f616fbc06fbfea490d0ca3e7f39f38b07
parentcc40b4f2a3c66db1219e851c837c9e5481124aab (diff)
downloadbinutils-gdb-13b0d6e5a2d1f5d8580dfcb52d9496eb04cf2ca1.tar.gz
sim: callback: add missing cb_target_to_host_signal
There's been a prototype for this forever, but the implementation was missing. Probably because there weren't any callers, but we'll start using it to implement the kill function.
-rw-r--r--sim/common/ChangeLog4
-rw-r--r--sim/common/callback.c13
2 files changed, 17 insertions, 0 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 5ce1a66dd0e..fdfeca9b9a5 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,9 @@
2021-06-22 Mike Frysinger <vapier@gentoo.org>
+ * callback.c (cb_target_to_host_signal): New function.
+
+2021-06-22 Mike Frysinger <vapier@gentoo.org>
+
* callback.c: Include signal.h.
(cb_init_signal_map): New prototype.
(os_init): Assign signal_map.
diff --git a/sim/common/callback.c b/sim/common/callback.c
index aca0112853c..06d76b47724 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -927,6 +927,19 @@ cb_target_to_host_open (host_callback *cb, int target_val)
return host_val;
}
+/* Translate the target's version of a signal number to the host's.
+ This isn't actually the host's version, rather a canonical form.
+ ??? Perhaps this should be renamed to ..._canon_signal. */
+
+int
+cb_target_to_host_signal (host_callback *cb, int target_val)
+{
+ const CB_TARGET_DEFS_MAP *m =
+ cb_target_map_entry (cb->signal_map, target_val);
+
+ return m ? m->host_val : -1;
+}
+
/* Utility for e.g. cb_host_to_target_stat to store values in the target's
stat struct.