patches/gdb/6.3/640-debian_dwarf2-frame-signal-unwinder.patch
changeset 96 aa1a9fbd6eb8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gdb/6.3/640-debian_dwarf2-frame-signal-unwinder.patch	Thu May 17 16:22:51 2007 +0000
     1.3 @@ -0,0 +1,120 @@
     1.4 +Status: Checked in to HEAD after 6.3.
     1.5 +
     1.6 +2004-11-07  Daniel Jacobowitz  <dan@debian.org>
     1.7 +
     1.8 +	* dwarf2-frame.c (struct dwarf2_frame_ops): Add signal_frame_p.
     1.9 +	(dwarf2_frame_set_signal_frame_p, dwarf2_frame_signal_frame_p)
    1.10 +	(dwarf2_signal_frame_unwind): New.
    1.11 +	(dwarf2_frame_sniffer): Use dwarf2_frame_signal_frame_p.
    1.12 +	* dwarf2-frame.h (dwarf2_frame_set_signal_frame_p): New prototype.
    1.13 +
    1.14 +Index: src/gdb/dwarf2-frame.c
    1.15 +===================================================================
    1.16 +RCS file: /big/fsf/rsync/src-cvs/src/gdb/dwarf2-frame.c,v
    1.17 +retrieving revision 1.41
    1.18 +diff -u -p -r1.41 dwarf2-frame.c
    1.19 +--- src/gdb/dwarf2-frame.c	4 Nov 2004 21:15:15 -0000	1.41
    1.20 ++++ src/gdb/dwarf2-frame.c	7 Nov 2004 17:41:58 -0000
    1.21 +@@ -471,6 +471,10 @@ struct dwarf2_frame_ops
    1.22 + {
    1.23 +   /* Pre-initialize the register state REG for register REGNUM.  */
    1.24 +   void (*init_reg) (struct gdbarch *, int, struct dwarf2_frame_state_reg *);
    1.25 ++
    1.26 ++  /* Check whether the frame preceding NEXT_FRAME will be a signal
    1.27 ++     trampoline.  */
    1.28 ++  int (*signal_frame_p) (struct gdbarch *, struct frame_info *);
    1.29 + };
    1.30 + 
    1.31 + /* Default architecture-specific register state initialization
    1.32 +@@ -547,6 +551,33 @@ dwarf2_frame_init_reg (struct gdbarch *g
    1.33 + 
    1.34 +   ops->init_reg (gdbarch, regnum, reg);
    1.35 + }
    1.36 ++
    1.37 ++/* Set the architecture-specific signal trampoline recognition
    1.38 ++   function for GDBARCH to SIGNAL_FRAME_P.  */
    1.39 ++
    1.40 ++void
    1.41 ++dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
    1.42 ++				 int (*signal_frame_p) (struct gdbarch *,
    1.43 ++							struct frame_info *))
    1.44 ++{
    1.45 ++  struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
    1.46 ++
    1.47 ++  ops->signal_frame_p = signal_frame_p;
    1.48 ++}
    1.49 ++
    1.50 ++/* Query the architecture-specific signal frame recognizer for
    1.51 ++   NEXT_FRAME.  */
    1.52 ++
    1.53 ++static int
    1.54 ++dwarf2_frame_signal_frame_p (struct gdbarch *gdbarch,
    1.55 ++			     struct frame_info *next_frame)
    1.56 ++{
    1.57 ++  struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
    1.58 ++
    1.59 ++  if (ops->signal_frame_p == NULL)
    1.60 ++    return 0;
    1.61 ++  return ops->signal_frame_p (gdbarch, next_frame);
    1.62 ++}
    1.63 + 
    1.64 + 
    1.65 + struct dwarf2_frame_cache
    1.66 +@@ -841,6 +872,13 @@ static const struct frame_unwind dwarf2_
    1.67 +   dwarf2_frame_prev_register
    1.68 + };
    1.69 + 
    1.70 ++static const struct frame_unwind dwarf2_signal_frame_unwind =
    1.71 ++{
    1.72 ++  SIGTRAMP_FRAME,
    1.73 ++  dwarf2_frame_this_id,
    1.74 ++  dwarf2_frame_prev_register
    1.75 ++};
    1.76 ++
    1.77 + const struct frame_unwind *
    1.78 + dwarf2_frame_sniffer (struct frame_info *next_frame)
    1.79 + {
    1.80 +@@ -848,10 +886,18 @@ dwarf2_frame_sniffer (struct frame_info 
    1.81 +      function.  frame_pc_unwind(), for a no-return next function, can
    1.82 +      end up returning something past the end of this function's body.  */
    1.83 +   CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame);
    1.84 +-  if (dwarf2_frame_find_fde (&block_addr))
    1.85 +-    return &dwarf2_frame_unwind;
    1.86 ++  if (!dwarf2_frame_find_fde (&block_addr))
    1.87 ++    return NULL;
    1.88 + 
    1.89 +-  return NULL;
    1.90 ++  /* On some targets, signal trampolines may have unwind information.
    1.91 ++     We need to recognize them so that we set the frame type
    1.92 ++     correctly.  */
    1.93 ++
    1.94 ++  if (dwarf2_frame_signal_frame_p (get_frame_arch (next_frame),
    1.95 ++				   next_frame))
    1.96 ++    return &dwarf2_signal_frame_unwind;
    1.97 ++
    1.98 ++  return &dwarf2_frame_unwind;
    1.99 + }
   1.100 + 
   1.101 + 
   1.102 +Index: src/gdb/dwarf2-frame.h
   1.103 +===================================================================
   1.104 +RCS file: /big/fsf/rsync/src-cvs/src/gdb/dwarf2-frame.h,v
   1.105 +retrieving revision 1.6
   1.106 +diff -u -p -r1.6 dwarf2-frame.h
   1.107 +--- src/gdb/dwarf2-frame.h	28 Feb 2004 16:59:32 -0000	1.6
   1.108 ++++ src/gdb/dwarf2-frame.h	7 Nov 2004 17:40:41 -0000
   1.109 +@@ -79,6 +79,14 @@ extern void dwarf2_frame_set_init_reg (s
   1.110 + 				       void (*init_reg) (struct gdbarch *, int,
   1.111 + 					     struct dwarf2_frame_state_reg *));
   1.112 + 
   1.113 ++/* Set the architecture-specific signal trampoline recognition
   1.114 ++   function for GDBARCH to SIGNAL_FRAME_P.  */
   1.115 ++
   1.116 ++extern void
   1.117 ++  dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
   1.118 ++				   int (*signal_frame_p) (struct gdbarch *,
   1.119 ++							  struct frame_info *));
   1.120 ++
   1.121 + /* Return the frame unwind methods for the function that contains PC,
   1.122 +    or NULL if it can't be handled by DWARF CFI frame unwinder.  */
   1.123 +