summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/Makefile.in11
-rw-r--r--gdb/NEWS4
-rw-r--r--gdb/alphanbsd-nat.c136
-rw-r--r--gdb/alphanbsd-tdep.c146
-rw-r--r--gdb/config/alpha/nbsd.mh4
-rw-r--r--gdb/config/alpha/nbsd.mt3
-rw-r--r--gdb/config/alpha/nm-nbsd.h36
-rw-r--r--gdb/config/alpha/tm-nbsd.h32
-rw-r--r--gdb/configure.host1
-rw-r--r--gdb/configure.tgt1
11 files changed, 388 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e42ebd36da0..910812af93d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,21 @@
2002-04-24 Jason Thorpe <thorpej@wasabisystems.com>
+ * Makefile.in (ALLDEPFILES): Add alphanbsd-nat.c and
+ alphanbsd-tdep.c.
+ (alphanbsd-nat.o): New dependency list.
+ (alphanbsd-tdep.o): Ditto.
+ * NEWS: Note new native NetBSD/alpha configuration.
+ * alphanbsd-nat.c: New file.
+ * alphanbsd-tdep.c: Ditto.
+ * configure.host (alpha*-*-netbsd*): New host.
+ * configure.tgt (alpha*-*-netbsd*): New target.
+ * config/alpha/nbsd.mh: New file.
+ * config/alpha/nbsd.mt: Ditto.
+ * config/alpha/nm-nbsd.h: Ditto.
+ * config/alpha/tm-nbsd.h: Ditto.
+
+2002-04-24 Jason Thorpe <thorpej@wasabisystems.com>
+
* Makefile.in (ALLDEPFILES): Add alpha-osf1-tdep.c.
(alpha-osf1-tdep.o): New dependency list.
* alpha-tdep.h (gdbarch_tdep): Add dynamic_sigtramp_offset
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index de82a03d6bd..2151c324bc2 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1178,8 +1178,9 @@ unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET :
ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \
29k-share/udi/udi2go32.c \
a29k-tdep.c a68v-nat.c \
- alpha-nat.c alphabsd-nat.c alpha-tdep.c \
- alpha-linux-tdep.c alpha-osf1-tdep.c alphafbsd-tdep.c \
+ alpha-nat.c alphabsd-nat.c alphanbsd-nat.c \
+ alpha-tdep.c alpha-linux-tdep.c alphanbsd-tdep.c alpha-osf1-tdep.c \
+ alphafbsd-tdep.c \
arm-linux-nat.c arm-linux-tdep.c arm-tdep.c \
armnbsd-nat.c armnbsd-tdep.c \
coff-solib.c \
@@ -1249,6 +1250,9 @@ alpha-nat.o: alpha-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \
alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
alpha-tdep.h
+alphanbsd-nat.o: alphanbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
+ $(gdbcore_h) alpha-tdep.h
+
alpha-tdep.o: alpha-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) $(symtab_h) $(dis_asm_h) $(gdb_string_h) $(linespec_h) \
$(regcache_h) $(doublest_h) $(BFD_SRC)/elf-bfd.h alpha-tdep.h
@@ -1259,6 +1263,9 @@ alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(value_h) alpha-tdep.h
alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) alpha-tdep.h
+alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(value_h) \
+ alpha-tdep.h
+
annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) $(gdbtypes_h)
arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
diff --git a/gdb/NEWS b/gdb/NEWS
index 73857309a4c..d276e6da1a4 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,10 @@
*** Changes since GDB 5.2:
+* New native configurations
+
+Alpha NetBSD alpha*-*-netbsd*
+
* Changes in Alpha configurations.
Multi-arch support is enabled for all Alpha configurations.
diff --git a/gdb/alphanbsd-nat.c b/gdb/alphanbsd-nat.c
new file mode 100644
index 00000000000..ed90de3e330
--- /dev/null
+++ b/gdb/alphanbsd-nat.c
@@ -0,0 +1,136 @@
+/* Native-dependent code for Alpha NetBSD.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include <sys/types.h>
+#include <machine/reg.h>
+#include <machine/frame.h>
+#include <machine/pcb.h>
+#include "gdbcore.h"
+#include "regcache.h"
+
+#include "alpha-tdep.h"
+
+#ifndef HAVE_GREGSET_T
+typedef struct reg gregset_t;
+#endif
+
+#ifndef HAVE_FPREGSET_T
+typedef struct fpreg fpregset_t;
+#endif
+
+#include "gregset.h"
+
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
+{
+ struct md_coredump *core_reg;
+ char *regs;
+ int regno;
+
+ /* Table to map a gdb register number to a trapframe register index. */
+ static const int regmap[] =
+ {
+ FRAME_V0, FRAME_T0, FRAME_T1, FRAME_T2,
+ FRAME_T3, FRAME_T4, FRAME_T5, FRAME_T6,
+ FRAME_T7, FRAME_S0, FRAME_S1, FRAME_S2,
+ FRAME_S3, FRAME_S4, FRAME_S5, FRAME_S6,
+ FRAME_A0, FRAME_A1, FRAME_A2, FRAME_A3,
+ FRAME_A4, FRAME_A5, FRAME_T8, FRAME_T9,
+ FRAME_T10, FRAME_T11, FRAME_RA, FRAME_T12,
+ FRAME_AT, FRAME_GP, FRAME_SP
+ };
+
+ /* We get everything from one section. */
+ if (which != 0)
+ return;
+
+ core_reg = (struct md_coredump *) core_reg_sect;
+ regs = (char *) &core_reg->md_tf;
+
+ if (core_reg_size < sizeof (*core_reg))
+ {
+ warning ("Wrong size register set in core file.");
+ return;
+ }
+
+ /* Integer registers. */
+ for (regno = 0; regno < ALPHA_ZERO_REGNUM; regno++)
+ supply_register (regno, regs + (regmap[regno] * 8));
+ supply_register (ALPHA_ZERO_REGNUM, NULL);
+ supply_register (FP_REGNUM, NULL);
+ supply_register (PC_REGNUM, regs + (FRAME_PC * 8));
+
+ /* Floating point registers. */
+ supply_fpregset (&core_reg->md_fpstate);
+}
+
+static void
+fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
+{
+ switch (which)
+ {
+ case 0: /* Integer registers. */
+ if (core_reg_size != sizeof (struct reg))
+ warning ("Wrong size register set in core file.");
+ else
+ supply_gregset ((gregset_t *) core_reg_sect);
+ break;
+
+ case 2: /* Floating point registers. */
+ if (core_reg_size != sizeof (struct fpreg))
+ warning ("Wrong size FP register set in core file.");
+ else
+ supply_fpregset ((fpregset_t *) core_reg_sect);
+ break;
+
+ default:
+ /* Don't know what kind of register request this is; just ignore it. */
+ break;
+ }
+}
+
+static struct core_fns alphanbsd_core_fns =
+{
+ bfd_target_unknown_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
+};
+
+static struct core_fns alphanbsd_elfcore_fns =
+{
+ bfd_target_elf_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_elfcore_registers, /* core_read_registers */
+ NULL /* next */
+};
+
+void
+_initialize_alphanbsd_nat (void)
+{
+ add_core_fns (&alphanbsd_core_fns);
+ add_core_fns (&alphanbsd_elfcore_fns);
+}
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
new file mode 100644
index 00000000000..3f3ae529e52
--- /dev/null
+++ b/gdb/alphanbsd-tdep.c
@@ -0,0 +1,146 @@
+/* Target-dependent code for NetBSD/Alpha.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "value.h"
+#include "solib-svr4.h"
+
+#include "alpha-tdep.h"
+
+/* Fetch (and possibly build) an appropriate link_map_offsets
+ structure for NetBSD/alpha targets using the struct offsets
+ defined in <link.h> (but without actual reference to that file).
+
+ This makes it possible to access NetBSD/alpha shared libraries
+ from a GDB that was not built on a NetBSD/alpha host (for cross
+ debugging). */
+
+static struct link_map_offsets *
+alphanbsd_solib_svr4_fetch_link_map_offsets (void)
+{
+ static struct link_map_offsets lmo;
+ static struct link_map_offsets *lmp = NULL;
+
+ if (lmp == NULL)
+ {
+ lmp = &lmo;
+
+ lmo.r_debug_size = 32;
+
+ lmo.r_map_offset = 8;
+ lmo.r_map_size = 8;
+
+ lmo.link_map_size = 40;
+
+ lmo.l_addr_offset = 0;
+ lmo.l_addr_size = 8;
+
+ lmo.l_name_offset = 8;
+ lmo.l_name_size = 8;
+
+ lmo.l_next_offset = 24;
+ lmo.l_next_size = 8;
+
+ lmo.l_prev_offset = 32;
+ lmo.l_prev_size = 8;
+ }
+
+ return lmp;
+}
+
+/* Under NetBSD/alpha, signal handler invocations can be identified by the
+ designated code sequence that is used to return from a signal handler.
+ In particular, the return address of a signal handler points to the
+ following code sequence:
+
+ ldq a0, 0(sp)
+ lda sp, 16(sp)
+ lda v0, 295(zero) # __sigreturn14
+ call_pal callsys
+
+ Each instruction has a unique encoding, so we simply attempt to match
+ the instruction the PC is pointing to with any of the above instructions.
+ If there is a hit, we know the offset to the start of the designated
+ sequence and can then check whether we really are executing in the
+ signal trampoline. If not, -1 is returned, otherwise the offset from the
+ start of the return sequence is returned. */
+static const unsigned int sigtramp_retcode[] =
+{
+ 0xa61e0000, /* ldq a0, 0(sp) */
+ 0x23de0010, /* lda sp, 16(sp) */
+ 0x201f0127, /* lda v0, 295(zero) */
+ 0x00000083, /* call_pal callsys */
+};
+#define RETCODE_NWORDS \
+ (sizeof (sigtramp_retcode) / sizeof (sigtramp_retcode[0]))
+
+LONGEST
+alphanbsd_sigtramp_offset (CORE_ADDR pc)
+{
+ unsigned int ret[4], w;
+ LONGEST off;
+ int i;
+
+ if (read_memory_nobpt (pc, (char *) &w, 4) != 0)
+ return -1;
+
+ for (i = 0; i < RETCODE_NWORDS; i++)
+ {
+ if (w == sigtramp_retcode[i])
+ break;
+ }
+ if (i == RETCODE_NWORDS)
+ return (-1);
+
+ off = i * 4;
+ pc -= off;
+
+ if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0)
+ return -1;
+
+ if (memcmp (ret, sigtramp_retcode, sizeof (sigtramp_retcode)) == 0)
+ return off;
+
+ return -1;
+}
+
+static void
+alphanbsd_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* NetBSD/alpha does not provide single step support via ptrace(2); we
+ must use software single-stepping. */
+ set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
+
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ alphanbsd_solib_svr4_fetch_link_map_offsets);
+
+ tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
+}
+
+void
+_initialize_alphanbsd_tdep (void)
+{
+ alpha_gdbarch_register_os_abi (ALPHA_ABI_NETBSD, alphanbsd_init_abi);
+}
diff --git a/gdb/config/alpha/nbsd.mh b/gdb/config/alpha/nbsd.mh
new file mode 100644
index 00000000000..cb9122a6736
--- /dev/null
+++ b/gdb/config/alpha/nbsd.mh
@@ -0,0 +1,4 @@
+# Host: Alpha running NetBSD
+NAT_CLIBS=
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o alphabsd-nat.o alphanbsd-nat.o solib-legacy.o
+NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/alpha/nbsd.mt b/gdb/config/alpha/nbsd.mt
new file mode 100644
index 00000000000..f3a2ff10dda
--- /dev/null
+++ b/gdb/config/alpha/nbsd.mt
@@ -0,0 +1,3 @@
+# Target: Alpha running NetBSD
+TDEPFILES= alpha-tdep.o alphanbsd-tdep.o solib.o solib-svr4.o
+TM_FILE= tm-nbsd.h
diff --git a/gdb/config/alpha/nm-nbsd.h b/gdb/config/alpha/nm-nbsd.h
new file mode 100644
index 00000000000..aab9edf5c31
--- /dev/null
+++ b/gdb/config/alpha/nm-nbsd.h
@@ -0,0 +1,36 @@
+/* Native-dependent definitions for Alpha running NetBSD, for GDB.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef NM_NBSD_H
+#define NM_NBSD_H
+
+#define SVR4_SHARED_LIBS
+
+/* Get generic NetBSD native definitions. */
+#include "config/nm-nbsd.h"
+
+/* The Alpha does not step over a breakpoint. */
+#define CANNOT_STEP_BREAKPOINT
+
+/* NetBSD/alpha has shared libraries. */
+#define GDB_TARGET_HAS_SHARED_LIBS
+
+#endif /* NM_NBSD_H */
diff --git a/gdb/config/alpha/tm-nbsd.h b/gdb/config/alpha/tm-nbsd.h
new file mode 100644
index 00000000000..9e926566538
--- /dev/null
+++ b/gdb/config/alpha/tm-nbsd.h
@@ -0,0 +1,32 @@
+/* Target-dependent definitions for NetBSD/Alpha.
+ Copyright 2002 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef TM_NBSD_H
+#define TM_NBSD_H
+
+#include "alpha/tm-alpha.h"
+
+/* Number of traps that happen between exec'ing the shell to run an
+ inferior, and when we finally get to the inferior code. The
+ default is right for NetBSD. */
+
+#undef START_INFERIOR_TRAPS_EXPECTED
+
+#endif /* TM_NBSD_H */
diff --git a/gdb/configure.host b/gdb/configure.host
index 4c69fff627e..0c26ac0d79b 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -34,6 +34,7 @@ alpha*-*-osf2*) gdb_host=alpha-osf2 ;;
alpha*-*-osf[3456789]*) gdb_host=alpha-osf3 ;;
alpha*-*-linux*) gdb_host=alpha-linux ;;
alpha*-*-freebsd*) gdb_host=fbsd ;;
+alpha*-*-netbsd*) gdb_host=nbsd ;;
arm*-*-linux*) gdb_host=linux ;;
arm*-*-netbsd*) gdb_host=nbsd ;;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 1ccdfed8c15..64fdb4a3594 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -48,6 +48,7 @@ case "${target}" in
alpha*-*-osf*) gdb_target=alpha-osf1 ;;
alpha*-*-linux*) gdb_target=alpha-linux ;;
alpha*-*-freebsd*) gdb_target=fbsd ;;
+alpha*-*-netbsd*) gdb_target=nbsd ;;
arc-*-*) gdb_target=arc ;;