gdb/
[deliverable/binutils-gdb.git] / gdb / mips-irix-tdep.c
index 19659645d4f2910fb88eebe295c8390aef0a0fe0..c49e0839d1a3e1aedc42cf0cae456f7419e4062f 100644 (file)
@@ -1,7 +1,8 @@
 /* Target-dependent code for the MIPS architecture running on IRIX,
    for GDB, the GNU Debugger.
 
-   Copyright (C) 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -68,7 +69,7 @@ mips_irix_elf_osabi_sniffer (bfd *abfd)
       /* When elfosabi is ELFOSABI_NONE (0), then the ELF structures in the
         file are conforming to the base specification for that machine 
         (there are no OS-specific extensions).  In order to determine the 
-        real OS in use we must look for OS notes that have been added.  
+        real OS in use we must look for OS notes that have been added.
         
         For IRIX, we simply look for sections named with .MIPS. as
         prefixes.  */
@@ -227,11 +228,51 @@ static const struct tramp_frame mips_irix_n32_tramp_frame =
   mips_irix_n32_tramp_frame_init
 };
 
+/* Implement the "init" routine in struct tramp_frame for the stack-based
+   trampolines used on mips-irix.  */
+
+static void
+mips_irix_n32_stack_tramp_frame_init (const struct tramp_frame *self,
+                                     struct frame_info *this_frame,
+                                     struct trad_frame_cache *this_cache,
+                                     CORE_ADDR func)
+{
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  const int num_regs = gdbarch_num_regs (gdbarch);
+  int sp_cooked_regno = num_regs + MIPS_SP_REGNUM;
+  const CORE_ADDR sp = get_frame_register_signed (this_frame, sp_cooked_regno);
+
+  /* The previous frame's PC is stored in RA.  */
+  trad_frame_set_reg_realreg (this_cache, gdbarch_pc_regnum (gdbarch),
+                              num_regs + MIPS_RA_REGNUM);
+
+  trad_frame_set_id (this_cache, frame_id_build (sp, func));
+}
+
+/* A tramp_frame structure describing the stack-based trampoline
+   used on mips-irix.  These trampolines are created on the stack
+   before being called.  */
+
+static const struct tramp_frame mips_irix_n32_stack_tramp_frame =
+{
+  SIGTRAMP_FRAME,
+  4,
+  {
+   { 0x8f210000, 0xffff0000 },  /* lw     at, N(t9) */
+   { 0x8f2f0000, 0xffff0000 },  /* lw     t3, M(t9) */
+   { 0x00200008, 0xffffffff },  /* jr     at        */
+   { 0x0020c82d, 0xffffffff },  /* move   t9, at    */
+   { TRAMP_SENTINEL_INSN, -1 }
+  },
+  mips_irix_n32_stack_tramp_frame_init
+};
+
 static void
 mips_irix_init_abi (struct gdbarch_info info,
                     struct gdbarch *gdbarch)
 {
   set_solib_ops (gdbarch, &irix_so_ops);
+  tramp_frame_prepend_unwinder (gdbarch, &mips_irix_n32_stack_tramp_frame);
   tramp_frame_prepend_unwinder (gdbarch, &mips_irix_n32_tramp_frame);
 }
 
This page took 0.024821 seconds and 4 git commands to generate.