From patchwork Tue Oct 13 16:01:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandar Ristovski X-Patchwork-Id: 9087 Received: (qmail 41278 invoked by alias); 13 Oct 2015 16:01:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 41211 invoked by uid 89); 13 Oct 2015 16:01:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_40, RCVD_IN_DNSWL_LOW, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: smtp-a02.blackberry.com Received: from smtp-a02.blackberry.com (HELO smtp-a02.blackberry.com) (208.65.78.91) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Oct 2015 16:01:29 +0000 Received: from mhs102cnc.rim.net ([10.65.141.76]) by mhs215cnc-app.rim.net with ESMTP; 13 Oct 2015 12:01:17 -0400 Received: from unknown (HELO qnxws9580.ott.qnx.com) ([10.65.140.254]) by mhs102cnc.rim.net with ESMTP; 13 Oct 2015 16:01:16 +0000 From: Aleksandar Ristovski To: gdb-patches@sourceware.org Cc: Aleksandar Ristovski Subject: [PATCH 4/4] [nto] Setup signals. Date: Tue, 13 Oct 2015 12:01:14 -0400 Message-Id: <1444752074-878-5-git-send-email-aristovski@qnx.com> In-Reply-To: <1444752074-878-1-git-send-email-aristovski@qnx.com> References: <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 + + * 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 * 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")