/* Target-dependent code for NetBSD/i386, for GDB.
- Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002
+ Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GDB.
#include "gdbcore.h"
#include "regcache.h"
#include "arch-utils.h"
+#include "osabi.h"
#include "i386-tdep.h"
#include "i387-tdep.h"
}
/* From <machine/signal.h>. */
-int i386nbsd_sc_pc_offset = 44;
-int i386nbsd_sc_sp_offset = 56;
+int i386nbsd_sc_reg_offset[I386_NUM_GREGS] =
+{
+ 10 * 4, /* %eax */
+ 9 * 4, /* %ecx */
+ 8 * 4, /* %edx */
+ 7 * 4, /* %ebx */
+ 14 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 11 * 4, /* %eip */
+ 13 * 4, /* %eflags */
+ 12 * 4, /* %cs */
+ 15 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
+};
static void
i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* NetBSD has different signal trampoline conventions. */
set_gdbarch_pc_in_sigtramp (gdbarch, i386nbsd_pc_in_sigtramp);
+ /* FIXME: kettenis/20020906: We should probably provide
+ NetBSD-specific versions of these functions if we want to
+ recognize signal trampolines that live on the stack. */
+ set_gdbarch_sigtramp_start (gdbarch, NULL);
+ set_gdbarch_sigtramp_end (gdbarch, NULL);
/* NetBSD uses -freg-struct-return by default. */
tdep->struct_return = reg_struct_return;
/* 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;
+ tdep->sc_reg_offset = i386nbsd_sc_reg_offset;
+ tdep->sc_num_regs = I386_NUM_GREGS;
}
/* NetBSD ELF. */
add_core_fns (&i386nbsd_core_fns);
add_core_fns (&i386nbsd_elfcore_fns);
- gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT,
+ gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_AOUT,
i386nbsd_init_abi);
- gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF,
+ gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD_ELF,
i386nbsdelf_init_abi);
}