This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Update MIPS port for value unwinding


Here are the MIPS changes, tested on mips-linux-gnu and committed.

Note that mipsnbsd_sigtramp_offset is unused.  It used to be used for
pc_is_sigtramp and was removed.  I've left it in case someone wants
to use it as the basis for a signal frame unwinder on mips-netbsd.

Also, I found a real bug in the stub unwinder which could cause frame
IDs to go backwards; it was using the current stack pointer, not the
saved one.

-- 
Daniel Jacobowitz
CodeSourcery

2008-04-30  Daniel Jacobowitz  <dan@codesourcery.com>

	* mipsnbsd-tdep.c, mips64obsd-tdep.c, mips-linux-tdep.c: Update
	for unwinder changes.
	* mips-tdep.c: Likewise.
	(mips_stub_frame_cache): Unwind the ABI stack pointer, not the
	raw one.

---
 gdb/mips-linux-tdep.c |   12 +-
 gdb/mips-tdep.c       |  275 ++++++++++++++++++++++++--------------------------
 gdb/mips64obsd-tdep.c |    9 -
 gdb/mipsnbsd-tdep.c   |   10 -
 4 files changed, 151 insertions(+), 155 deletions(-)

Index: src/gdb/mipsnbsd-tdep.c
===================================================================
--- src.orig/gdb/mipsnbsd-tdep.c	2008-04-30 15:01:43.000000000 -0400
+++ src/gdb/mipsnbsd-tdep.c	2008-04-30 15:04:28.000000000 -0400
@@ -245,17 +245,17 @@ static const unsigned char sigtramp_retc
 };
 
 static LONGEST
