diff options
author | Jason Thorpe <thorpej@netbsd.org> | 2002-09-01 23:24:19 +0000 |
---|---|---|
committer | Jason Thorpe <thorpej@netbsd.org> | 2002-09-01 23:24:19 +0000 |
commit | 3cac699e88ee490082ae109bb5116cd51404ddd5 (patch) | |
tree | 68ea3327a044f58db0b259fe25b76415391fc0a0 /gdb/i386nbsd-tdep.c | |
parent | 7e3ceb5296ec2772276a902d345e1fca6eede428 (diff) | |
download | gdb-3cac699e88ee490082ae109bb5116cd51404ddd5.zip gdb-3cac699e88ee490082ae109bb5116cd51404ddd5.tar.gz gdb-3cac699e88ee490082ae109bb5116cd51404ddd5.tar.bz2 |
* Makefile.in (i386nbsd-tdep.o): Add $(arch_utils_h),
$(i386_tdep_h), and nbsd-tdep.h to dependency list.
* i386-tdep.h (i386bsd_init_abi): New prototype.
* i386bsd-tdep.c (i386bsd_init_abi): Remove "static" from
function declaration.
(_initialize_i386bsd_tdep): Don't register OS ABI handlers
for NetBSD-a.out or NetBSD-ELF.
(i386nbsd_sigtramp_start, i386nbsd_sigtramp_end)
(i386nbsd_sc_pc_offset, i386nbsd_sc_sp_offset)
(i386nbsd_init_abi, i386nbsdelf_init_abi): Move to...
* i386nbsd-tdep.c: ...here. Include arch-utils.h, i386-tdep.h,
and nbsd-tdep.h.
(i386nbsd_pc_in_sigtramp): New function.
(i386nbsd_init_abi): Set gdbarch_pc_in_sigtramp to
i386nbsd_pc_in_sigtramp.
(_initialize_i386nbsd_tdep): Register i386nbsd_init_abi
and i386nbsdelf_init_abi OS ABI handlers.
* config/i386/nbsdaout.mt (TDEPFILES): Add nbsd-tdep.o.
* config/i386/nbsdelf.mt (TDEPFILES): Likewise.
Diffstat (limited to 'gdb/i386nbsd-tdep.c')
-rw-r--r-- | gdb/i386nbsd-tdep.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 634101a..cba2f19 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -23,8 +23,11 @@ #include "gdbtypes.h" #include "gdbcore.h" #include "regcache.h" +#include "arch-utils.h" +#include "i386-tdep.h" #include "i387-tdep.h" +#include "nbsd-tdep.h" /* Map a GDB register number to an offset in the reg structure. */ static int regmap[] = @@ -137,9 +140,85 @@ static struct core_fns i386nbsd_elfcore_fns = NULL /* next */ }; +static int +i386nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + /* Check for libc-provided signal trampoline. */ + if (nbsd_pc_in_sigtramp (pc, name)) + return 1; + + /* FIXME: sigtramp_start/sigtramp_end need to go away; we should + not be assuming the location of the kernel-provided trampoline! */ + + return (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end); +} + +CORE_ADDR i386nbsd_sigtramp_start = 0xbfbfdf20; +CORE_ADDR i386nbsd_sigtramp_end = 0xbfbfdff0; + +/* From <machine/signal.h>. */ +int i386nbsd_sc_pc_offset = 44; +int i386nbsd_sc_sp_offset = 56; + +static void +i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* Obviously NetBSD is BSD-based. */ + i386bsd_init_abi (info, gdbarch); + + /* NetBSD has different signal trampoline conventions. */ + set_gdbarch_pc_in_sigtramp (gdbarch, i386nbsd_pc_in_sigtramp); + + /* NetBSD uses -freg-struct-return by default. */ + tdep->struct_return = reg_struct_return; + + /* NetBSD uses a different memory layout. */ + tdep->sigtramp_start = i386nbsd_sigtramp_start; + tdep->sigtramp_end = i386nbsd_sigtramp_end; + + /* NetBSD has a `struct sigcontext' that's different from the + origional 4.3 BSD. */ + tdep->sc_pc_offset = i386nbsd_sc_pc_offset; + tdep->sc_sp_offset = i386nbsd_sc_sp_offset; +} + +/* NetBSD ELF. */ +static void +i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* It's still NetBSD. */ + i386nbsd_init_abi (info, gdbarch); + + /* But ELF-based. */ + i386_elf_init_abi (info, gdbarch); + + /* NetBSD ELF uses SVR4-style shared libraries. */ + set_gdbarch_in_solib_call_trampoline (gdbarch, + generic_in_solib_call_trampoline); + + /* NetBSD ELF uses -fpcc-struct-return by default. */ + tdep->struct_return = pcc_struct_return; + + /* We support the SSE registers on NetBSD ELF. */ + tdep->num_xmm_regs = I386_NUM_XREGS - 1; + set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS + + I386_NUM_XREGS); +} + void _initialize_i386nbsd_tdep (void) { add_core_fns (&i386nbsd_core_fns); add_core_fns (&i386nbsd_elfcore_fns); + + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT, + i386nbsd_init_abi); + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF, + i386nbsdelf_init_abi); } |