gdb/vaxobsd-tdep.c - gdb
Global variables defined
Functions defined
Macros defined
Source code
- #include "defs.h"
- #include "arch-utils.h"
- #include "frame.h"
- #include "frame-unwind.h"
- #include "osabi.h"
- #include "symtab.h"
- #include "trad-frame.h"
- #include "vax-tdep.h"
- static const int vaxobsd_page_size = 4096;
- static const int vaxobsd_sigreturn_offset = 0x11;
- static const gdb_byte vaxobsd_sigreturn[] = {
- 0xbc, 0x8f, 0x67, 0x00,
- 0xbc, 0x01
- };
- static int
- vaxobsd_sigtramp_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
- {
- CORE_ADDR pc = get_frame_pc (this_frame);
- CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1));
- CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset;
- gdb_byte *buf;
- const char *name;
- find_pc_partial_function (pc, &name, NULL, NULL);
- if (name)
- return 0;
- buf = alloca(sizeof vaxobsd_sigreturn);
- if (!safe_frame_unwind_memory (this_frame, sigreturn_addr,
- buf, sizeof vaxobsd_sigreturn))
- return 0;
- if (memcmp(buf, vaxobsd_sigreturn, sizeof vaxobsd_sigreturn) == 0)
- return 1;
- return 0;
- }
- static struct trad_frame_cache *
- vaxobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
- {
- struct trad_frame_cache *cache;
- CORE_ADDR addr, base, func;
- if (*this_cache)
- return *this_cache;
- cache = trad_frame_cache_zalloc (this_frame);
- *this_cache = cache;
- func = get_frame_pc (this_frame);
- func &= ~(vaxobsd_page_size - 1);
- base = get_frame_register_unsigned (this_frame, VAX_SP_REGNUM);
- addr = get_frame_memory_unsigned (this_frame, base - 4, 4);
- trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8);
- trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12);
- trad_frame_set_reg_addr (cache, VAX_AP_REGNUM, addr + 16);
- trad_frame_set_reg_addr (cache, VAX_PC_REGNUM, addr + 20);
- trad_frame_set_reg_addr (cache, VAX_PS_REGNUM, addr + 24);
-
- trad_frame_set_id (cache, frame_id_build (base, func));
- return cache;
- }
- static void
- vaxobsd_sigtramp_frame_this_id (struct frame_info *this_frame,
- void **this_cache, struct frame_id *this_id)
- {
- struct trad_frame_cache *cache =
- vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
- trad_frame_get_id (cache, this_id);
- }
- static struct value *
- vaxobsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
- {
- struct trad_frame_cache *cache =
- vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
- return trad_frame_get_register (cache, this_frame, regnum);
- }
- static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = {
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- vaxobsd_sigtramp_frame_this_id,
- vaxobsd_sigtramp_frame_prev_register,
- NULL,
- vaxobsd_sigtramp_sniffer
- };
- static void
- vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
- {
- frame_unwind_append_unwinder (gdbarch, &vaxobsd_sigtramp_frame_unwind);
- }
- FIXME
- #define GDB_OSABI_OPENBSD_AOUT GDB_OSABI_NETBSD_AOUT
- static enum gdb_osabi
- vaxobsd_aout_osabi_sniffer (bfd *abfd)
- {
- if (strcmp (bfd_get_target (abfd), "a.out-vax-netbsd") == 0)
- return GDB_OSABI_OPENBSD_AOUT;
- return GDB_OSABI_UNKNOWN;
- }
- void _initialize_vaxobsd_tdep (void);
- void
- _initialize_vaxobsd_tdep (void)
- {
- gdbarch_register_osabi_sniffer (bfd_arch_vax, bfd_target_aout_flavour,
- vaxobsd_aout_osabi_sniffer);
- gdbarch_register_osabi (bfd_arch_vax, 0, GDB_OSABI_OPENBSD_AOUT,
- vaxobsd_init_abi);
- }