From: Roland McGrath Date: Fri, 17 Jul 2009 00:48:27 +0000 (-0700) Subject: Support the easiest of the new v4 form flavors. X-Git-Tag: elfutils-0.142~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e160cc9336250462058014cbbbef07a086bbeced;p=thirdparty%2Felfutils.git Support the easiest of the new v4 form flavors. --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 8e580e2c5..cd30872f3 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,10 @@ 2009-07-16 Roland McGrath + * 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 4e57c3af3..fb60c8e6a 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 , 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 04f04aae8..d9d0a1cd2 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 , 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; }