From: Roland McGrath Date: Wed, 8 Jul 2009 20:45:41 +0000 (-0700) Subject: Fix handling of constant-or-loclistptr (DW_AT_data_member_location). X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae3028b6ddc4143d592f94d2fb1a86e81411e884;p=thirdparty%2Felfutils.git Fix handling of constant-or-loclistptr (DW_AT_data_member_location). --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 81128e3d9..a13136c79 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,10 @@ 2009-07-08 Roland McGrath + * c++/dwarf-knowledge.cc (expected_value_space): + DW_AT_data_member_location can be constant or location. + * c++/values.cc (what_space): Treat only data[48] as *ptr when those + are expected. No other data forms can be *ptr. + * c++/output-shape.cc: New file. * Makefile.am (libdwpp_a_SOURCES): Add it. * c++/dwarf_output: Call add_shape method there. diff --git a/libdw/c++/dwarf-knowledge.cc b/libdw/c++/dwarf-knowledge.cc index 41463ab82..c4c7a8114 100644 --- a/libdw/c++/dwarf-knowledge.cc +++ b/libdw/c++/dwarf-knowledge.cc @@ -36,13 +36,15 @@ expected_value_space (int attr, int tag) case DW_AT_location: case DW_AT_string_length: case DW_AT_return_addr: - case DW_AT_data_member_location: case DW_AT_frame_base: case DW_AT_segment: case DW_AT_static_link: case DW_AT_vtable_elem_location: return VS(location); + case DW_AT_data_member_location: + return VS(location) | VS(constant); + case DW_AT_name: switch (tag) { diff --git a/libdw/c++/values.cc b/libdw/c++/values.cc index 37e5122c0..bdac9a281 100644 --- a/libdw/c++/values.cc +++ b/libdw/c++/values.cc @@ -94,20 +94,21 @@ dwarf::attr_value::what_space () const return VS_location; break; - case DW_FORM_data1: - case DW_FORM_data2: case DW_FORM_data4: case DW_FORM_data8: + // *ptr can only be these forms. Otherwise these are constants. + possible = VS(location) | VS(lineptr) | VS(macptr) | VS(rangelistptr); + if (expected & possible) + break; + /* Fall through. */ + + case DW_FORM_data1: + case DW_FORM_data2: case DW_FORM_udata: case DW_FORM_sdata: - /* Target constant, known DWARF constant, or *ptr. */ + /* Target constant, known DWARF constant. */ possible = (VS(dwarf_constant) | VS(constant) - | VS(source_file) | VS(source_line) | VS(source_column) - | VS(location) // loclistptr - | VS(lineptr) | VS(macptr) | VS(rangelistptr)); - if ((expected & possible) == (VS(constant) | VS(location))) - /* When both are expected, a constant is not a loclistptr. */ - return VS_constant; + | VS(source_file) | VS(source_line) | VS(source_column)); break; case DW_FORM_string: