This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH/SPARC] Add NetBSD/sparc native
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 16 Nov 2003 11:21:42 +0100 (CET)
- Subject: [PATCH/SPARC] Add NetBSD/sparc native
Committed to the SPARC branch.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* sparc-tdep.h (sparc32nbsd_gregset): Add extern declaration.
* sparcnbsd-nat.c: Rewrite.
* sparcnbsd-tdep.c (sparc32nbsd_gregset): Rename from
sparcnbsd_gregset.
(fetch_core_registers): Adjust.
(sparc32nbsd_init_abi): Rename from sparcnbsd_init_abi.
(sparc32nbsd_aout_init_abi): Rename from sparcbsd_aout_init_abi.
(sparc32nbsd_elf_init_abi): Rename from sparcbsd_elf_init_abi.
(_initialize_sparnbsd_tdep): Adjust.
* Makefile.in (ALLDEPFILES): Add sparcnbsd-nat.c.
(sparcnbsd-nat.o): New dependency.
* configure.host: Add sparc-*-netbsdelf*, sparc-*-netbsdaout* and
sparc-*-netbsd*.
* config/sparc/nm-nbsd.h: Don't include "regcache.h".
(CHILD_PREPARE_TO_STORE): Remove.
* config/sparc/nm-nbsdaout.h: Tweak some comments.
* config/sparc/nbsdelf.mh (NATDEPFILES): Add sparc-nat.o.
(XM_FILE): Delete.
* config/sparc/nbsdaout.mh (NATDEPFILES): Add sparc-nat.o
(XM_FILE): Delete.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.445.2.7
diff -u -p -r1.445.2.7 Makefile.in
--- Makefile.in 15 Nov 2003 21:27:05 -0000 1.445.2.7
+++ Makefile.in 16 Nov 2003 10:14:56 -0000
@@ -1296,7 +1296,7 @@ ALLDEPFILES = \
solib.c solib-irix.c solib-svr4.c solib-sunos.c \
sparc-tdep.c sparc-linux-tdep.c sparc-sol2-tdep.c \
sparcnbsd-tdep.c \
- sparc-nat.c sparc-sol2-nat.c sparcbsd-nat.c \
+ sparc-nat.c sparc-sol2-nat.c sparcbsd-nat.c sparcnbsd-nat.c \
sparc64-tdep.c sparc64-sol2-tdep.c sparc64-linux-tdep.c \
sparc64fbsd-tdep.c \
sparc64-nat.c sparc64-sol2-nat.c sparc64-linux-nat.c \
@@ -2323,6 +2323,7 @@ sparc-sol2-tdep.o: sparc-sol2-tdep.c $(d
$(gdb_string_h) $(sparc_tdep_h)
sparcbsd-nat.o: sparcbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
$(sparc64_tdep_h) $(sparcbsd_nat_h)
+sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(sparc_tdep_h) $(sparc_nat_h)
sparcnbsd-tdep.o: sparcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(osabi_h) \
$(regcache_h) $(solib_svr4_h) $(gdb_string_h) \
$(sparc_tdep_h) $(nbsd_tdep_h)
Index: configure.host
===================================================================
RCS file: /cvs/src/src/gdb/configure.host,v
retrieving revision 1.57.4.4
diff -u -p -r1.57.4.4 configure.host
--- configure.host 2 Nov 2003 20:54:47 -0000 1.57.4.4
+++ configure.host 16 Nov 2003 10:14:56 -0000
@@ -131,6 +131,9 @@ s390*-*-*) gdb_host=s390 ;;
sh*-*-netbsdelf*) gdb_host=nbsd ;;
sparc-*-linux*) gdb_host=linux ;;
+sparc-*-netbsdelf*) gdb_host=nbsdelf ;;
+sparc-*-netbsdaout*) gdb_host_nbsdaout ;;
+sparc-*-netbsd*) gdb_host=nbsdaout ;;
sparc-*-solaris2*) gdb_host=sol2 ;;
sparc64-*-freebsd*) gdb_host=fbsd ;;
sparc64-*-linux*) gdb_host=linux64 ;;
Index: sparc-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.h,v
retrieving revision 1.3.10.5
diff -u -p -r1.3.10.5 sparc-tdep.h
--- sparc-tdep.h 15 Nov 2003 17:56:45 -0000 1.3.10.5
+++ sparc-tdep.h 16 Nov 2003 10:14:56 -0000
@@ -171,4 +171,9 @@ extern const struct sparc_gregset sparc3
extern void sparc32_sol2_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
+/* Functions and variables exported from sparcnbsd-tdep.c. */
+
+/* Register offsets for NetBSD. */
+extern const struct sparc_gregset sparc32nbsd_gregset;
+
#endif /* sparc-tdep.h */
Index: sparcnbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcnbsd-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 sparcnbsd-nat.c
--- sparcnbsd-nat.c 7 Jul 2003 15:56:08 -0000 1.2
+++ sparcnbsd-nat.c 16 Nov 2003 10:14:56 -0000
@@ -1,4 +1,5 @@
-/* Native-dependent code for SPARC systems running NetBSD.
+/* Native-dependent code for NetBSD/sparc.
+
Copyright 2002, 2003 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
@@ -20,136 +21,15 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
-#include "inferior.h"
-#include "regcache.h"
#include "sparc-tdep.h"
-#include "sparcnbsd-tdep.h"
-
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <machine/reg.h>
-
-/* NOTE: We don't bother with any of the deferred_store nonsense; it
- makes things a lot more complicated than they need to be. */
-
-/* Determine if PT_GETREGS fetches this register. */
-static int
-getregs_supplies (int regno)
-{
- return (regno == PS_REGNUM
- || regno == PC_REGNUM
- || regno == NPC_REGNUM
- || regno == Y_REGNUM
- || (regno >= G0_REGNUM && regno <= G7_REGNUM)
- || (regno >= O0_REGNUM && regno <= O7_REGNUM)
- /* stack regs (handled by sparcnbsd_supply_reg) */
- || (regno >= L0_REGNUM && regno <= I7_REGNUM));
-}
-
-/* Determine if PT_GETFPREGS fetches this register. */
-static int
-getfpregs_supplies (int regno)
-{
- return ((regno >= FP0_REGNUM && regno <= (FP0_REGNUM + 31))
- || regno == FPS_REGNUM);
-}
+#include "sparc-nat.h"
-void
-fetch_inferior_registers (int regno)
-{
- /* We don't use deferred stores. */
- if (deferred_stores)
- internal_error (__FILE__, __LINE__,
- "fetch_inferior_registers: deferred stores pending");
-
- if (regno == -1 || getregs_supplies (regno))
- {
- struct reg regs;
-
- if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) ®s, 0) == -1)
- perror_with_name ("Couldn't get registers");
-
- sparcnbsd_supply_reg32 ((char *) ®s, regno);
- if (regno != -1)
- return;
- }
-
- if (regno == -1 || getfpregs_supplies (regno))
- {
- struct fpreg fpregs;
-
- if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
- perror_with_name ("Couldn't get floating point registers");
-
- sparcnbsd_supply_fpreg32 ((char *) &fpregs, regno);
- if (regno != -1)
- return;
- }
-}
+/* Provide a prototype to silence -Wmissing-prototypes. */
+void _initialize_sparcnbsd_nat (void);
void
-store_inferior_registers (int regno)
+_initialize_sparcnbsd_nat (void)
{
- /* We don't use deferred stores. */
- if (deferred_stores)
- internal_error (__FILE__, __LINE__,
- "store_inferior_registers: deferred stores pending");
-
- if (regno == -1 || getregs_supplies (regno))
- {
- struct reg regs;
-
- if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) ®s, 0) == -1)
- perror_with_name ("Couldn't get registers");
-
- sparcnbsd_fill_reg32 ((char *) ®s, regno);
-
- if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) ®s, 0) == -1)
- perror_with_name ("Couldn't write registers");
-
- /* Deal with the stack regs. */
- if (regno == -1 || regno == SP_REGNUM
- || (regno >= L0_REGNUM && regno <= I7_REGNUM))
- {
- CORE_ADDR sp = read_register (SP_REGNUM);
- int i;
- char buf[4];
-
- for (i = L0_REGNUM; i <= I7_REGNUM; i++)
- {
- if (regno == -1 || regno == SP_REGNUM || regno == i)
- {
- regcache_collect (i, buf);
- target_write_memory (sp + ((i - L0_REGNUM) * 4),
- buf, sizeof (buf));
- }
- }
- }
-
- if (regno != -1)
- return;
- }
-
- if (regno == -1 || getfpregs_supplies (regno))
- {
- struct fpreg fpregs;
-
- if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
- perror_with_name ("Couldn't get floating point registers");
-
- sparcnbsd_fill_fpreg32 ((char *) &fpregs, regno);
-
- if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
- perror_with_name ("Couldn't write floating point registers");
-
- if (regno != -1)
- return;
- }
+ sparc_gregset = &sparc32nbsd_gregset;
}
Index: sparcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcnbsd-tdep.c,v
retrieving revision 1.7.2.1
diff -u -p -r1.7.2.1 sparcnbsd-tdep.c
--- sparcnbsd-tdep.c 15 Nov 2003 21:27:05 -0000 1.7.2.1
+++ sparcnbsd-tdep.c 16 Nov 2003 10:14:56 -0000
@@ -31,7 +31,7 @@
#include "sparc-tdep.h"
#include "nbsd-tdep.h"
-const struct sparc_gregset sparcnbsd_gregset =
+const struct sparc_gregset sparc32nbsd_gregset =
{
0 * 4, /* %psr */
1 * 4, /* %pc */
@@ -59,7 +59,7 @@ fetch_core_registers (char *core_reg_sec
case 0: /* Integer registers. */
if (core_reg_size != reg_size)
warning ("Wrong size register set in core file.");
- sparc32_supply_gregset (&sparcnbsd_gregset, current_regcache,
+ sparc32_supply_gregset (&sparc32nbsd_gregset, current_regcache,
-1, core_reg_sect);
break;
@@ -102,25 +102,25 @@ sparcnbsd_aout_in_solib_call_trampoline
}
static void
-sparcnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
/* NetBSD doesn't support the 128-bit `long double' from the psABI. */
set_gdbarch_long_double_bit (gdbarch, 64);
}
static void
-sparcnbsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+sparc32nbsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- sparcnbsd_init_abi (info, gdbarch);
+ sparc32nbsd_init_abi (info, gdbarch);
set_gdbarch_in_solib_call_trampoline
(gdbarch, sparcnbsd_aout_in_solib_call_trampoline);
}
static void
-sparcnbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+sparc32nbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- sparcnbsd_init_abi (info, gdbarch);
+ sparc32nbsd_init_abi (info, gdbarch);
set_gdbarch_pc_in_sigtramp (gdbarch, nbsd_pc_in_sigtramp);
@@ -148,9 +148,9 @@ _initialize_sparnbsd_tdep (void)
sparcnbsd_aout_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD_AOUT,
- sparcnbsd_aout_init_abi);
+ sparc32nbsd_aout_init_abi);
gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD_ELF,
- sparcnbsd_elf_init_abi);
+ sparc32nbsd_elf_init_abi);
add_core_fns (&sparcnbsd_core_fns);
add_core_fns (&sparcnbsd_elfcore_fns);
Index: config/sparc/nbsdaout.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsdaout.mh,v
retrieving revision 1.2
diff -u -p -r1.2 nbsdaout.mh
--- config/sparc/nbsdaout.mh 31 May 2002 00:59:15 -0000 1.2
+++ config/sparc/nbsdaout.mh 16 Nov 2003 10:14:56 -0000
@@ -1,4 +1,4 @@
-# Host: Sun 4 or Sparcstation, running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o sparcnbsd-nat.o solib-sunos.o
-XM_FILE= xm-nbsd.h
+# Host: NetBSD/sparc a.out
+NATDEPFILES= sparc-nat.o sparcnbsd-nat.o \
+ fork-child.o infptrace.o inftarg.o solib-sunos.o
NAT_FILE= nm-nbsdaout.h
Index: config/sparc/nbsdelf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsdelf.mh,v
retrieving revision 1.10
diff -u -p -r1.10 nbsdelf.mh
--- config/sparc/nbsdelf.mh 31 May 2002 00:59:15 -0000 1.10
+++ config/sparc/nbsdelf.mh 16 Nov 2003 10:14:56 -0000
@@ -1,4 +1,4 @@
-# Host: Sun 4 or Sparcstation, running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o sparcnbsd-nat.o
-XM_FILE= xm-nbsd.h
+# Host: NetBSD/sparc ELF
+NATDEPFILES= sparc-nat.o sparcnbsd-nat.o \
+ fork-child.o infptrace.o inftarg.o
NAT_FILE= nm-nbsd.h
Index: config/sparc/nm-nbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nm-nbsd.h,v
retrieving revision 1.7
diff -u -p -r1.7 nm-nbsd.h
--- config/sparc/nm-nbsd.h 17 May 2003 06:00:00 -0000 1.7
+++ config/sparc/nm-nbsd.h 16 Nov 2003 10:14:56 -0000
@@ -1,5 +1,6 @@
-/* Native-dependent definitions for Sparc running NetBSD, for GDB.
- Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1999, 2000, 2002
+/* Native-dependent definitions for NetBSD/sparc.
+
+ Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1999, 2000, 2002, 2003
Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,14 +23,7 @@
#ifndef NM_NBSD_H
#define NM_NBSD_H
-#include "regcache.h"
-
-/* Get generic NetBSD native definitions. */
-
+/* Get generic NetBSD native definitions. */
#include "config/nm-nbsd.h"
-/* Before storing, we need to read all the registers. */
-
-#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, DEPRECATED_REGISTER_BYTES)
-
-#endif /* NM_NBSD_H */
+#endif /* nm-nbsd.h */
Index: config/sparc/nm-nbsdaout.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nm-nbsdaout.h,v
retrieving revision 1.1
diff -u -p -r1.1 nm-nbsdaout.h
--- config/sparc/nm-nbsdaout.h 22 May 2002 03:59:55 -0000 1.1
+++ config/sparc/nm-nbsdaout.h 16 Nov 2003 10:14:56 -0000
@@ -1,5 +1,6 @@
-/* Native-dependent definitions for Sparc running NetBSD a.out, for GDB.
- Copyright 1999 Free Software Foundation, Inc.
+/* Native-dependent definitions for NetBSD/sparc a.out.
+
+ Copyright 1999, 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,8 +24,7 @@
#include "sparc/nm-nbsd.h"
-/* Get generic NetBSD a.out native definitions. */
-
+/* Get generic NetBSD a.out native definitions. */
#include "config/nm-nbsdaout.h"
-#endif /* NM_NBSDAOUT_H */
+#endif /* nm-nbsdaout.h */