Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb-patches@sourceware.org
Cc: Aleksandar Ristovski <aristovski@qnx.com>
Subject: [PATCH 4/4] [nto] Setup signals.
Date: Tue, 13 Oct 2015 16:01:00 -0000	[thread overview]
Message-ID: <1444752074-878-5-git-send-email-aristovski@qnx.com> (raw)
In-Reply-To: <1444752074-878-1-git-send-email-aristovski@qnx.com>

Add new file with neutrino signal numerical values.

        * i386-nto-tdep.c (i386nto_init_abi): Setup new
        nto_gdb_signal_from_target and nto_gdb_signal_to_target.
        * nto-tdep.c (signals): New definition.
        (nto_gdb_signal_to_target, nto_gdb_signal_from_target): New functions.
        * nto-tdep.h (nto_gdb_signal_to_target, nto_gdb_signal_from_target):
        New declarations.
        * nto_signals.def: New file.
        * include/gdb/signals.def (GDB_SIGNAL_SELECT): New gdb signal enum.
        (GDB_SIGNAL_LAST): Bump numeric value up.
---
 gdb/ChangeLog           | 12 +++++++++
 gdb/i386-nto-tdep.c     |  3 +++
 gdb/nto-tdep.c          | 45 ++++++++++++++++++++++++++++++++
 gdb/nto-tdep.h          |  3 +++
 gdb/nto_signals.def     | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/gdb/signals.def |  5 +++-
 6 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 gdb/nto_signals.def

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1aa8a68..24a5483 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+<2015-4>  Aleksandar Ristovski  <aristovski@qnx.com>
+
+	* i386-nto-tdep.c (i386nto_init_abi): Setup new
+	nto_gdb_signal_from_target and nto_gdb_signal_to_target.
+	* nto-tdep.c (signals): New definition.
+	(nto_gdb_signal_to_target, nto_gdb_signal_from_target): New functions.
+	* nto-tdep.h (nto_gdb_signal_to_target, nto_gdb_signal_from_target):
+	New declarations.
+	* nto_signals.def: New file.
+	* include/gdb/signals.def (GDB_SIGNAL_SELECT): New gdb signal enum.
+	(GDB_SIGNAL_LAST): Bump numeric value up.
+
 <2015-3>  Aleksandar Ristovski  <aristovski@qnx.com>
 
 	* nto-procfs.c (procfs_wait): Set stopped_flags.
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 818c408..af64a67 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -362,6 +362,9 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
         = nto_in_dynsym_resolve_code;
     }
   set_solib_ops (gdbarch, &nto_svr4_so_ops);
+
+  set_gdbarch_gdb_signal_from_target (gdbarch, nto_gdb_signal_from_target);
+  set_gdbarch_gdb_signal_to_target (gdbarch, nto_gdb_signal_to_target);
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 62dbf8b..da5423f 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -556,6 +556,51 @@ nto_inferior_data (struct inferior *const inferior)
   return inf_data;
 }
 
+/* This table must match in order and size the signals in enum
+   gdb_signal.  */
+
+static const struct {
+  const enum gdb_signal gdb_signal;
+  const int nto_signo;
+  } signals [] =
+{
+#define SET(symbol, constant, name, string) { symbol, constant },
+#include "nto_signals.def"
+#undef SET
+};
+
+
+int
+nto_gdb_signal_to_target (struct gdbarch *gdbarch,
+			  enum gdb_signal const signal)
+{
+  unsigned sig;
+  const unsigned signalsz = sizeof (signals) / sizeof (signals[0]);
+
+  for (sig = 0; sig != signalsz; ++sig)
+    if (signals[sig].gdb_signal == signal)
+      return signals[sig].nto_signo;
+
+  warning (_("GDB signal %d (%s) can not be mapped to a Neutrino signal\n"),
+	   (int) signal, gdb_signal_to_name (signal));
+  return 0;
+}
+
+enum gdb_signal
+nto_gdb_signal_from_target (struct gdbarch *gdbarch, int const signo)
+{
+  unsigned sig;
+  const unsigned signalsz = sizeof (signals) / sizeof (signals[0]);
+
+  for (sig = 0; sig != signalsz; ++sig)
+    if (signals[sig].nto_signo == signo)
+      return signals[sig].gdb_signal;
+
+  warning (_("Neutrino signal %d can not be mapped to gdb signal\n"),
+	   signo);
+  return GDB_SIGNAL_0;
+}
+
 /* Provide a prototype to silence -Wmissing-prototypes.  */
 extern initialize_file_ftype _initialize_nto_tdep;
 