-mipsnbsd_sigtramp_offset (struct frame_info *next_frame)
+mipsnbsd_sigtramp_offset (struct frame_info *this_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  const char *retcode = gdbarch_byte_order (get_frame_arch (next_frame))
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  const char *retcode = gdbarch_byte_order (get_frame_arch (this_frame))
 			== BFD_ENDIAN_BIG ? sigtramp_retcode_mipseb :
 			sigtramp_retcode_mipsel;
   unsigned char ret[RETCODE_SIZE], w[4];
   LONGEST off;
   int i;
 
-  if (!safe_frame_unwind_memory (next_frame, pc, w, sizeof (w)))
+  if (!safe_frame_unwind_memory (this_frame, pc, w, sizeof (w)))
     return -1;
 
   for (i = 0; i < RETCODE_NWORDS; i++)
@@ -269,7 +269,7 @@ mipsnbsd_sigtramp_offset (struct frame_i
   off = i * 4;
   pc -= off;
 
-  if (!safe_frame_unwind_memory (next_frame, pc, ret, sizeof (ret)))
+  if (!safe_frame_unwind_memory (this_frame, pc, ret, sizeof (ret)))
     return -1;
 
   if (memcmp (ret, retcode, RETCODE_SIZE) == 0)
Index: src/gdb/mips-linux-tdep.c
===================================================================
--- src.orig/gdb/mips-linux-tdep.c	2008-04-30 15:18:50.000000000 -0400
+++ src/gdb/mips-linux-tdep.c	2008-04-30 16:39:59.000000000 -0400
@@ -712,12 +712,12 @@ mips_linux_skip_resolver (struct gdbarch
    efficient way, but simplest.  First, declare all the unwinders.  */
 
 static void mips_linux_o32_sigframe_init (const struct tramp_frame *self,
-					  struct frame_info *next_frame,
+					  struct frame_info *this_frame,
 					  struct trad_frame_cache *this_cache,
 					  CORE_ADDR func);
 
 static void mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
-					     struct frame_info *next_frame,
+					     struct frame_info *this_frame,
 					     struct trad_frame_cache *this_cache,
 					     CORE_ADDR func);
 
@@ -853,11 +853,11 @@ static const struct tramp_frame mips_lin
 
 static void
 mips_linux_o32_sigframe_init (const struct tramp_frame *self,
-			      struct frame_info *next_frame,
+			      struct frame_info *this_frame,
 			      struct trad_frame_cache *this_cache,
 			      CORE_ADDR func)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   int ireg, reg_position;
   CORE_ADDR sigcontext_base = func - SIGFRAME_CODE_OFFSET;
   const struct mips_regnum *regs = mips_regnum (gdbarch);
@@ -1020,11 +1020,11 @@ mips_linux_o32_sigframe_init (const stru
 
 static void
 mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
-				 struct frame_info *next_frame,
+				 struct frame_info *this_frame,
 				 struct trad_frame_cache *this_cache,
 				 CORE_ADDR func)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   int ireg, reg_position;
   CORE_ADDR sigcontext_base = func - SIGFRAME_CODE_OFFSET;
   const struct mips_regnum *regs = mips_regnum (gdbarch);
Index: src/gdb/mips-tdep.c
===================================================================
--- src.orig/gdb/mips-tdep.c	2008-04-30 15:18:33.000000000 -0400
+++ src/gdb/mips-tdep.c	2008-04-30 16:50:16.000000000 -0400
@@ -887,19 +887,19 @@ mips_unwind_sp (struct gdbarch *gdbarch,
 	   (next_frame, gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM);
 }
 
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
+/* Assuming THIS_FRAME is a dummy, return the frame ID of that
    dummy frame.  The frame ID's base needs to match the TOS value
    saved by save_dummy_frame_tos(), and the PC match the dummy frame's
    breakpoint.  */
 
 static struct frame_id
-mips_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+mips_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
   return frame_id_build
-	   (frame_unwind_register_signed (next_frame,
-					  gdbarch_num_regs (gdbarch)
-					  + MIPS_SP_REGNUM),
-					  frame_pc_unwind (next_frame));
+	   (get_frame_register_signed (this_frame,
+				       gdbarch_num_regs (gdbarch)
+				       + MIPS_SP_REGNUM),
+	    get_frame_pc (this_frame));
 }
 
 static void
@@ -1488,7 +1488,7 @@ mips16_get_imm (unsigned short prev_inst
 
 static CORE_ADDR
 mips16_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
-                      struct frame_info *next_frame,
+                      struct frame_info *this_frame,
                       struct mips_frame_cache *this_cache)
 {
   CORE_ADDR cur_pc;
@@ -1506,14 +1506,14 @@ mips16_scan_prologue (CORE_ADDR start_pc
   int extend_bytes = 0;
   int prev_extend_bytes;
   CORE_ADDR end_prologue_addr = 0;
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
 
   /* Can be called when there's no process, and hence when there's no
-     NEXT_FRAME.  */
-  if (next_frame != NULL)
-    sp = frame_unwind_register_signed (next_frame,
-				       gdbarch_num_regs (gdbarch)
-				       + MIPS_SP_REGNUM);
+     THIS_FRAME.  */
+  if (this_frame != NULL)
+    sp = get_frame_register_signed (this_frame,
+				    gdbarch_num_regs (gdbarch)
+				    + MIPS_SP_REGNUM);
   else
     sp = 0;
 
@@ -1766,8 +1766,8 @@ mips16_scan_prologue (CORE_ADDR start_pc
   if (this_cache != NULL)
     {
       this_cache->base =
-        (frame_unwind_register_signed (next_frame,
-				       gdbarch_num_regs (gdbarch) + frame_reg)
+        (get_frame_register_signed (this_frame,
+				    gdbarch_num_regs (gdbarch) + frame_reg)
          + frame_offset - frame_adjust);
       /* FIXME: brobecker/2004-10-10: Just as in the mips32 case, we should
          be able to get rid of the assignment below, evetually. But it's
@@ -1791,7 +1791,7 @@ mips16_scan_prologue (CORE_ADDR start_pc
    mips_insn32 unwinder.  */
 
 static struct mips_frame_cache *
-mips_insn16_frame_cache (struct frame_info *next_frame, void **this_cache)
+mips_insn16_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct mips_frame_cache *cache;
 
@@ -1799,12 +1799,11 @@ mips_insn16_frame_cache (struct frame_in
     return (*this_cache);
   cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
   (*this_cache) = cache;
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Analyze the function prologue.  */
   {
-    const CORE_ADDR pc =
-      frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
+    const CORE_ADDR pc = get_frame_address_in_block (this_frame);
     CORE_ADDR start_addr;
 
     find_pc_partial_function (pc, NULL, &start_addr, NULL);
@@ -1815,62 +1814,60 @@ mips_insn16_frame_cache (struct frame_in
     if (start_addr == 0)
       return cache;
 
-    mips16_scan_prologue (start_addr, pc, next_frame, *this_cache);
+    mips16_scan_prologue (start_addr, pc, this_frame, *this_cache);
   }
   
   /* gdbarch_sp_regnum contains the value and not the address.  */
   trad_frame_set_value (cache->saved_regs,
-			gdbarch_num_regs (get_frame_arch (next_frame))
-			  + MIPS_SP_REGNUM,
+			gdbarch_num_regs (get_frame_arch (this_frame))
+			+ MIPS_SP_REGNUM,
 			cache->base);
 
   return (*this_cache);
 }
 
 static void
-mips_insn16_frame_this_id (struct frame_info *next_frame, void **this_cache,
+mips_insn16_frame_this_id (struct frame_info *this_frame, void **this_cache,
 			   struct frame_id *this_id)
 {
-  struct mips_frame_cache *info = mips_insn16_frame_cache (next_frame,
+  struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
 							   this_cache);
-  (*this_id) = frame_id_build (info->base,
-			       frame_func_unwind (next_frame, NORMAL_FRAME));
+  (*this_id) = frame_id_build (info->base, get_frame_func (this_frame));
 }
 
-static void
-mips_insn16_frame_prev_register (struct frame_info *next_frame,
-				 void **this_cache,
-				 int regnum, int *optimizedp,
-				 enum lval_type *lvalp, CORE_ADDR *addrp,
-				 int *realnump, gdb_byte *valuep)
+static struct value *
+mips_insn16_frame_prev_register (struct frame_info *this_frame,
+				 void **this_cache, int regnum)
 {
-  struct mips_frame_cache *info = mips_insn16_frame_cache (next_frame,
+  struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
 							   this_cache);
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
+}
+
+static int
+mips_insn16_frame_sniffer (const struct frame_unwind *self,
+			   struct frame_info *this_frame, void **this_cache)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  if (mips_pc_is_mips16 (pc))
+    return 1;
+  return 0;
 }
 
 static const struct frame_unwind mips_insn16_frame_unwind =
 {
   NORMAL_FRAME,
   mips_insn16_frame_this_id,
-  mips_insn16_frame_prev_register
+  mips_insn16_frame_prev_register,
+  NULL,
+  mips_insn16_frame_sniffer
 };
 
-static const struct frame_unwind *
-mips_insn16_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  if (mips_pc_is_mips16 (pc))
-    return &mips_insn16_frame_unwind;
-  return NULL;
-}
-
 static CORE_ADDR
-mips_insn16_frame_base_address (struct frame_info *next_frame,
+mips_insn16_frame_base_address (struct frame_info *this_frame,
 				void **this_cache)
 {
-  struct mips_frame_cache *info = mips_insn16_frame_cache (next_frame,
+  struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
 							   this_cache);
   return info->base;
 }
@@ -1884,9 +1881,10 @@ static const struct frame_base mips_insn
 };
 
 static const struct frame_base *
-mips_insn16_frame_base_sniffer (struct frame_info *next_frame)
+mips_insn16_frame_base_sniffer (struct frame_info *this_frame)
 {
-  if (mips_insn16_frame_sniffer (next_frame) != NULL)
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  if (mips_pc_is_mips16 (pc))
     return &mips_insn16_frame_base;
   else
     return NULL;
@@ -1918,7 +1916,7 @@ reset_saved_regs (struct mips_frame_cach
 
 static CORE_ADDR
 mips32_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
-                      struct frame_info *next_frame,
+                      struct frame_info *this_frame,
                       struct mips_frame_cache *this_cache)
 {
   CORE_ADDR cur_pc;
@@ -1930,15 +1928,15 @@ mips32_scan_prologue (CORE_ADDR start_pc
   CORE_ADDR end_prologue_addr = 0;
   int seen_sp_adjust = 0;
   int load_immediate_bytes = 0;
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   int regsize_is_64_bits = (mips_abi_regsize (gdbarch) == 8);
 
   /* Can be called when there's no process, and hence when there's no
-     NEXT_FRAME.  */
-  if (next_frame != NULL)
-    sp = frame_unwind_register_signed (next_frame,
-				       gdbarch_num_regs (gdbarch)
-				       + MIPS_SP_REGNUM);
+     THIS_FRAME.  */
+  if (this_frame != NULL)
+    sp = get_frame_register_signed (this_frame,
+				    gdbarch_num_regs (gdbarch)
+				    + MIPS_SP_REGNUM);
   else
     sp = 0;
 
@@ -1990,13 +1988,13 @@ restart:
 	  /* Old gcc frame, r30 is virtual frame pointer.  */
 	  if ((long) low_word != frame_offset)
 	    frame_addr = sp + low_word;
-	  else if (next_frame && frame_reg == MIPS_SP_REGNUM)
+	  else if (this_frame && frame_reg == MIPS_SP_REGNUM)
 	    {
 	      unsigned alloca_adjust;
 
 	      frame_reg = 30;
-	      frame_addr = frame_unwind_register_signed
-			     (next_frame, gdbarch_num_regs (gdbarch) + 30);
+	      frame_addr = get_frame_register_signed
+		(this_frame, gdbarch_num_regs (gdbarch) + 30);
 
 	      alloca_adjust = (unsigned) (frame_addr - (sp + low_word));
 	      if (alloca_adjust > 0)
@@ -2020,13 +2018,13 @@ restart:
       else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
 	{
 	  /* New gcc frame, virtual frame pointer is at r30 + frame_size.  */
-	  if (next_frame && frame_reg == MIPS_SP_REGNUM)
+	  if (this_frame && frame_reg == MIPS_SP_REGNUM)
 	    {
 	      unsigned alloca_adjust;
 
 	      frame_reg = 30;
-	      frame_addr = frame_unwind_register_signed
-			     (next_frame, gdbarch_num_regs (gdbarch) + 30);
+	      frame_addr = get_frame_register_signed
+		(this_frame, gdbarch_num_regs (gdbarch) + 30);
 
 	      alloca_adjust = (unsigned) (frame_addr - sp);
 	      if (alloca_adjust > 0)
@@ -2093,8 +2091,8 @@ restart:
   if (this_cache != NULL)
     {
       this_cache->base = 
-        (frame_unwind_register_signed (next_frame,
-				       gdbarch_num_regs (gdbarch) + frame_reg)
+        (get_frame_register_signed (this_frame,
+				    gdbarch_num_regs (gdbarch) + frame_reg)
          + frame_offset);
       /* FIXME: brobecker/2004-09-15: We should be able to get rid of
          this assignment below, eventually.  But it's still needed
@@ -2129,7 +2127,7 @@ restart:
    unwinder.  */
 
 static struct mips_frame_cache *
-mips_insn32_frame_cache (struct frame_info *next_frame, void **this_cache)
+mips_insn32_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   struct mips_frame_cache *cache;
 
@@ -2138,12 +2136,11 @@ mips_insn32_frame_cache (struct frame_in
 
   cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
   (*this_cache) = cache;
-  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+  cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
 
   /* Analyze the function prologue.  */
   {
-    const CORE_ADDR pc =
-      frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
+    const CORE_ADDR pc = get_frame_address_in_block (this_frame);
     CORE_ADDR start_addr;
 
     find_pc_partial_function (pc, NULL, &start_addr, NULL);
@@ -2154,62 +2151,60 @@ mips_insn32_frame_cache (struct frame_in
     if (start_addr == 0)
       return cache;
 
-    mips32_scan_prologue (start_addr, pc, next_frame, *this_cache);
+    mips32_scan_prologue (start_addr, pc, this_frame, *this_cache);
   }
   
   /* gdbarch_sp_regnum contains the value and not the address.  */
   trad_frame_set_value (cache->saved_regs,
-			gdbarch_num_regs (get_frame_arch (next_frame))
-			  + MIPS_SP_REGNUM,
+			gdbarch_num_regs (get_frame_arch (this_frame))
+			+ MIPS_SP_REGNUM,
 			cache->base);
 
   return (*this_cache);
 }
 
 static void
-mips_insn32_frame_this_id (struct frame_info *next_frame, void **this_cache,
+mips_insn32_frame_this_id (struct frame_info *this_frame, void **this_cache,
 			   struct frame_id *this_id)
 {
-  struct mips_frame_cache *info = mips_insn32_frame_cache (next_frame,
+  struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
 							   this_cache);
-  (*this_id) = frame_id_build (info->base,
-			       frame_func_unwind (next_frame, NORMAL_FRAME));
+  (*this_id) = frame_id_build (info->base, get_frame_func (this_frame));
 }
 
-static void
-mips_insn32_frame_prev_register (struct frame_info *next_frame,
-				 void **this_cache,
-				 int regnum, int *optimizedp,
-				 enum lval_type *lvalp, CORE_ADDR *addrp,
-				 int *realnump, gdb_byte *valuep)
+static struct value *
+mips_insn32_frame_prev_register (struct frame_info *this_frame,
+				 void **this_cache, int regnum)
 {
-  struct mips_frame_cache *info = mips_insn32_frame_cache (next_frame,
+  struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
 							   this_cache);
-  trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-				optimizedp, lvalp, addrp, realnump, valuep);
+  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
+}
+
+static int
+mips_insn32_frame_sniffer (const struct frame_unwind *self,
+			   struct frame_info *this_frame, void **this_cache)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  if (! mips_pc_is_mips16 (pc))
+    return 1;
+  return 0;
 }
 
 static const struct frame_unwind mips_insn32_frame_unwind =
 {
   NORMAL_FRAME,
   mips_insn32_frame_this_id,
-  mips_insn32_frame_prev_register
+  mips_insn32_frame_prev_register,
+  NULL,
+  mips_insn32_frame_sniffer
 };
 
-static const struct frame_unwind *
-mips_insn32_frame_sniffer (struct frame_info *next_frame)
-{
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  if (! mips_pc_is_mips16 (pc))
-    return &mips_insn32_frame_unwind;
-  return NULL;
-}
-
 static CORE_ADDR
-mips_insn32_frame_base_address (struct frame_info *next_frame,
+mips_insn32_frame_base_address (struct frame_info *this_frame,
 				void **this_cache)
 {
-  struct mips_frame_cache *info = mips_insn32_frame_cache (next_frame,
+  struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
 							   this_cache);
   return info->base;
 }
@@ -2223,38 +2218,41 @@ static const struct frame_base mips_insn
 };
 
 static const struct frame_base *
-mips_insn32_frame_base_sniffer (struct frame_info *next_frame)
+mips_insn32_frame_base_sniffer (struct frame_info *this_frame)
 {
-  if (mips_insn32_frame_sniffer (next_frame) != NULL)
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  if (! mips_pc_is_mips16 (pc))
     return &mips_insn32_frame_base;
   else
     return NULL;
 }
 
 static struct trad_frame_cache *
-mips_stub_frame_cache (struct frame_info *next_frame, void **this_cache)
+mips_stub_frame_cache (struct frame_info *this_frame, void **this_cache)
 {
   CORE_ADDR pc;
   CORE_ADDR start_addr;
   CORE_ADDR stack_addr;
   struct trad_frame_cache *this_trad_cache;
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  int num_regs = gdbarch_num_regs (gdbarch);
 
   if ((*this_cache) != NULL)
     return (*this_cache);
-  this_trad_cache = trad_frame_cache_zalloc (next_frame);
+  this_trad_cache = trad_frame_cache_zalloc (this_frame);
   (*this_cache) = this_trad_cache;
 
   /* The return address is in the link register.  */
   trad_frame_set_reg_realreg (this_trad_cache,
 			      gdbarch_pc_regnum (gdbarch),
-			      (gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM));
+			      num_regs + MIPS_RA_REGNUM);
 
   /* Frame ID, since it's a frameless / stackless function, no stack
      space is allocated and SP on entry is the current SP.  */
-  pc = frame_pc_unwind (next_frame);
+  pc = get_frame_pc (this_frame);
   find_pc_partial_function (pc, NULL, &start_addr, NULL);
-  stack_addr = frame_unwind_register_signed (next_frame, MIPS_SP_REGNUM);
+  stack_addr = get_frame_register_signed (this_frame,
+					  num_regs + MIPS_SP_REGNUM);
   trad_frame_set_id (this_trad_cache, frame_id_build (stack_addr, start_addr));
 
   /* Assume that the frame's base is the same as the
@@ -2265,47 +2263,37 @@ mips_stub_frame_cache (struct frame_info
 }
 
 static void
-mips_stub_frame_this_id (struct frame_info *next_frame, void **this_cache,
+mips_stub_frame_this_id (struct frame_info *this_frame, void **this_cache,
 			 struct frame_id *this_id)
 {
   struct trad_frame_cache *this_trad_cache
-    = mips_stub_frame_cache (next_frame, this_cache);
+    = mips_stub_frame_cache (this_frame, this_cache);
   trad_frame_get_id (this_trad_cache, this_id);
 }
 
-static void
-mips_stub_frame_prev_register (struct frame_info *next_frame,
-				 void **this_cache,
-				 int regnum, int *optimizedp,
-				 enum lval_type *lvalp, CORE_ADDR *addrp,
-				 int *realnump, gdb_byte *valuep)
+static struct value *
+mips_stub_frame_prev_register (struct frame_info *this_frame,
+			       void **this_cache, int regnum)
 {
   struct trad_frame_cache *this_trad_cache
-    = mips_stub_frame_cache (next_frame, this_cache);
-  trad_frame_get_register (this_trad_cache, next_frame, regnum, optimizedp,
-			   lvalp, addrp, realnump, valuep);
+    = mips_stub_frame_cache (this_frame, this_cache);
+  return trad_frame_get_register (this_trad_cache, this_frame, regnum);
 }
 
-static const struct frame_unwind mips_stub_frame_unwind =
-{
-  NORMAL_FRAME,
-  mips_stub_frame_this_id,
-  mips_stub_frame_prev_register
-};
-
-static const struct frame_unwind *
-mips_stub_frame_sniffer (struct frame_info *next_frame)
+static int
+mips_stub_frame_sniffer (const struct frame_unwind *self,
+			 struct frame_info *this_frame, void **this_cache)
 {
   gdb_byte dummy[4];
   struct obj_section *s;
-  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
+  CORE_ADDR pc = get_frame_address_in_block (this_frame);
 
   /* Use the stub unwinder for unreadable code.  */
-  if (target_read_memory (frame_pc_unwind (next_frame), dummy, 4) != 0)
-    return &mips_stub_frame_unwind;
+  if (target_read_memory (get_frame_pc (this_frame), dummy, 4) != 0)
+    return 1;
 
   if (in_plt_section (pc, NULL))
-    return &mips_stub_frame_unwind;
+    return 1;
 
   /* Binutils for MIPS puts lazy resolution stubs into .MIPS.stubs.  */
   s = find_pc_section (pc);
@@ -2313,17 +2301,26 @@ mips_stub_frame_sniffer (struct frame_in
   if (s != NULL
       && strcmp (bfd_get_section_name (s->objfile->obfd, s->the_bfd_section),
 		 ".MIPS.stubs") == 0)
-    return &mips_stub_frame_unwind;
+    return 1;
 
-  return NULL;
+  return 0;
 }
 
+static const struct frame_unwind mips_stub_frame_unwind =
+{
+  NORMAL_FRAME,
+  mips_stub_frame_this_id,
+  mips_stub_frame_prev_register,
+  NULL,
+  mips_stub_frame_sniffer
+};
+
 static CORE_ADDR
-mips_stub_frame_base_address (struct frame_info *next_frame,
+mips_stub_frame_base_address (struct frame_info *this_frame,
 			      void **this_cache)
 {
   struct trad_frame_cache *this_trad_cache
-    = mips_stub_frame_cache (next_frame, this_cache);
+    = mips_stub_frame_cache (this_frame, this_cache);
   return trad_frame_get_this_base (this_trad_cache);
 }
 
@@ -2336,9 +2333,9 @@ static const struct frame_base mips_stub
 };
 
 static const struct frame_base *
-mips_stub_frame_base_sniffer (struct frame_info *next_frame)
+mips_stub_frame_base_sniffer (struct frame_info *this_frame)
 {
-  if (mips_stub_frame_sniffer (next_frame) != NULL)
+  if (mips_stub_frame_sniffer (&mips_stub_frame_unwind, this_frame, NULL))
     return &mips_stub_frame_base;
   else
     return NULL;
@@ -5778,7 +5775,7 @@ mips_gdbarch_init (struct gdbarch_info i
   /* Unwind the frame.  */
   set_gdbarch_unwind_pc (gdbarch, mips_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mips_unwind_sp);
-  set_gdbarch_unwind_dummy_id (gdbarch, mips_unwind_dummy_id);
+  set_gdbarch_dummy_id (gdbarch, mips_dummy_id);
 
   /* Map debug register numbers onto internal register numbers.  */
   set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
@@ -5841,10 +5838,10 @@ mips_gdbarch_init (struct gdbarch_info i
   gdbarch_init_osabi (info, gdbarch);
 
   /* Unwind the frame.  */
-  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, mips_stub_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, mips_insn16_frame_sniffer);
-  frame_unwind_append_sniffer (gdbarch, mips_insn32_frame_sniffer);
+  dwarf2_append_unwinders (gdbarch);
+  frame_unwind_append_unwinder (gdbarch, &mips_stub_frame_unwind);
+  frame_unwind_append_unwinder (gdbarch, &mips_insn16_frame_unwind);
+  frame_unwind_append_unwinder (gdbarch, &mips_insn32_frame_unwind);
   frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
   frame_base_append_sniffer (gdbarch, mips_stub_frame_base_sniffer);
   frame_base_append_sniffer (gdbarch, mips_insn16_frame_base_sniffer);
Index: src/gdb/mips64obsd-tdep.c
===================================================================
--- src.orig/gdb/mips64obsd-tdep.c	2008-04-30 15:17:03.000000000 -0400
+++ src/gdb/mips64obsd-tdep.c	2008-04-30 16:39:59.000000000 -0400
@@ -79,19 +79,18 @@ mips64obsd_regset_from_core_section (str
 
 static void
 mips64obsd_sigframe_init (const struct tramp_frame *self,
-			  struct frame_info *next_frame,
+			  struct frame_info *this_frame,
 			  struct trad_frame_cache *cache,
 			  CORE_ADDR func)
 {
-  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
   CORE_ADDR sp, sigcontext_addr, addr;
   int regnum;
 
   /* We find the appropriate instance of `struct sigcontext' at a
      fixed offset in the signal frame.  */
-  sp = frame_unwind_register_signed (next_frame,
-				     MIPS_SP_REGNUM
-				     + gdbarch_num_regs (gdbarch));
+  sp = get_frame_register_signed (this_frame,
+				  MIPS_SP_REGNUM + gdbarch_num_regs (gdbarch));
   sigcontext_addr = sp + 32;
 
   /* PC.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]