summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2009-07-16 17:48:27 -0700
committerRoland McGrath <[email protected]>2009-07-16 17:48:27 -0700
commite160cc9336250462058014cbbbef07a086bbeced (patch)
tree56a8e43ccf2c50736a8d5fc4cff86e62bacd098d
parenta6abdfd9733842d3b0a23eb2e0619b0109358e3b (diff)
Support the easiest of the new v4 form flavors.
-rw-r--r--libdw/ChangeLog5
-rw-r--r--libdw/dwarf_formflag.c8
-rw-r--r--libdw/dwarf_formudata.c12
3 files changed, 23 insertions, 2 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 8e580e2c..cd30872f 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,10 @@
2009-07-16 Roland McGrath <[email protected]>
+ * dwarf_formudata.c (__libdw_formptr): Handle DW_FORM_sec_offset,
+ reject others when CU's version > 3.
+
+ * dwarf_formflag.c: Handle DW_FORM_flag_present.
+
* dwarf.h: Add DW_OP_{implicit,stack}_value from DWARF 4 draft.
Also DW_TAG_type_unit and DW_TAG_rvalue_reference_type.
Also DW_AT_signature, DW_AT_main_subprogram, DW_AT_data_bit_offset,
diff --git a/libdw/dwarf_formflag.c b/libdw/dwarf_formflag.c
index 4e57c3af..fb60c8e6 100644
--- a/libdw/dwarf_formflag.c
+++ b/libdw/dwarf_formflag.c
@@ -1,5 +1,5 @@
/* Return flag represented by attribute.
- Copyright (C) 2004 Red Hat, Inc.
+ Copyright (C) 2004-2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <[email protected]>, 2004.
@@ -64,6 +64,12 @@ dwarf_formflag (attr, return_bool)
if (attr == NULL)
return -1;
+ if (attr->form == DW_FORM_flag_present)
+ {
+ *return_bool = true;
+ return 0;
+ }
+
if (unlikely (attr->form != DW_FORM_flag))
{
__libdw_seterrno (DWARF_E_NO_FLAG);
diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c
index 04f04aae..d9d0a1cd 100644
--- a/libdw/dwarf_formudata.c
+++ b/libdw/dwarf_formudata.c
@@ -1,5 +1,5 @@
/* Return unsigned constant represented by attribute.
- Copyright (C) 2003, 2005 Red Hat, Inc.
+ Copyright (C) 2003-2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <[email protected]>, 2003.
@@ -71,6 +71,15 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
}
Dwarf_Word offset;
+ if (attr->form == DW_FORM_sec_offset)
+ {
+ if (__libdw_read_offset (attr->cu->dbg, IDX_debug_info, attr->valp,
+ attr->cu->offset_size, &offset, sec_index, 0))
+ return NULL;
+ }
+ else if (attr->cu->version > 3)
+ goto invalid;
+
switch (attr->form)
{
case DW_FORM_data4:
@@ -90,6 +99,7 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
unsigned char *endp = d->d_buf + d->d_size;
if (unlikely (readp >= endp))
{
+ invalid:
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return NULL;
}