update uClibc config for i386
[openwrt.git] / toolchain / gdb / patches / 640-debian_dwarf2-frame-signal-unwinder.patch
1 Status: Checked in to HEAD after 6.3.
2
3 2004-11-07  Daniel Jacobowitz  <dan@debian.org>
4
5         * dwarf2-frame.c (struct dwarf2_frame_ops): Add signal_frame_p.
6         (dwarf2_frame_set_signal_frame_p, dwarf2_frame_signal_frame_p)
7         (dwarf2_signal_frame_unwind): New.
8         (dwarf2_frame_sniffer): Use dwarf2_frame_signal_frame_p.
9         * dwarf2-frame.h (dwarf2_frame_set_signal_frame_p): New prototype.
10
11 Index: src/gdb/dwarf2-frame.c
12 ===================================================================
13 RCS file: /big/fsf/rsync/src-cvs/src/gdb/dwarf2-frame.c,v
14 retrieving revision 1.41
15 diff -u -p -r1.41 dwarf2-frame.c
16 --- src/gdb/dwarf2-frame.c      4 Nov 2004 21:15:15 -0000       1.41
17 +++ src/gdb/dwarf2-frame.c      7 Nov 2004 17:41:58 -0000
18 @@ -471,6 +471,10 @@ struct dwarf2_frame_ops
19  {
20    /* Pre-initialize the register state REG for register REGNUM.  */
21    void (*init_reg) (struct gdbarch *, int, struct dwarf2_frame_state_reg *);
22 +
23 +  /* Check whether the frame preceding NEXT_FRAME will be a signal
24 +     trampoline.  */
25 +  int (*signal_frame_p) (struct gdbarch *, struct frame_info *);
26  };
27  
28  /* Default architecture-specific register state initialization
29 @@ -547,6 +551,33 @@ dwarf2_frame_init_reg (struct gdbarch *g
30  
31    ops->init_reg (gdbarch, regnum, reg);
32  }
33 +
34 +/* Set the architecture-specific signal trampoline recognition
35 +   function for GDBARCH to SIGNAL_FRAME_P.  */
36 +
37 +void
38 +dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
39 +                                int (*signal_frame_p) (struct gdbarch *,
40 +                                                       struct frame_info *))
41 +{
42 +  struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
43 +
44 +  ops->signal_frame_p = signal_frame_p;
45 +}
46 +
47 +/* Query the architecture-specific signal frame recognizer for
48 +   NEXT_FRAME.  */
49 +
50 +static int
51 +dwarf2_frame_signal_frame_p (struct gdbarch *gdbarch,
52 +                            struct frame_info *next_frame)
53 +{
54 +  struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
55 +
56 +  if (ops->signal_frame_p == NULL)
57 +    return 0;
58 +  return ops->signal_frame_p (gdbarch, next_frame);
59 +}
60  \f
61  
62  struct dwarf2_frame_cache
63 @@ -841,6 +872,13 @@ static const struct frame_unwind dwarf2_
64    dwarf2_frame_prev_register
65  };
66  
67 +static const struct frame_unwind dwarf2_signal_frame_unwind =
68 +{
69 +  SIGTRAMP_FRAME,
70 +  dwarf2_frame_this_id,
71 +  dwarf2_frame_prev_register
72 +};
73 +
74  const struct frame_unwind *
75  dwarf2_frame_sniffer (struct frame_info *next_frame)
76  {
77 @@ -848,10 +886,18 @@ dwarf2_frame_sniffer (struct frame_info 
78       function.  frame_pc_unwind(), for a no-return next function, can
79       end up returning something past the end of this function's body.  */
80    CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame);
81 -  if (dwarf2_frame_find_fde (&block_addr))
82 -    return &dwarf2_frame_unwind;
83 +  if (!dwarf2_frame_find_fde (&block_addr))
84 +    return NULL;
85  
86 -  return NULL;
87 +  /* On some targets, signal trampolines may have unwind information.
88 +     We need to recognize them so that we set the frame type
89 +     correctly.  */
90 +
91 +  if (dwarf2_frame_signal_frame_p (get_frame_arch (next_frame),
92 +                                  next_frame))
93 +    return &dwarf2_signal_frame_unwind;
94 +
95 +  return &dwarf2_frame_unwind;
96  }
97  \f
98  
99 Index: src/gdb/dwarf2-frame.h
100 ===================================================================
101 RCS file: /big/fsf/rsync/src-cvs/src/gdb/dwarf2-frame.h,v
102 retrieving revision 1.6
103 diff -u -p -r1.6 dwarf2-frame.h
104 --- src/gdb/dwarf2-frame.h      28 Feb 2004 16:59:32 -0000      1.6
105 +++ src/gdb/dwarf2-frame.h      7 Nov 2004 17:40:41 -0000
106 @@ -79,6 +79,14 @@ extern void dwarf2_frame_set_init_reg (s
107                                        void (*init_reg) (struct gdbarch *, int,
108                                              struct dwarf2_frame_state_reg *));
109  
110 +/* Set the architecture-specific signal trampoline recognition
111 +   function for GDBARCH to SIGNAL_FRAME_P.  */
112 +
113 +extern void
114 +  dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
115 +                                  int (*signal_frame_p) (struct gdbarch *,
116 +                                                         struct frame_info *));
117 +
118  /* Return the frame unwind methods for the function that contains PC,
119     or NULL if it can't be handled by DWARF CFI frame unwinder.  */
120