From: Roland McGrath Date: Sun, 22 Nov 2009 01:03:34 +0000 (-0800) Subject: Fix dwarf_getlocation braino in constant-form case handling. X-Git-Tag: elfutils-0.144~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=888381b9ace5251b9feaad14f9bfa8c9d85cb1fd;p=thirdparty%2Felfutils.git Fix dwarf_getlocation braino in constant-form case handling. --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 33a18baf5..9506daead 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2009-11-21 Roland McGrath + + * dwarf_getlocation.c (check_constant_offset): Return 1 for all + non-constant forms. + 2009-10-15 Roland McGrath * libdw_form.c (__libdw_form_val_len): Grok DW_FORM_sec_offset, diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index 17df8fe90..720b20f43 100644 --- a/libdw/dwarf_getlocation.c +++ b/libdw/dwarf_getlocation.c @@ -154,11 +154,29 @@ static int check_constant_offset (Dwarf_Attribute *attr, Dwarf_Op **llbuf, size_t *listlen) { - if (attr->code != DW_AT_data_member_location - || attr->form == DW_FORM_data4 - || attr->form == DW_FORM_data8) + if (attr->code != DW_AT_data_member_location) return 1; + switch (attr->form) + { + /* Punt for any non-constant form. */ + default: + return 1; + + case DW_FORM_data1: + case DW_FORM_data2: + case DW_FORM_sdata: + case DW_FORM_udata: + break; + + case DW_FORM_data4: + case DW_FORM_data8: + /* These are loclistptr, not constants. + XXX check cu->version > 3??? + */ + return 1; + } + /* Check whether we already cached this location. */ struct loc_s fake = { .addr = attr->valp }; struct loc_s **found = tfind (&fake, &attr->cu->locs, loc_compare);