]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* dwarf2-frame.c (dwarf2_frame_cache, dwarf2_frame_this_id)
authorDaniel Jacobowitz <drow@false.org>
Tue, 27 Feb 2007 20:17:19 +0000 (20:17 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 27 Feb 2007 20:17:19 +0000 (20:17 +0000)
(dwarf2_frame_sniffer): Update.
(dwarf2_signal_frame_this_id): New function.
(dwarf2_signal_frame_unwind): Use it.
(dwarf2_frame_base_sniffer): Use frame_unwind_address_in_block.
* frame.c (frame_func_unwind): Add this_type argument.
(get_frame_func): Update.
(frame_unwind_address_in_block): Add this_type argument and check it.
Fix a typo.
(get_frame_address_in_block): Update.
* frame.h (enum frame_type): Move higher in the file.
(frame_unwind_address_in_block, frame_func_unwind): Add enum frame_type
argument.

* alpha-mdebug-tdep.c, alpha-tdep.c, amd64-tdep.c, amd64obsd-tdep.c,
arm-tdep.c, avr-tdep.c, cris-tdep.c, frv-tdep.c, h8300-tdep.c,
hppa-tdep.c, i386-tdep.c, i386obsd-tdep.c, ia64-tdep.c,
libunwind-frame.c, m32c-tdep.c, m32r-linux-tdep.c, m32r-tdep.c,
m68hc11-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-mdebug-tdep.c,
mips-tdep.c, mn10300-tdep.c, mt-tdep.c, rs6000-tdep.c, s390-tdep.c,
score-tdep.c, sh-tdep.c, sh64-tdep.c, sparc-tdep.c,
sparc64obsd-tdep.c, spu-tdep.c, v850-tdep.c, vax-tdep.c,
xstormy16-tdep.c, xtensa-tdep.c: Update calls to
frame_func_unwind and frame_unwind_address_in_block to specify
the frame type.  Use frame_unwind_address_in_block instead of
frame_pc_unwind in sniffers.

* gdb.arch/i386-signal.c, gdb.arch/i386-signal.exp: New files.

43 files changed:
gdb/ChangeLog
gdb/alpha-mdebug-tdep.c
gdb/alpha-tdep.c
gdb/amd64-tdep.c
gdb/amd64obsd-tdep.c
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/cris-tdep.c
gdb/dwarf2-frame.c
gdb/frame.c
gdb/frame.h
gdb/frv-tdep.c
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/i386-tdep.c
gdb/i386obsd-tdep.c
gdb/ia64-tdep.c
gdb/libunwind-frame.c
gdb/m32c-tdep.c
gdb/m32r-linux-tdep.c
gdb/m32r-tdep.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/m88k-tdep.c
gdb/mips-mdebug-tdep.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/mt-tdep.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/score-tdep.c
gdb/sh-tdep.c
gdb/sh64-tdep.c
gdb/sparc-tdep.c
gdb/sparc64obsd-tdep.c
gdb/spu-tdep.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/i386-signal.c [new file with mode: 0644]
gdb/testsuite/gdb.arch/i386-signal.exp [new file with mode: 0644]
gdb/v850-tdep.c
gdb/vax-tdep.c
gdb/xstormy16-tdep.c
gdb/xtensa-tdep.c

index a95a673139809586192dcb242ef0e9f91f4f463e..2112c9c947072a7c7ed9de7e3c336c1088476f63 100644 (file)
@@ -1,3 +1,32 @@
+2007-02-27  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * dwarf2-frame.c (dwarf2_frame_cache, dwarf2_frame_this_id)
+       (dwarf2_frame_sniffer): Update.
+       (dwarf2_signal_frame_this_id): New function.
+       (dwarf2_signal_frame_unwind): Use it.
+       (dwarf2_frame_base_sniffer): Use frame_unwind_address_in_block.
+       * frame.c (frame_func_unwind): Add this_type argument.
+       (get_frame_func): Update.
+       (frame_unwind_address_in_block): Add this_type argument and check it.
+       Fix a typo.
+       (get_frame_address_in_block): Update.
+       * frame.h (enum frame_type): Move higher in the file.
+       (frame_unwind_address_in_block, frame_func_unwind): Add enum frame_type
+       argument.
+
+       * alpha-mdebug-tdep.c, alpha-tdep.c, amd64-tdep.c, amd64obsd-tdep.c,
+       arm-tdep.c, avr-tdep.c, cris-tdep.c, frv-tdep.c, h8300-tdep.c,
+       hppa-tdep.c, i386-tdep.c, i386obsd-tdep.c, ia64-tdep.c,
+       libunwind-frame.c, m32c-tdep.c, m32r-linux-tdep.c, m32r-tdep.c,
+       m68hc11-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-mdebug-tdep.c,
+       mips-tdep.c, mn10300-tdep.c, mt-tdep.c, rs6000-tdep.c, s390-tdep.c,
+       score-tdep.c, sh-tdep.c, sh64-tdep.c, sparc-tdep.c,
+       sparc64obsd-tdep.c, spu-tdep.c, v850-tdep.c, vax-tdep.c,
+       xstormy16-tdep.c, xtensa-tdep.c: Update calls to
+       frame_func_unwind and frame_unwind_address_in_block to specify
+       the frame type.  Use frame_unwind_address_in_block instead of
+       frame_pc_unwind in sniffers.
+
 2007-02-27  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * frame.c (deprecated_selected_frame): Rename to...
index c2f180251bfcb64b7788123ae1b5ca5b4f171ac6..59bb47f6d99fc54d7ccbfc1e462b60746b2975ee 100644 (file)
@@ -246,7 +246,8 @@ alpha_mdebug_frame_this_id (struct frame_info *next_frame,
   struct alpha_mdebug_unwind_cache *info
     = alpha_mdebug_frame_unwind_cache (next_frame, this_prologue_cache);
 
-  *this_id = frame_id_build (info->vfp, frame_func_unwind (next_frame));
+  *this_id = frame_id_build (info->vfp,
+                            frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 /* Retrieve the value of REGNUM in FRAME.  Don't give up!  */
@@ -311,7 +312,7 @@ static const struct frame_unwind alpha_mdebug_frame_unwind = {
 const struct frame_unwind *
 alpha_mdebug_frame_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
   struct mdebug_extra_func_info *proc_desc;
 
   /* If this PC does not map to a PDR, then clearly this isn't an
@@ -368,7 +369,7 @@ static const struct frame_base alpha_mdebug_frame_base = {
 static const struct frame_base *
 alpha_mdebug_frame_base_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
   struct mdebug_extra_func_info *proc_desc;
 
   /* If this PC does not map to a PDR, then clearly this isn't an
index b0bc35b3aa808145cb5f5233dc0753a4cffea3df..83e95a1a1f2b52a77331c165f091a60d00a51e4c 100644 (file)
@@ -820,7 +820,7 @@ alpha_sigtramp_frame_this_id (struct frame_info *next_frame,
        code_addr = 0;
     }
   else
-    code_addr = frame_func_unwind (next_frame);
+    code_addr = frame_func_unwind (next_frame, SIGTRAMP_FRAME);
 
   /* The stack address is trivially read from the sigcontext.  */
   stack_addr = alpha_sigtramp_register_address (info->sigcontext_addr,
index 3b5a1959d579becb57365011eb88185e6b366733..8c3e887ae24c1d26e54d60a74cbaa809a33012b2 100644 (file)
@@ -833,7 +833,7 @@ amd64_frame_cache (struct frame_info *next_frame, void **this_cache)
   cache = amd64_alloc_frame_cache ();
   *this_cache = cache;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
     amd64_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
 
index 7bca4d753d01717f5a90093674dc4c1553746933..4e412e9ea1de95a5229d7f3b61f9ee75130519bb 100644 (file)
@@ -356,7 +356,9 @@ amd64obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
   cache = trad_frame_cache_zalloc (next_frame);
   *this_cache = cache;
 
-  func = frame_func_unwind (next_frame);
+  /* NORMAL_FRAME matches the type in amd64obsd_trapframe_unwind, but
+     SIGTRAMP_FRAME might be more appropriate.  */
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
   sp = frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
 
   find_pc_partial_function (func, &name, NULL, NULL);
index 869cc3469be0c9677b5073169761dee41633718f..19afdac04af4fb48be46fe29c3c44e52f78a99d5 100644 (file)
@@ -931,7 +931,7 @@ arm_prologue_this_id (struct frame_info *next_frame,
     *this_cache = arm_make_prologue_cache (next_frame);
   cache = *this_cache;
 
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   /* This is meant to halt the backtrace at "_start".  Make sure we
      don't halt it at a generic dummy frame. */
@@ -1036,9 +1036,11 @@ struct frame_unwind arm_stub_unwind = {
 static const struct frame_unwind *
 arm_stub_unwind_sniffer (struct frame_info *next_frame)
 {
+  CORE_ADDR addr_in_block;
   char dummy[4];
 
-  if (in_plt_section (frame_unwind_address_in_block (next_frame), NULL)
+  addr_in_block = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
+  if (in_plt_section (addr_in_block, NULL)
       || target_read_memory (frame_pc_unwind (next_frame), dummy, 4) != 0)
     return &arm_stub_unwind;
 
index 4724f65f5f77a11feefdb6be32415ea347ea00d0..9f0793e2fbc6827e03a6bc68fd834f0eb2ff16f1 100644 (file)
@@ -875,7 +875,7 @@ avr_frame_unwind_cache (struct frame_info *next_frame,
   info->size = 0;
   info->prologue_type = AVR_PROLOGUE_NONE;
 
-  pc = frame_func_unwind (next_frame);
+  pc = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   if ((pc > 0) && (pc < frame_pc_unwind (next_frame)))
     avr_scan_prologue (pc, info);
@@ -958,7 +958,7 @@ avr_frame_this_id (struct frame_info *next_frame,
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   /* Hopefully the prologue analysis either correctly determined the
      frame's base (which is the SP from the previous frame), or set
index 862a4a5effd18e1882910cf3cbcf2f9d5fe901a3..6175123b9235e8481b6253d13388b0af73772b91 100644 (file)
@@ -792,9 +792,11 @@ cris_frame_unwind_cache (struct frame_info *next_frame,
 
   /* Prologue analysis does the rest...  */
   if (cris_version () == 32)
-    crisv32_scan_prologue (frame_func_unwind (next_frame), next_frame, info);
+    crisv32_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
+                          next_frame, info);
   else
-    cris_scan_prologue (frame_func_unwind (next_frame), next_frame, info);
+    cris_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
+                       next_frame, info);
 
   return info;
 }
@@ -814,7 +816,7 @@ cris_frame_this_id (struct frame_info *next_frame,
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   /* Hopefully the prologue analysis either correctly determined the
      frame's base (which is the SP from the previous frame), or set
index fd4002c476cd3fc7413e03eb2a8c33e7b15da81c..be61a0eca894b14fdb51c2a07b73fa866ce23758 100644 (file)
@@ -848,7 +848,7 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache)
      frame_unwind_address_in_block does just this.  It's not clear how
      reliable the method is though; there is the potential for the
      register state pre-call being different to that on return.  */
-  fs->pc = frame_unwind_address_in_block (next_frame);
+  fs->pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
 
   /* Find the correct FDE.  */
   fde = dwarf2_frame_find_fde (&fs->pc);
@@ -1011,7 +1011,22 @@ dwarf2_frame_this_id (struct frame_info *next_frame, void **this_cache,
   if (cache->undefined_retaddr)
     return;
 
-  (*this_id) = frame_id_build (cache->cfa, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (cache->cfa,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
+}
+
+static void
+dwarf2_signal_frame_this_id (struct frame_info *next_frame, void **this_cache,
+                            struct frame_id *this_id)
+{
+  struct dwarf2_frame_cache *cache =
+    dwarf2_frame_cache (next_frame, this_cache);
+
+  if (cache->undefined_retaddr)
+    return;
+
+  (*this_id) = frame_id_build (cache->cfa,
+                              frame_func_unwind (next_frame, SIGTRAMP_FRAME));
 }
 
 static void
@@ -1179,7 +1194,7 @@ static const struct frame_unwind dwarf2_frame_unwind =
 static const struct frame_unwind dwarf2_signal_frame_unwind =
 {
   SIGTRAMP_FRAME,
-  dwarf2_frame_this_id,
+  dwarf2_signal_frame_this_id,
   dwarf2_frame_prev_register
 };
 
@@ -1188,8 +1203,12 @@ dwarf2_frame_sniffer (struct frame_info *next_frame)
 {
   /* Grab an address that is guarenteed to reside somewhere within the
      function.  frame_pc_unwind(), for a no-return next function, can
-     end up returning something past the end of this function's body.  */
-  CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame);
+     end up returning something past the end of this function's body.
+     If the frame we're sniffing for is a signal frame whose start
+     address is placed on the stack by the OS, its FDE must
+     extend one byte before its start address or we will miss it.  */
+  CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame,
+                                                       NORMAL_FRAME);
   struct dwarf2_fde *fde = dwarf2_frame_find_fde (&block_addr);
   if (!fde)
     return NULL;
@@ -1233,8 +1252,9 @@ static const struct frame_base dwarf2_frame_base =
 const struct frame_base *
 dwarf2_frame_base_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
-  if (dwarf2_frame_find_fde (&pc))
+  CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame,
+                                                       NORMAL_FRAME);
+  if (dwarf2_frame_find_fde (&block_addr))
     return &dwarf2_frame_base;
 
   return NULL;
index e84371c4a4532a80b4bd2726e2bb586978749422..ff8078bf26d08a475b015bc4dafe16ac993bb9d9 100644 (file)
@@ -471,13 +471,13 @@ frame_pc_unwind (struct frame_info *this_frame)
 }
 
 CORE_ADDR
-frame_func_unwind (struct frame_info *fi)
+frame_func_unwind (struct frame_info *fi, enum frame_type this_type)
 {
   if (!fi->prev_func.p)
     {
       /* Make certain that this, and not the adjacent, function is
          found.  */
-      CORE_ADDR addr_in_block = frame_unwind_address_in_block (fi);
+      CORE_ADDR addr_in_block = frame_unwind_address_in_block (fi, this_type);
       fi->prev_func.p = 1;
       fi->prev_func.addr = get_pc_function_start (addr_in_block);
       if (frame_debug)
@@ -491,7 +491,7 @@ frame_func_unwind (struct frame_info *fi)
 CORE_ADDR
 get_frame_func (struct frame_info *fi)
 {
-  return frame_func_unwind (fi->next);
+  return frame_func_unwind (fi->next, get_frame_type (fi));
 }
 
 static int
@@ -1496,20 +1496,31 @@ get_frame_pc (struct frame_info *frame)
   return frame_pc_unwind (frame->next);
 }
 
-/* Return an address of that falls within the frame's code block.  */
+/* Return an address that falls within NEXT_FRAME's caller's code
+   block, assuming that the caller is a THIS_TYPE frame.  */
 
 CORE_ADDR
-frame_unwind_address_in_block (struct frame_info *next_frame)
+frame_unwind_address_in_block (struct frame_info *next_frame,
+                              enum frame_type this_type)
 {
   /* A draft address.  */
   CORE_ADDR pc = frame_pc_unwind (next_frame);
 
+  /* If NEXT_FRAME was called by a signal frame or dummy frame, then
+     we shold not adjust the unwound PC.  These frames may not call
+     their next frame in the normal way; the operating system or GDB
+     may have pushed their resume address manually onto the stack, so
+     it may be the very first instruction.  Even if the resume address
+     was not manually pushed, they expect to be returned to.  */
+  if (this_type != NORMAL_FRAME)
+    return pc;
+
   /* If THIS frame is not inner most (i.e., NEXT isn't the sentinel),
      and NEXT is `normal' (i.e., not a sigtramp, dummy, ....) THIS
      frame's PC ends up pointing at the instruction fallowing the
      "call".  Adjust that PC value so that it falls on the call
      instruction (which, hopefully, falls within THIS frame's code
-     block.  So far it's proved to be a very good approximation.  See
+     block).  So far it's proved to be a very good approximation.  See
      get_frame_type() for why ->type can't be used.  */
   if (next_frame->level >= 0
       && get_frame_type (next_frame) == NORMAL_FRAME)
@@ -1520,7 +1531,8 @@ frame_unwind_address_in_block (struct frame_info *next_frame)
 CORE_ADDR
 get_frame_address_in_block (struct frame_info *this_frame)
 {
-  return frame_unwind_address_in_block (this_frame->next);
+  return frame_unwind_address_in_block (this_frame->next,
+                                       get_frame_type (this_frame));
 }
 
 static int
index bce43ed20647c54c58f1c17853fbfc511a9b7bbc..941ee73ef5b5ae292ac61f41fe597f981a7af7f5 100644 (file)
@@ -184,6 +184,25 @@ extern int frame_id_inner (struct frame_id l, struct frame_id r);
 extern void fprint_frame_id (struct ui_file *file, struct frame_id id);
 
 
+/* Frame types.  Some are real, some are signal trampolines, and some
+   are completely artificial (dummy).  */
+
+enum frame_type
+{
+  /* A true stack frame, created by the target program during normal
+     execution.  */
+  NORMAL_FRAME,
+  /* A fake frame, created by GDB when performing an inferior function
+     call.  */
+  DUMMY_FRAME,
+  /* In a signal handler, various OSs handle this in various ways.
+     The main thing is that the frame may be far from normal.  */
+  SIGTRAMP_FRAME,
+  /* Sentinel or registers frame.  This frame obtains register values
+     direct from the inferior's registers.  */
+  SENTINEL_FRAME
+};
+
 /* For every stopped thread, GDB tracks two frames: current and
    selected.  Current frame is the inner most frame of the selected
    thread.  Selected frame is the one being examined by the the GDB
@@ -265,7 +284,13 @@ extern CORE_ADDR get_frame_pc (struct frame_info *);
    the frame's block.  */
 
 extern CORE_ADDR get_frame_address_in_block (struct frame_info *this_frame);
-extern CORE_ADDR frame_unwind_address_in_block (struct frame_info *next_frame);
+
+/* Similar to get_frame_address_in_block, find an address in the
+   block which logically called NEXT_FRAME, assuming it is a THIS_TYPE
+   frame.  */
+
+extern CORE_ADDR frame_unwind_address_in_block (struct frame_info *next_frame,
+                                               enum frame_type this_type);
 
 /* The frame's inner-most bound.  AKA the stack-pointer.  Confusingly
    known as top-of-stack.  */
@@ -277,9 +302,13 @@ extern CORE_ADDR frame_sp_unwind (struct frame_info *);
 /* Following on from the `resume' address.  Return the entry point
    address of the function containing that resume address, or zero if
    that function isn't known.  */
-extern CORE_ADDR frame_func_unwind (struct frame_info *fi);
 extern CORE_ADDR get_frame_func (struct frame_info *fi);
 
+/* Similar to get_frame_func, find the start of the function which
+   logically called NEXT_FRAME, assuming it is a THIS_TYPE frame.  */
+extern CORE_ADDR frame_func_unwind (struct frame_info *next_frame,
+                                   enum frame_type this_type);
+
 /* Closely related to the resume address, various symbol table
    attributes that are determined by the PC.  Note that for a normal
    frame, the PC refers to the resume address after the return, and
@@ -375,24 +404,8 @@ extern CORE_ADDR get_frame_args_address (struct frame_info *);
    for an invalid frame).  */
 extern int frame_relative_level (struct frame_info *fi);
 
-/* Return the frame's type.  Some are real, some are signal
-   trampolines, and some are completely artificial (dummy).  */
+/* Return the frame's type.  */
 
-enum frame_type
-{
-  /* A true stack frame, created by the target program during normal
-     execution.  */
-  NORMAL_FRAME,
-  /* A fake frame, created by GDB when performing an inferior function
-     call.  */
-  DUMMY_FRAME,
-  /* In a signal handler, various OSs handle this in various ways.
-     The main thing is that the frame may be far from normal.  */
-  SIGTRAMP_FRAME,
-  /* Sentinel or registers frame.  This frame obtains register values
-     direct from the inferior's registers.  */
-  SENTINEL_FRAME
-};
 extern enum frame_type get_frame_type (struct frame_info *);
 
 /* For frames where we can not unwind further, describe why.  */
index 4945712c4a8d8fb7d94b248782ecfb1aeedbe29d..351011a5ebc7481d862c254faad8171aefa131d6 100644 (file)
@@ -1016,7 +1016,8 @@ frv_frame_unwind_cache (struct frame_info *next_frame,
   info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
   /* Prologue analysis does the rest...  */
-  frv_analyze_prologue (frame_func_unwind (next_frame), next_frame, info);
+  frv_analyze_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
+                       next_frame, info);
 
   return info;
 }
@@ -1346,7 +1347,7 @@ frv_frame_this_id (struct frame_info *next_frame,
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   /* Check if the stack is empty.  */
   msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
index f5a8e4df16c95a58b46c1d5f8ecd6fee0d2c1f7b..8e817b1adcdf6259c4cf920c93e027ce8704ad11 100644 (file)
@@ -447,7 +447,7 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache)
 
   cache->saved_regs[E_PC_REGNUM] = -BINWORD;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   current_pc = frame_pc_unwind (next_frame);
   if (cache->pc != 0)
     h8300_analyze_prologue (cache->pc, current_pc, cache);
index 060eb131818490cd1a2e223fc627403bd8e6328e..382c712088e19faa967632c35578b1237a49a7cc 100644 (file)
@@ -1787,9 +1787,14 @@ hppa_skip_prologue (CORE_ADDR pc)
 static struct unwind_table_entry *
 hppa_find_unwind_entry_in_block (struct frame_info *f)
 {
-  CORE_ADDR pc;
-
-  pc = frame_unwind_address_in_block (f);
+  CORE_ADDR pc = frame_unwind_address_in_block (f, NORMAL_FRAME);
+
+  /* FIXME drow/20070101: Calling gdbarch_addr_bits_remove on the
+     result of frame_unwind_address_in_block implies a problem.
+     The bits should have been removed earlier, before the return
+     value of frame_pc_unwind.  That might be happening already;
+     if it isn't, it should be fixed.  Then this call can be
+     removed.  */
   pc = gdbarch_addr_bits_remove (get_frame_arch (f), pc);
   return find_unwind_entry (pc);
 }
@@ -1899,7 +1904,7 @@ hppa_frame_cache (struct frame_info *next_frame, void **this_cache)
     if ((u->Region_description & 0x2) == 0)
       start_pc = u->region_start;
     else
-      start_pc = frame_func_unwind (next_frame);
+      start_pc = frame_func_unwind (next_frame, NORMAL_FRAME);
 
     prologue_end = skip_prologue_hard_way (start_pc, 0);
     end_pc = frame_pc_unwind (next_frame);
@@ -2267,7 +2272,7 @@ hppa_fallback_frame_cache (struct frame_info *next_frame, void **this_cache)
   (*this_cache) = cache;
   cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
-  start_pc = frame_func_unwind (next_frame);
+  start_pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (start_pc)
     {
       CORE_ADDR cur_pc = frame_pc_unwind (next_frame);
@@ -2326,7 +2331,8 @@ hppa_fallback_frame_this_id (struct frame_info *next_frame, void **this_cache,
 {
   struct hppa_frame_cache *info = 
     hppa_fallback_frame_cache (next_frame, this_cache);
-  (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (info->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 static void
@@ -2409,7 +2415,8 @@ hppa_stub_frame_this_id (struct frame_info *next_frame,
     = hppa_stub_frame_unwind_cache (next_frame, this_prologue_cache);
 
   if (info)
-    *this_id = frame_id_build (info->base, frame_func_unwind (next_frame));
+    *this_id = frame_id_build (info->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
   else
     *this_id = null_frame_id;
 }
@@ -2441,7 +2448,7 @@ static const struct frame_unwind hppa_stub_frame_unwind = {
 static const struct frame_unwind *
 hppa_stub_unwind_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
   struct gdbarch *gdbarch = get_frame_arch (next_frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
index afc7cb23e544a6257fa798516374fb1fd4f54904..4d9583d345cf89690a843cd23526464356e964cc 100644 (file)
@@ -949,7 +949,7 @@ i386_frame_cache (struct frame_info *next_frame, void **this_cache)
   /* For normal frames, %eip is stored at 4(%ebp).  */
   cache->saved_regs[I386_EIP_REGNUM] = 4;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
     i386_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
 
index c3643c7fa8f7dd3cfe15c61afdf764666c1a0435..38058bfeaafd6f0681d4407b5fec6b69a5a69daf 100644 (file)
@@ -353,7 +353,9 @@ i386obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
   cache = trad_frame_cache_zalloc (next_frame);
   *this_cache = cache;
 
-  func = frame_func_unwind (next_frame);
+  /* NORMAL_FRAME matches the type in i386obsd_trapframe_unwind, but
+     SIGTRAMP_FRAME might be more appropriate.  */
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
   sp = frame_unwind_register_unsigned (next_frame, I386_ESP_REGNUM);
 
   find_pc_partial_function (func, &name, NULL, NULL);
index 883d570cc445862dd035e78c98e746287b4d54c9..98ca406eb5fb2f7e7ba57ee5c6cdb45feb0581a7 100644 (file)
@@ -1555,7 +1555,7 @@ ia64_frame_cache (struct frame_info *next_frame, void **this_cache)
 
   cache->cfm = cfm;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   if (cache->pc != 0)
     examine_prologue (cache->pc, frame_pc_unwind (next_frame), next_frame, cache);
index 347247a89eb2127a3a7b3e60770806c3bbd71f23..662a87fd11a3141d28689d1a70bc9cae995093df 100644 (file)
@@ -141,7 +141,10 @@ libunwind_frame_cache (struct frame_info *next_frame, void **this_cache)
   /* Allocate a new cache.  */
   cache = FRAME_OBSTACK_ZALLOC (struct libunwind_frame_cache);
 
-  cache->func_addr = frame_func_unwind (next_frame);
+  /* We can assume we are unwinding a normal frame.  Even if this is
+     for a signal trampoline, ia64 signal "trampolines" use a normal
+     subroutine call to start the signal handler.  */
+  cache->func_addr = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->func_addr == 0
       && frame_relative_level (next_frame) > 0
       && get_frame_type (next_frame) != SIGTRAMP_FRAME)
index cb8a7add52c72048d906ed6ad21cd30eac638901..91a56cc131b96ffbb2bf47bb90c79889811aa25c 100644 (file)
@@ -1836,7 +1836,7 @@ m32c_analyze_frame_prologue (struct frame_info *next_frame,
 {
   if (! *this_prologue_cache)
     {
-      CORE_ADDR func_start = frame_func_unwind (next_frame);
+      CORE_ADDR func_start = frame_func_unwind (next_frame, NORMAL_FRAME);
       CORE_ADDR stop_addr = frame_pc_unwind (next_frame);
 
       /* If we couldn't find any function containing the PC, then
@@ -1900,7 +1900,8 @@ m32c_this_id (struct frame_info *next_frame,
   CORE_ADDR base = m32c_frame_base (next_frame, this_prologue_cache);
 
   if (base)
-    *this_id = frame_id_build (base, frame_func_unwind (next_frame));
+    *this_id = frame_id_build (base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
   /* Otherwise, leave it unset, and that will terminate the backtrace.  */
 }
 
index 427eee4a9d8202d725b94f83b04f6d8dcdb03b9c..b1a5de81bae3375f5f8b740c7ecf99174a33c18c 100644 (file)
@@ -250,7 +250,7 @@ m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame,
       if (addr)
        sigcontext_addr += 128;
       else
-       addr = frame_func_unwind (next_frame);
+       addr = frame_func_unwind (next_frame, NORMAL_FRAME);
     }
   cache->pc = addr;
 
index 9e477f30ad3d8cdfba77eb3482df843ccdf37cf3..fa40064f07c3220f178e232d4812230459a4eae2 100644 (file)
@@ -536,7 +536,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
   info->uses_frame = 0;
 
   scan_limit = frame_pc_unwind (next_frame);
-  for (pc = frame_func_unwind (next_frame);
+  for (pc = frame_func_unwind (next_frame, NORMAL_FRAME);
        pc > 0 && pc < scan_limit; pc += 2)
     {
       if ((pc & 2) == 0)
@@ -835,7 +835,7 @@ m32r_frame_this_id (struct frame_info *next_frame,
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   /* Check if the stack is empty.  */
   msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
index ba8ab4892b263d0d73eb0af255666fcf98cf0d77..42c4a25ca84780de6c810af4bbce9f33ad829d92 100644 (file)
@@ -798,7 +798,7 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame,
   (*this_prologue_cache) = info;
   info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
-  info->pc = frame_func_unwind (next_frame);
+  info->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   info->size = 0;
   info->return_kind = m68hc11_get_return_insn (info->pc);
@@ -889,7 +889,7 @@ m68hc11_frame_this_id (struct frame_info *next_frame,
   struct frame_id id;
 
   /* The FUNC is easy.  */
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   /* Hopefully the prologue analysis either correctly determined the
      frame's base (which is the SP from the previous frame), or set
index d7c89c27183181d424805fe8abb8e24a468ba766..90cb169234f4ad1144056ec3ba5ade395e1d55c6 100644 (file)
@@ -819,7 +819,7 @@ m68k_frame_cache (struct frame_info *next_frame, void **this_cache)
   /* For normal frames, %pc is stored at 4(%fp).  */
   cache->saved_regs[M68K_PC_REGNUM] = 4;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
     m68k_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
 
index 77d1f2331e2665b18cde880a98caa376f0fdfe44..c5a5d57050b96aa985d7386b94473c5055082c3b 100644 (file)
@@ -659,12 +659,9 @@ m88k_frame_cache (struct frame_info *next_frame, void **this_cache)
   cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
   cache->fp_offset = -1;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
-    {
-      CORE_ADDR addr_in_block = frame_unwind_address_in_block (next_frame);
-      m88k_analyze_prologue (cache->pc, addr_in_block, cache);
-    }
+    m88k_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
 
   /* Calculate the stack pointer used in the prologue.  */
   if (cache->fp_offset != -1)
index e7b4d06931da88bbbba1624c47a0f8b67d96f69a..8e029c9949ee705253903e6ad54ec46e3d659f4d 100644 (file)
@@ -386,7 +386,8 @@ mips_mdebug_frame_this_id (struct frame_info *next_frame, void **this_cache,
 {
   struct mips_frame_cache *info = mips_mdebug_frame_cache (next_frame,
                                                           this_cache);
-  (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (info->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 static void
@@ -412,7 +413,7 @@ static const struct frame_unwind mips_mdebug_frame_unwind =
 static const struct frame_unwind *
 mips_mdebug_frame_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
   CORE_ADDR startaddr = 0;
   struct mdebug_extra_func_info *proc_desc;
   int kernel_trap;
index f25c8a15bfb9ca9444f457029069bdba3a1c1747..c8e958a58c4248a75c6069033676136a62586226 100644 (file)
@@ -1666,7 +1666,8 @@ mips_insn16_frame_this_id (struct frame_info *next_frame, void **this_cache,
 {
   struct mips_frame_cache *info = mips_insn16_frame_cache (next_frame,
                                                           this_cache);
-  (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (info->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 static void
@@ -1692,7 +1693,7 @@ static const struct frame_unwind mips_insn16_frame_unwind =
 static const struct frame_unwind *
 mips_insn16_frame_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
   if (mips_pc_is_mips16 (pc))
     return &mips_insn16_frame_unwind;
   return NULL;
@@ -1986,7 +1987,8 @@ mips_insn32_frame_this_id (struct frame_info *next_frame, void **this_cache,
 {
   struct mips_frame_cache *info = mips_insn32_frame_cache (next_frame,
                                                           this_cache);
-  (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (info->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 static void
@@ -2012,7 +2014,7 @@ static const struct frame_unwind mips_insn32_frame_unwind =
 static const struct frame_unwind *
 mips_insn32_frame_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
   if (! mips_pc_is_mips16 (pc))
     return &mips_insn32_frame_unwind;
   return NULL;
@@ -2107,7 +2109,7 @@ static const struct frame_unwind *
 mips_stub_frame_sniffer (struct frame_info *next_frame)
 {
   struct obj_section *s;
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
 
   if (in_plt_section (pc, NULL))
     return &mips_stub_frame_unwind;
index ac5098a46472a5ba8fcc4b25afa0bda54699d2b8..d4edd2823ca3796e954f4f68a47c8efb9bf6a01d 100644 (file)
@@ -850,9 +850,12 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame,
                       frame_id_build (trad_frame_get_this_base (cache), 
                                       start));
   else
-    trad_frame_set_id (cache, 
-                      frame_id_build (trad_frame_get_this_base (cache), 
-                                      frame_func_unwind (next_frame)));
+    {
+      start = frame_func_unwind (next_frame, NORMAL_FRAME);
+      trad_frame_set_id (cache,
+                        frame_id_build (trad_frame_get_this_base (cache),
+                                        start));
+    }
 
   (*this_prologue_cache) = cache;
   return cache;
index baaa4fa225fbe392eeee8ff50f3530b351227621..b9b865330a37b1c4dce5dcc64f96d239d749f01c 100644 (file)
@@ -891,7 +891,7 @@ mt_frame_unwind_cache (struct frame_info *next_frame,
   frame_unwind_unsigned_register (next_frame, MT_SP_REGNUM, &sp);
   frame_unwind_unsigned_register (next_frame, MT_FP_REGNUM, &fp);
 
-  start_addr = frame_func_unwind (next_frame);
+  start_addr = frame_func_unwind (next_frame, NORMAL_FRAME);
 
   /* Return early if GDB couldn't find the function.  */
   if (start_addr == 0)
@@ -1041,10 +1041,9 @@ mt_frame_this_id (struct frame_info *next_frame,
     mt_frame_unwind_cache (next_frame, this_prologue_cache);
 
   if (!(info == NULL || info->prev_sp == 0))
-    {
-      (*this_id) = frame_id_build (info->prev_sp,
-                                  frame_func_unwind (next_frame));
-    }
+    (*this_id) = frame_id_build (info->prev_sp,
+                                frame_func_unwind (next_frame, NORMAL_FRAME));
+
   return;
 }
 
index e107114f938ec2aae4740d1f34c21001b9c24ee6..6e358876dc290b165b04f954990d2728115aa83d 100644 (file)
@@ -2977,7 +2977,7 @@ rs6000_frame_cache (struct frame_info *next_frame, void **this_cache)
   (*this_cache) = cache;
   cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
   pc = frame_pc_unwind (next_frame);
   skip_prologue (func, pc, &fdata);
 
@@ -3129,7 +3129,8 @@ rs6000_frame_this_id (struct frame_info *next_frame, void **this_cache,
 {
   struct rs6000_frame_cache *info = rs6000_frame_cache (next_frame,
                                                        this_cache);
-  (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (info->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 static void
index 08a032a883b3c396e99f184a0c742598fe3c6ee5..395c57e7b17bc61b60423adc31ebc2e2c4becdbc 100644 (file)
@@ -1232,7 +1232,7 @@ s390_prologue_frame_unwind_cache (struct frame_info *next_frame,
      bother searching for it -- with modern compilers this would be mostly
      pointless anyway.  Trust that we'll either have valid DWARF-2 CFI data
      or else a valid backchain ...  */
-  func = frame_func_unwind (next_frame);
+  func = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (!func)
     return 0;
 
@@ -1556,14 +1556,15 @@ static const struct frame_unwind s390_stub_frame_unwind = {
 static const struct frame_unwind *
 s390_stub_frame_sniffer (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR addr_in_block;
   bfd_byte insn[S390_MAX_INSTR_SIZE];
 
   /* If the current PC points to non-readable memory, we assume we
      have trapped due to an invalid function pointer call.  We handle
      the non-existing current function like a PLT stub.  */
-  if (in_plt_section (pc, NULL)
-      || s390_readinstruction (insn, pc) < 0)
+  addr_in_block = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
+  if (in_plt_section (addr_in_block, NULL)
+      || s390_readinstruction (insn, frame_pc_unwind (next_frame)) < 0)
     return &s390_stub_frame_unwind;
   return NULL;
 }
index 300e775c48d8826364fef69657ac543c3d9f3a7a..d739333a70e53ba64069ad28caebb3a1fd62bcc1 100644 (file)
@@ -801,7 +801,8 @@ score_prologue_this_id (struct frame_info *next_frame, void **this_cache,
 {
   struct score_frame_cache *info = score_make_prologue_cache (next_frame,
                                                               this_cache);
-  (*this_id) = frame_id_build (info->base, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (info->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 static void
index 752f64223ab77bfe4bd4f6230859c787a98e6f77..59f374b8adf424bbfb9ebaad31e831b157313ed0 100644 (file)
@@ -2215,7 +2215,7 @@ sh_frame_cache (struct frame_info *next_frame, void **this_cache)
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   current_pc = frame_pc_unwind (next_frame);
   if (cache->pc != 0)
     sh_analyze_prologue (cache->pc, current_pc, cache);
index 25eb8932d6a0810233d6b969943673e8492e28ce..62b68259f20c9eab5ebd664788d83b532fc4bbf1 100644 (file)
@@ -2253,7 +2253,7 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache)
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
     sh64_analyze_prologue (current_gdbarch, cache, cache->pc, current_pc);
 
index a55687f03fc2d94f3648e8cc88f864761c327b91..bbcdb081a234233c5358e8777af859a2a8e51021 100644 (file)
@@ -699,12 +699,9 @@ sparc_frame_cache (struct frame_info *next_frame, void **this_cache)
   cache = sparc_alloc_frame_cache ();
   *this_cache = cache;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (cache->pc != 0)
-    {
-      CORE_ADDR addr_in_block = frame_unwind_address_in_block (next_frame);
-      sparc_analyze_prologue (cache->pc, addr_in_block, cache);
-    }
+    sparc_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
 
   if (cache->frameless_p)
     {
@@ -1054,7 +1051,7 @@ sparc32_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
 static int
 sparc32_dwarf2_struct_return_p (struct frame_info *next_frame)
 {
-  CORE_ADDR pc = frame_unwind_address_in_block (next_frame);
+  CORE_ADDR pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
   struct symbol *sym = find_pc_function (pc);
 
   if (sym)
index 5c205694aab6e0d1890557e5c564158f62f872cf..21f21842401fdf15263cb0fddd7d4ef28deeae98 100644 (file)
@@ -205,7 +205,7 @@ sparc64obsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
 /* Kernel debugging support.  */
 
 static struct sparc_frame_cache *
-sparc64obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
+sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache)
 {
   struct sparc_frame_cache *cache;
   CORE_ADDR sp, trapframe_addr;
@@ -267,15 +267,17 @@ static const struct frame_unwind sparc64obsd_trapframe_unwind =
 static const struct frame_unwind *
 sparc64obsd_trapframe_sniffer (struct frame_info *next_frame)
 {
+  CORE_ADDR pc;
   ULONGEST pstate;
   char *name;
 
   /* Check whether we are in privileged mode, and bail out if we're not.  */
-  pstate = frame_unwind_register_unsigned(next_frame, SPARC64_PSTATE_REGNUM);
+  pstate = frame_unwind_register_unsigned (next_frame, SPARC64_PSTATE_REGNUM);
   if ((pstate & SPARC64_PSTATE_PRIV) == 0)
     return NULL;
 
-  find_pc_partial_function (frame_pc_unwind (next_frame), &name, NULL, NULL);
+  pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
+  find_pc_partial_function (pc, &name, NULL, NULL);
   if (name && strcmp (name, "Lslowtrap_reenter") == 0)
     return &sparc64obsd_trapframe_unwind;
 
index ef8c1c65c95183d40f23b2919d23e28b5ab5a11a..f749ecebb19e091b037662ecf2b2936a91ef8ce5 100644 (file)
@@ -587,7 +587,7 @@ spu_frame_unwind_cache (struct frame_info *next_frame,
   info->local_base = 0;
 
   /* Find the start of the current function, and analyze its prologue.  */
-  info->func = frame_func_unwind (next_frame);
+  info->func = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (info->func == 0)
     {
       /* Fall back to using the current PC as frame ID.  */
index b8dc9b3f77c41ff3f1d8d27422253d76885a18b0..e8f3c820e221d63d99618e9c66de97f9cc8b68e5 100644 (file)
@@ -1,3 +1,7 @@
+2007-02-27  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdb.arch/i386-signal.c, gdb.arch/i386-signal.exp: New files.
+
 2007-02-27  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gdb.base/maint.exp: Remove full paths from test names.
diff --git a/gdb/testsuite/gdb.arch/i386-signal.c b/gdb/testsuite/gdb.arch/i386-signal.c
new file mode 100644 (file)
index 0000000..61be9af
--- /dev/null
@@ -0,0 +1,55 @@
+/* Unwinder test program for signal frames.
+
+   Copyright 2007 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+void sigframe (void);
+void setup (void);
+
+void
+func (void)
+{
+}
+
+int
+main (void)
+{
+  setup ();
+}
+
+/* Create an imitation signal frame.  This will work on any x86 or
+   x86-64 target which uses a version of GAS recent enough for
+   .cfi_signal_frame (added 2006-02-27 and included in binutils 2.17).
+   The default CIE created by gas suffices to unwind from an empty
+   function.  */
+
+asm(".text\n"
+    "    .align 8\n"
+    "    .globl setup\n"
+    "setup:\n"
+    "    push $sigframe\n"
+    "    jmp func\n"
+    "\n"
+    "    .cfi_startproc\n"
+    "    .cfi_signal_frame\n"
+    "    nop\n"
+    "    .globl sigframe\n"
+    "sigframe:\n"
+    "    ret\n"
+    "    .cfi_endproc");
diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp
new file mode 100644 (file)
index 0000000..66f3860
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This file is part of the GDB testsuite.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
+    verbose "Skipping i386 unwinder tests."
+    return
+}
+
+set testfile "i386-signal"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+         executable { debug }] != "" } {
+    untested i386-sigframe.exp
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+runto func
+gdb_test "backtrace 10" \
+    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in)?main.*"
+
+gdb_test "finish" "Run till exit from \#0  func.*<signal handler called>"
index 6cfa84edb3ba28efa6fe14b3a7842c9b9dc122f8..752223c8591a549f2de65cc03e2ba425d8c45956 100644 (file)
@@ -856,7 +856,7 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache)
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   current_pc = frame_pc_unwind (next_frame);
   if (cache->pc != 0)
     v850_analyze_prologue (cache->pc, current_pc, cache);
index 877e02dd3b73fe6f53c7f9690e0b5f22e80c2ca3..ad53725df1c985cdd3664ff701e2ebe10f179889 100644 (file)
@@ -384,7 +384,8 @@ vax_frame_this_id (struct frame_info *next_frame, void **this_cache,
   if (cache->base == 0)
     return;
 
-  (*this_id) = frame_id_build (cache->base, frame_func_unwind (next_frame));
+  (*this_id) = frame_id_build (cache->base,
+                              frame_func_unwind (next_frame, NORMAL_FRAME));
 }
 
 static void
index 0c4841363728edc5d7075e36e5f70ee07a30b554..e03498fc6c1bd50e55362fe6f22a0737c207a041 100644 (file)
@@ -655,7 +655,7 @@ xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache)
   if (cache->base == 0)
     return cache;
 
-  cache->pc = frame_func_unwind (next_frame);
+  cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
   current_pc = frame_pc_unwind (next_frame);
   if (cache->pc)
     xstormy16_analyze_prologue (cache->pc, current_pc, cache, next_frame);
index 45ae09b7859152bfaeae5bc05c1c0ba2cbe1119b..eb06b06cfe876c3f60a997ab891badc7199e9f7d 100644 (file)
@@ -924,7 +924,7 @@ xtensa_frame_cache (struct frame_info *next_frame, void **this_cache)
       cache->ws = ws & ~(1 << wb);
     }
 
-  cache->pc = ((frame_func_unwind (next_frame) & 0xc0000000)
+  cache->pc = ((frame_func_unwind (next_frame, NORMAL_FRAME) & 0xc0000000)
               | (ra & 0x3fffffff));
   cache->ps = (ps & ~PS_CALLINC_MASK) | ((WINSIZE(ra)/4) << PS_CALLINC_SHIFT);