This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 4/4] [nto] Setup signals.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]