summaryrefslogtreecommitdiff
path: root/gcc/frame.c
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-10-26 19:54:42 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-10-26 14:54:42 -0500
commitd84e64d416af881a3dbc9eed8dd0212cc473baf8 (patch)
tree4e1082dba15dedf1e0cf5b5116ab52cddd4e3511 /gcc/frame.c
parentbd123dc9f223f452d5dd6937dd6076d762bca564 (diff)
downloadgcc-d84e64d416af881a3dbc9eed8dd0212cc473baf8.tar.gz
dwarf2out.c (output_call_frame_info): The CIE pointer is now a 32 bit PC-relative offset.
* dwarf2out.c (output_call_frame_info): The CIE pointer is now a 32 bit PC-relative offset. The exception range table pointer is now in the CIE. * frame.c (dwarf_cie, dwarf_fde): Rename CIE_pointer to CIE_delta. (count_fdes, add_fdes, get_cie): Adjust. (cie_info, extract_cie_info, __frame_state_for): Adjust eh_ptr uses. From H.J. Lu: * frame.c (count_fdes, add_fdes): Skip linked once FDE entries. From-SVN: r16192
Diffstat (limited to 'gcc/frame.c')
-rw-r--r--gcc/frame.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/gcc/frame.c b/gcc/frame.c
index b13167e62a2..ca0bb39de80 100644
--- a/gcc/frame.c
+++ b/gcc/frame.c
@@ -46,9 +46,10 @@ Boston, MA 02111-1307, USA. */
/* Some types used by the DWARF 2 spec. */
-typedef unsigned int uword __attribute__ ((mode (SI)));
-typedef unsigned int uaddr __attribute__ ((mode (pointer)));
-typedef int saddr __attribute__ ((mode (pointer)));
+typedef int sword __attribute__ ((mode (SI)));
+typedef unsigned int uword __attribute__ ((mode (SI)));
+typedef unsigned int uaddr __attribute__ ((mode (pointer)));
+typedef int saddr __attribute__ ((mode (pointer)));
typedef unsigned char ubyte;
/* The first few fields of a CIE. The CIE_id field is 0xffffffff for a CIE,
@@ -57,7 +58,7 @@ typedef unsigned char ubyte;
struct dwarf_cie {
uword length;
- uaddr CIE_id;
+ sword CIE_id;
ubyte version;
char augmentation[0];
} __attribute__ ((packed, aligned (__alignof__ (void *))));
@@ -66,7 +67,7 @@ struct dwarf_cie {
struct dwarf_fde {
uword length;
- struct dwarf_cie* CIE_pointer;
+ sword CIE_delta;
void* pc_begin;
uaddr pc_range;
} __attribute__ ((packed, aligned (__alignof__ (void *))));
@@ -92,6 +93,7 @@ static struct object *objects;
struct cie_info {
char *augmentation;
+ void *eh_ptr;
int code_align;
int data_align;
unsigned ra_regno;
@@ -217,8 +219,8 @@ count_fdes (fde *this_fde)
for (count = 0; this_fde->length != 0; this_fde = next_fde (this_fde))
{
- /* Skip CIEs. */
- if ((uaddr)(this_fde->CIE_pointer) == (uaddr)-1)
+ /* Skip CIEs and linked once FDE entries. */
+ if (this_fde->CIE_delta == 0 || this_fde->pc_range == 0)
continue;
++count;
@@ -237,8 +239,8 @@ add_fdes (fde *this_fde, fde **array, size_t *i_ptr,
for (; this_fde->length != 0; this_fde = next_fde (this_fde))
{
- /* Skip CIEs. */
- if ((uaddr)(this_fde->CIE_pointer) == (uaddr)-1)
+ /* Skip CIEs and linked once FDE entries. */
+ if (this_fde->CIE_delta == 0 || this_fde->pc_range == 0)
continue;
fde_insert (array, i++, this_fde);
@@ -332,6 +334,12 @@ find_fde (void *pc)
return 0;
}
+static inline struct dwarf_cie *
+get_cie (fde *f)
+{
+ return ((void *)&f->CIE_delta) - f->CIE_delta;
+}
+
/* Extract any interesting information from the CIE for the translation
unit F belongs to. */
@@ -341,15 +349,23 @@ extract_cie_info (fde *f, struct cie_info *c)
void *p;
int i;
- c->augmentation = f->CIE_pointer->augmentation;
+ c->augmentation = get_cie (f)->augmentation;
if (strcmp (c->augmentation, "") != 0
- && strcmp (c->augmentation, "e") != 0
+ && strcmp (c->augmentation, "eh") != 0
&& c->augmentation[0] != 'z')
return 0;
p = c->augmentation + strlen (c->augmentation) + 1;
+ if (strcmp (c->augmentation, "eh") == 0)
+ {
+ c->eh_ptr = read_pointer (p);
+ p += sizeof (void *);
+ }
+ else
+ c->eh_ptr = 0;
+
p = decode_uleb128 (p, &c->code_align);
p = decode_sleb128 (p, &c->data_align);
c->ra_regno = *(unsigned char *)p++;
@@ -576,9 +592,10 @@ __frame_state_for (void *pc_target, struct frame_state *state_in)
memset (&state, 0, sizeof (state));
state.s.retaddr_column = info.ra_regno;
+ state.s.eh_ptr = info.eh_ptr;
/* First decode all the insns in the CIE. */
- end = next_fde ((fde*) f->CIE_pointer);
+ end = next_fde ((fde*) get_cie (f));
while (insn < end)
insn = execute_cfa_insn (insn, &state, &info, 0);
@@ -590,11 +607,6 @@ __frame_state_for (void *pc_target, struct frame_state *state_in)
insn = decode_uleb128 (insn, &i);
insn += i;
}
- else if (strcmp (info.augmentation, "e") == 0)
- {
- state.s.eh_ptr = read_pointer (insn);
- insn += sizeof (void *);
- }
/* Then the insns in the FDE up to our target PC. */
end = next_fde (f);