diff --git a/gdb/nto-tdep.h b/gdb/nto-tdep.h
index 6ed9da0..5cdd4f4 100644
--- a/gdb/nto-tdep.h
+++ b/gdb/nto-tdep.h
@@ -184,4 +184,7 @@ LONGEST nto_read_auxv_from_initial_stack (CORE_ADDR inital_stack,
 
 struct nto_inferior_data *nto_inferior_data (struct inferior *inf);
 
+gdbarch_gdb_signal_to_target_ftype nto_gdb_signal_to_target;
+gdbarch_gdb_signal_from_target_ftype nto_gdb_signal_from_target;
+
 #endif
diff --git a/gdb/nto_signals.def b/gdb/nto_signals.def
new file mode 100644
index 0000000..2fee39f
--- /dev/null
+++ b/gdb/nto_signals.def
@@ -0,0 +1,68 @@
+SET (GDB_SIGNAL_HUP, 1, "SIGHUP", "Hangup")
+SET (GDB_SIGNAL_INT, 2, "SIGINT", "Interrupt")
+SET (GDB_SIGNAL_QUIT, 3, "SIGQUIT", "Quit")
+SET (GDB_SIGNAL_ILL, 4, "SIGILL", "Illegal instruction")
+SET (GDB_SIGNAL_TRAP, 5, "SIGTRAP", "Trace/breakpoint trap")
+SET (GDB_SIGNAL_ABRT, 6, "SIGABRT", "Aborted")
+SET (GDB_SIGNAL_EMT, 7, "SIGDEADLK", "Mutex deadlock")
+SET (GDB_SIGNAL_FPE, 8, "SIGFPE", "Arithmetic exception")
+SET (GDB_SIGNAL_KILL, 9, "SIGKILL", "Killed")
+SET (GDB_SIGNAL_BUS, 10, "SIGBUS", "Bus error")
+SET (GDB_SIGNAL_SEGV, 11, "SIGSEGV", "Segmentation fault")
+SET (GDB_SIGNAL_SYS, 12, "SIGSYS", "Bad system call")
+SET (GDB_SIGNAL_PIPE, 13, "SIGPIPE", "Broken pipe")
+SET (GDB_SIGNAL_ALRM, 14, "SIGALRM", "Alarm clock")
+SET (GDB_SIGNAL_TERM, 15, "SIGTERM", "Terminated")
+SET (GDB_SIGNAL_USR1, 16, "SIGUSR1", "User defined signal 1")
+SET (GDB_SIGNAL_USR2, 17, "SIGUSR2", "User defined signal 2")
+SET (GDB_SIGNAL_CHLD, 18, "SIGCHLD", "Death of child process")
+SET (GDB_SIGNAL_PWR, 19, "SIGPWR", "Power fail/restart")
+SET (GDB_SIGNAL_WINCH, 20, "SIGWINCH", "Window change")
+SET (GDB_SIGNAL_URG, 21, "SIGURG", "urgent condition on I/O channel")
+SET (GDB_SIGNAL_POLL, 22, "SIGPOLL",  "System V name for SIGIO")
+SET (GDB_SIGNAL_STOP, 23, "SIGSTOP",  "sendable stop signal not from tty")
+SET (GDB_SIGNAL_TSTP, 24, "SIGTSTP", "stop signal from tty")
+SET (GDB_SIGNAL_CONT, 25, "SIGCONT", "continue a stopped process")
+SET (GDB_SIGNAL_TTIN, 26, "SIGTTIN", "attempted background tty read")
+SET (GDB_SIGNAL_TTOU, 27, "SIGTTOU", "attempted background tty write")
+SET (GDB_SIGNAL_VTALRM, 28, "SIGVTALRM", "virtual timer expired")
+SET (GDB_SIGNAL_PROF, 29, "SIGPROF", "profileing timer expired")
+SET (GDB_SIGNAL_XCPU, 30, "SIGXCPU",  "exceded cpu limit")
+SET (GDB_SIGNAL_XFSZ, 31, "SIGXFSZ", "exceded file size limit")
+SET (GDB_SIGNAL_REALTIME_32, 32, "SIG32", "Real-time event 32")
+SET (GDB_SIGNAL_REALTIME_33, 33, "SIG33", "Real-time event 33")
+SET (GDB_SIGNAL_REALTIME_34, 34, "SIG34", "Real-time event 34")
+SET (GDB_SIGNAL_REALTIME_35, 35, "SIG35", "Real-time event 35")
+SET (GDB_SIGNAL_REALTIME_36, 36, "SIG36", "Real-time event 36")
+SET (GDB_SIGNAL_REALTIME_37, 37, "SIG37", "Real-time event 37")
+SET (GDB_SIGNAL_REALTIME_38, 38, "SIG38", "Real-time event 38")
+SET (GDB_SIGNAL_REALTIME_39, 39, "SIG39", "Real-time event 39")
+SET (GDB_SIGNAL_REALTIME_40, 40, "SIG40", "Real-time event 40")
+
+SET (GDB_SIGNAL_REALTIME_41, 41, "SIG41", "Real-time event 41")
+SET (GDB_SIGNAL_REALTIME_42, 42, "SIG42", "Real-time event 42")
+SET (GDB_SIGNAL_REALTIME_43, 43, "SIG43", "Real-time event 43")
+SET (GDB_SIGNAL_REALTIME_44, 44, "SIG44", "Real-time event 44")
+SET (GDB_SIGNAL_REALTIME_45, 45, "SIG45", "Real-time event 45")
+SET (GDB_SIGNAL_REALTIME_46, 46, "SIG46", "Real-time event 46")
+SET (GDB_SIGNAL_REALTIME_47, 47, "SIG47", "Real-time event 47")
+SET (GDB_SIGNAL_REALTIME_48, 48, "SIG48", "Real-time event 48")
+SET (GDB_SIGNAL_REALTIME_49, 49, "SIG49", "Real-time event 49")
+SET (GDB_SIGNAL_REALTIME_50, 50, "SIG50", "Real-time event 50")
+SET (GDB_SIGNAL_REALTIME_51, 51, "SIG51", "Real-time event 51")
+SET (GDB_SIGNAL_REALTIME_52, 52, "SIG52", "Real-time event 52")
+SET (GDB_SIGNAL_REALTIME_53, 53, "SIG53", "Real-time event 53")
+SET (GDB_SIGNAL_REALTIME_54, 54, "SIG54", "Real-time event 54")
+SET (GDB_SIGNAL_REALTIME_55, 55, "SIG55", "Real-time event 55")
+SET (GDB_SIGNAL_REALTIME_56, 56, "SIG56", "Real-time event 56")
+
+SET (GDB_SIGNAL_SELECT, 57, "SIGSELECT", "SIGSELECT") 
+
+/* Use whatever signal we use when one is not specifically specified
+   (for passing to proceed and so on).  */
+SET (GDB_SIGNAL_DEFAULT, 60, NULL,
+     "Internal error: printing GDB_SIGNAL_DEFAULT")
+
+/* Last and unused enum value, for sizing arrays, etc.  */
+SET (GDB_SIGNAL_LAST, 61, NULL, "GDB_SIGNAL_MAGIC")
+
diff --git a/include/gdb/signals.def b/include/gdb/signals.def
index 3f49980..98645ba 100644
--- a/include/gdb/signals.def
+++ b/include/gdb/signals.def
@@ -194,7 +194,10 @@ SET (GDB_EXC_EMULATION, 148, "EXC_EMULATION", "Emulation instruction")
 SET (GDB_EXC_SOFTWARE, 149, "EXC_SOFTWARE", "Software generated exception")
 SET (GDB_EXC_BREAKPOINT, 150, "EXC_BREAKPOINT", "Breakpoint")
 
+/* Special Neutrino signal. */
+SET (GDB_SIGNAL_SELECT, 151, "SIGSELECT", "SIGSELECT")
+
 /* If you are adding a new signal, add it just above this comment.  */
 
 /* Last and unused enum value, for sizing arrays, etc.  */
-SET (GDB_SIGNAL_LAST, 151, NULL, "GDB_SIGNAL_LAST")
+SET (GDB_SIGNAL_LAST, 152, NULL, "GDB_SIGNAL_LAST")
-- 
1.9.1


  reply	other threads:[~2015-10-13 16:01 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 16:01 [PATCH 0/4] [nto] Nto fixes Aleksandar Ristovski
2015-10-13 16:01 ` Aleksandar Ristovski [this message]
2015-10-16 16:16   ` [PATCH 4/4] [nto] Setup signals Pedro Alves
2015-10-22 15:57     ` Aleksandar Ristovski
2015-10-22 15:58       ` Aleksandar Ristovski
2015-10-13 16:01 ` [PATCH 3/4] [nto] Fix nto target stopped by watchpoint Aleksandar Ristovski
2015-10-16 16:10   ` Pedro Alves
2015-10-20 18:42     ` [PATCH 0/2] (patch 3/4 v2) Broken down patch 3/4 Aleksandar Ristovski
2015-10-20 19:24       ` [PATCH 2/2] [nto] Improve ABI sniffing Aleksandar Ristovski
2015-10-21 10:39         ` Pedro Alves
2015-10-21 14:47           ` Aleksandar Ristovski
2015-10-21 14:42             ` Aleksandar Ristovski
2015-10-21 15:17             ` Pedro Alves
2015-10-21 15:37               ` Aleksandar Ristovski
2015-10-21 16:13                 ` Aleksandar Ristovski
2015-10-21 16:39                 ` Pedro Alves
2015-10-21 18:23                   ` Aleksandar Ristovski
2015-10-21 18:10                     ` Aleksandar Ristovski
2015-10-21  8:18       ` [PATCH 1/2] [nto] Fix nto target stopped by watchpoint Aleksandar Ristovski
2015-10-21 10:39         ` Pedro Alves
2015-10-21 18:00           ` Aleksandar Ristovski
2015-10-21 17:51             ` Aleksandar Ristovski
2015-10-13 16:01 ` [PATCH 1/4] [nto] Fix nto build Aleksandar Ristovski
2015-10-15 17:34   ` Pedro Alves
2015-10-13 16:01 ` [PATCH 2/4] [nto] Fixes for nto procfs Aleksandar Ristovski
2015-10-15 17:41   ` Pedro Alves
2015-10-20 13:21     ` Aleksandar Ristovski
2015-10-20 12:43       ` Aleksandar Ristovski
2015-10-20 14:28       ` Pedro Alves
2015-10-20 14:28         ` [PATCH 0/3] (patch 2/4, v2) Break patch 2/4 into 3 Aleksandar Ristovski
2015-10-20 14:28           ` [PATCH 2/3] (patch 2/4, v2) [nto] Implement TARGET_OBJECT_AUXV Aleksandar Ristovski
2015-10-20 15:24             ` Pedro Alves
2015-10-20 16:03               ` Aleksandar Ristovski
2015-10-20 16:48                 ` Pedro Alves
2015-10-20 17:08                   ` Aleksandar Ristovski
2015-10-20 17:13                     ` Aleksandar Ristovski
2015-10-20 18:11                     ` Aleksandar Ristovski
2015-10-20 18:39                       ` Aleksandar Ristovski
2015-10-20 18:11                     ` Pedro Alves
2015-10-20 14:29           ` [PATCH 1/3] (patch 2/4, v2) [nto] Fixes for nto procfs Aleksandar Ristovski
2015-10-20 15:20             ` Pedro Alves
2015-10-20 17:13               ` Aleksandar Ristovski
2015-10-20 17:14                 ` Aleksandar Ristovski
2015-10-20 15:03           ` [PATCH 3/3] (patch 2/4, v2) [nto] Implement procfs_pid_to_exec_file Aleksandar Ristovski
2015-10-20 15:25             ` Pedro Alves
2015-10-20 18:11               ` Aleksandar Ristovski
2015-10-20 18:19                 ` Aleksandar Ristovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444752074-878-5-git-send-email-aristovski@qnx.com \
    --to=aristovski@qnx.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox