aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/amd64obsd-tdep.c2
-rw-r--r--gdb/configure.tgt4
-rw-r--r--gdb/i386obsd-tdep.c2
-rw-r--r--gdb/obsd-tdep.c263
-rw-r--r--gdb/obsd-tdep.h1
6 files changed, 283 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b2cd451..89ccbe6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2014-02-12 Mark Kettenis <kettenis@gnu.org>
+
+ * obsd-tdep.h (obsd_init_abi): New prototype.
+ * obsd-tdep.c: Define enum with OpenBSD signal numbers.
+ (obsd_gdb_signal_from_target, obsd_gdb_signal_to_target)
+ (obsd_init_abi): New functions.
+ * i386obsd-tdep.c: Include "obsd-tdep.h".
+ (i386obsd_init_abi): Call obsd_init_abi.
+ * amd64obsd-tdep.c: Include "obsd-tdep.h".
+ (amd64obsd_init_abi): Call obsd_init_abi.
+ * configure.tgt (i[34567]86-*-openbsd*, x86_64-*-openbsd*): Add
+ obsd-tdep.c to gdb_target_obs.
+
2014-02-11 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc64-tdep.c (sparc64_store_arguments): Do not align complex
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index d9cea9c..9446318 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -32,6 +32,7 @@
#include "gdb_assert.h"
#include <string.h>
+#include "obsd-tdep.h"
#include "amd64-tdep.h"
#include "i387-tdep.h"
#include "solib-svr4.h"
@@ -459,6 +460,7 @@ amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
amd64_init_abi (info, gdbarch);
+ obsd_init_abi (info, gdbarch);
/* Initialize general-purpose register set details. */
tdep->gregset_reg_offset = amd64obsd_r_reg_offset;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 7fe0807..6706f84 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -199,7 +199,7 @@ i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
i[34567]86-*-openbsd*)
# Target: OpenBSD/i386
gdb_target_obs="i386-tdep.o i387-tdep.o i386bsd-tdep.o i386obsd-tdep.o \
- bsd-uthread.o solib-svr4.o"
+ obsd-tdep.o bsd-uthread.o solib-svr4.o"
;;
i[34567]86-*-nto*)
# Target: Intel 386 running qnx6.
@@ -685,7 +685,7 @@ x86_64-*-openbsd*)
# Target: OpenBSD/amd64
gdb_target_obs="amd64-tdep.o amd64obsd-tdep.o i386-tdep.o \
i387-tdep.o i386bsd-tdep.o i386obsd-tdep.o \
- bsd-uthread.o solib-svr4.o"
+ obsd-tdep.o bsd-uthread.o solib-svr4.o"
;;
xtensa*-*-linux*) gdb_target=linux
# Target: GNU/Linux Xtensa
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index 9868b76..cf19c50 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -33,6 +33,7 @@
#include "gdb_assert.h"
#include <string.h>
+#include "obsd-tdep.h"
#include "i386-tdep.h"
#include "i387-tdep.h"
#include "solib-svr4.h"
@@ -447,6 +448,7 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Obviously OpenBSD is BSD-based. */
i386bsd_init_abi (info, gdbarch);
+ obsd_init_abi (info, gdbarch);
/* OpenBSD has a different `struct reg'. */
tdep->gregset_reg_offset = i386obsd_r_reg_offset;
diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c
index 829c1c2..830dd75 100644
--- a/gdb/obsd-tdep.c
+++ b/gdb/obsd-tdep.c
@@ -34,3 +34,266 @@ obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
else
return find_solib_trampoline_target (get_current_frame (), pc);
}
+
+/* OpenBSD signal numbers. From <sys/signal.h>. */
+
+enum
+ {
+ OBSD_SIGHUP = 1,
+ OBSD_SIGINT = 2,
+ OBSD_SIGQUIT = 3,
+ OBSD_SIGILL = 4,
+ OBSD_SIGTRAP = 5,
+ OBSD_SIGABRT = 6,
+ OBSD_SIGEMT = 7,
+ OBSD_SIGFPE = 8,
+ OBSD_SIGKILL = 9,
+ OBSD_SIGBUS = 10,
+ OBSD_SIGSEGV = 11,
+ OBSD_SIGSYS = 12,
+ OBSD_SIGPIPE = 13,
+ OBSD_SIGALRM = 14,
+ OBSD_SIGTERM = 15,
+ OBSD_SIGURG = 16,
+ OBSD_SIGSTOP = 17,
+ OBSD_SIGTSTP = 18,
+ OBSD_SIGCONT = 19,
+ OBSD_SIGCHLD = 20,
+ OBSD_SIGTTIN = 21,
+ OBSD_SIGTTOU = 22,
+ OBSD_SIGIO = 23,
+ OBSD_SIGXCPU = 24,
+ OBSD_SIGXFSZ = 25,
+ OBSD_SIGVTALRM = 26,
+ OBSD_SIGPROF = 27,
+ OBSD_SIGWINCH = 28,
+ OBSD_SIGINFO = 29,
+ OBSD_SIGUSR1 = 30,
+ OBSD_SIGUSR2 = 31,
+ OBSD_SIGTHR = 32,
+ };
+
+/* Implement the "gdb_signal_from_target" gdbarch method. */
+
+static enum gdb_signal
+obsd_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
+{
+ switch (signal)
+ {
+ case 0:
+ return GDB_SIGNAL_0;
+
+ case OBSD_SIGHUP:
+ return GDB_SIGNAL_HUP;
+
+ case OBSD_SIGINT:
+ return GDB_SIGNAL_INT;
+
+ case OBSD_SIGQUIT:
+ return GDB_SIGNAL_QUIT;
+
+ case OBSD_SIGILL:
+ return GDB_SIGNAL_ILL;
+
+ case OBSD_SIGTRAP:
+ return GDB_SIGNAL_TRAP;
+
+ case OBSD_SIGABRT:
+ return GDB_SIGNAL_ABRT;
+
+ case OBSD_SIGEMT:
+ return GDB_SIGNAL_EMT;
+
+ case OBSD_SIGFPE:
+ return GDB_SIGNAL_FPE;
+
+ case OBSD_SIGKILL:
+ return GDB_SIGNAL_KILL;
+
+ case OBSD_SIGBUS:
+ return GDB_SIGNAL_BUS;
+
+ case OBSD_SIGSEGV:
+ return GDB_SIGNAL_SEGV;
+
+ case OBSD_SIGSYS:
+ return GDB_SIGNAL_SYS;
+
+ case OBSD_SIGPIPE:
+ return GDB_SIGNAL_PIPE;
+
+ case OBSD_SIGALRM:
+ return GDB_SIGNAL_ALRM;
+
+ case OBSD_SIGTERM:
+ return GDB_SIGNAL_TERM;
+
+ case OBSD_SIGURG:
+ return GDB_SIGNAL_URG;
+
+ case OBSD_SIGSTOP:
+ return GDB_SIGNAL_STOP;
+
+ case OBSD_SIGTSTP:
+ return GDB_SIGNAL_TSTP;
+
+ case OBSD_SIGCONT:
+ return GDB_SIGNAL_CONT;
+
+ case OBSD_SIGCHLD:
+ return GDB_SIGNAL_CHLD;
+
+ case OBSD_SIGTTIN:
+ return GDB_SIGNAL_TTIN;
+
+ case OBSD_SIGTTOU:
+ return GDB_SIGNAL_TTOU;
+
+ case OBSD_SIGIO:
+ return GDB_SIGNAL_IO;
+
+ case OBSD_SIGXCPU:
+ return GDB_SIGNAL_XCPU;
+
+ case OBSD_SIGXFSZ:
+ return GDB_SIGNAL_XFSZ;
+
+ case OBSD_SIGVTALRM:
+ return GDB_SIGNAL_VTALRM;
+
+ case OBSD_SIGPROF:
+ return GDB_SIGNAL_PROF;
+
+ case OBSD_SIGWINCH:
+ return GDB_SIGNAL_WINCH;
+
+ case OBSD_SIGINFO:
+ return GDB_SIGNAL_INFO;
+
+ case OBSD_SIGUSR1:
+ return GDB_SIGNAL_USR1;
+
+ case OBSD_SIGUSR2:
+ return GDB_SIGNAL_USR2;
+ }
+
+ return GDB_SIGNAL_UNKNOWN;
+}
+
+/* Implement the "gdb_signal_to_target" gdbarch method. */
+
+static int
+obsd_gdb_signal_to_target (struct gdbarch *gdbarch,
+ enum gdb_signal signal)
+{
+ switch (signal)
+ {
+ case GDB_SIGNAL_0:
+ return 0;
+
+ case GDB_SIGNAL_HUP:
+ return OBSD_SIGHUP;
+
+ case GDB_SIGNAL_INT:
+ return OBSD_SIGINT;
+
+ case GDB_SIGNAL_QUIT:
+ return OBSD_SIGQUIT;
+
+ case GDB_SIGNAL_ILL:
+ return OBSD_SIGILL;
+
+ case GDB_SIGNAL_TRAP:
+ return OBSD_SIGTRAP;
+
+ case GDB_SIGNAL_ABRT:
+ return OBSD_SIGABRT;
+
+ case GDB_SIGNAL_EMT:
+ return OBSD_SIGEMT;
+
+ case GDB_SIGNAL_FPE:
+ return OBSD_SIGFPE;
+
+ case GDB_SIGNAL_KILL:
+ return OBSD_SIGKILL;
+
+ case GDB_SIGNAL_BUS:
+ return OBSD_SIGBUS;
+
+ case GDB_SIGNAL_SEGV:
+ return OBSD_SIGSEGV;
+
+ case GDB_SIGNAL_SYS:
+ return OBSD_SIGSYS;
+
+ case GDB_SIGNAL_PIPE:
+ return OBSD_SIGPIPE;
+
+ case GDB_SIGNAL_ALRM:
+ return OBSD_SIGALRM;
+
+ case GDB_SIGNAL_TERM:
+ return OBSD_SIGTERM;
+
+ case GDB_SIGNAL_URG:
+ return OBSD_SIGURG;
+
+ case GDB_SIGNAL_STOP:
+ return OBSD_SIGSTOP;
+
+ case GDB_SIGNAL_TSTP:
+ return OBSD_SIGTSTP;
+
+ case GDB_SIGNAL_CONT:
+ return OBSD_SIGCONT;
+
+ case GDB_SIGNAL_CHLD:
+ return OBSD_SIGCHLD;
+
+ case GDB_SIGNAL_TTIN:
+ return OBSD_SIGTTIN;
+
+ case GDB_SIGNAL_TTOU:
+ return OBSD_SIGTTOU;
+
+ case GDB_SIGNAL_IO:
+ return OBSD_SIGIO;
+
+ case GDB_SIGNAL_XCPU:
+ return OBSD_SIGXCPU;
+
+ case GDB_SIGNAL_XFSZ:
+ return OBSD_SIGXFSZ;
+
+ case GDB_SIGNAL_VTALRM:
+ return OBSD_SIGVTALRM;
+
+ case GDB_SIGNAL_PROF:
+ return OBSD_SIGPROF;
+
+ case GDB_SIGNAL_WINCH:
+ return OBSD_SIGWINCH;
+
+ case GDB_SIGNAL_USR1:
+ return OBSD_SIGUSR1;
+
+ case GDB_SIGNAL_USR2:
+ return OBSD_SIGUSR2;
+
+ case GDB_SIGNAL_INFO:
+ return OBSD_SIGINFO;
+ }
+
+ return -1;
+}
+
+
+void
+obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ set_gdbarch_gdb_signal_from_target (gdbarch,
+ obsd_gdb_signal_from_target);
+ set_gdbarch_gdb_signal_to_target (gdbarch,
+ obsd_gdb_signal_to_target);
+}
diff --git a/gdb/obsd-tdep.h b/gdb/obsd-tdep.h
index 24e380e..0f89277 100644
--- a/gdb/obsd-tdep.h
+++ b/gdb/obsd-tdep.h
@@ -23,5 +23,6 @@
struct gdbarch;
CORE_ADDR obsd_skip_solib_resolver (struct gdbarch *, CORE_ADDR);
+void obsd_init_abi (struct gdbarch_info, struct gdbarch *);
#endif /* obsd-tdep.h */