From 5212396c006afcd7672d0a0f618ec5c28735e0da Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 1 Jun 2010 19:05:08 -0700 Subject: [PATCH] Fix DW_FORM_sec_offset handling. --- libdw/ChangeLog | 2 ++ libdw/dwarf_formudata.c | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 6712abf3e..2fca3eaac 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,7 @@ 2010-06-01 Roland McGrath + * dwarf_formudata.c (__libdw_formptr): Fix DW_FORM_sec_offset handling. + * dwarf_formblock.c (dwarf_formblock): Handle DW_FORM_exprloc. * libdw_findcu.c (__libdw_findcu): Accept version 4. diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c index d9d0a1cd2..63c9bcd7b 100644 --- a/libdw/dwarf_formudata.c +++ b/libdw/dwarf_formudata.c @@ -1,5 +1,5 @@ /* Return unsigned constant represented by attribute. - Copyright (C) 2003-2009 Red Hat, Inc. + Copyright (C) 2003-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2003. @@ -79,21 +79,21 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index, } else if (attr->cu->version > 3) goto invalid; - - switch (attr->form) - { - case DW_FORM_data4: - case DW_FORM_data8: - if (__libdw_read_offset (attr->cu->dbg, IDX_debug_info, attr->valp, - attr->form == DW_FORM_data4 ? 4 : 8, - &offset, sec_index, 0)) - return NULL; - break; - - default: - if (INTUSE(dwarf_formudata) (attr, &offset)) - return NULL; - }; + else + switch (attr->form) + { + case DW_FORM_data4: + case DW_FORM_data8: + if (__libdw_read_offset (attr->cu->dbg, IDX_debug_info, attr->valp, + attr->form == DW_FORM_data4 ? 4 : 8, + &offset, sec_index, 0)) + return NULL; + break; + + default: + if (INTUSE(dwarf_formudata) (attr, &offset)) + return NULL; + }; unsigned char *readp = d->d_buf + offset; unsigned char *endp = d->d_buf + d->d_size; -- 2.47.2