From 23f29700ebabf8a7fa00195237ba8a73073bf5a2 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 30 Sep 2009 00:28:52 -0700 Subject: [PATCH] Grok exprloc, flag_present, sec_offset in dwarf::attr_value::what_space. --- libdw/ChangeLog | 3 +++ libdw/c++/values.cc | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index b598bfe49..e6546ee1a 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,8 @@ 2009-09-30 Roland McGrath + * c++/values.cc (dwarf::attr_value::what_space): + Grok exprloc, flag_present, sec_offset. + * c++/values.cc (dwarf::attr_value::what_space): Fix data[48] case to favor constants when expected. diff --git a/libdw/c++/values.cc b/libdw/c++/values.cc index bc1bbf73b..097d2cf10 100644 --- a/libdw/c++/values.cc +++ b/libdw/c++/values.cc @@ -78,6 +78,7 @@ dwarf::attr_value::what_space () const switch (dwarf_whatform (thisattr ())) { case DW_FORM_flag: + case DW_FORM_flag_present: return VS_flag; case DW_FORM_addr: @@ -89,10 +90,13 @@ dwarf::attr_value::what_space () const case DW_FORM_block4: /* Location expression or target constant. */ possible = VS(location) | VS(constant); - if ((expected & possible) == possible) + if ((expected & possible) != possible) /* When both are expected, a block is a location expression. */ - return VS_location; - break; + break; + /* Fall through. */ + + case DW_FORM_exprloc: + return VS_location; case DW_FORM_data1: case DW_FORM_data2: @@ -108,8 +112,11 @@ dwarf::attr_value::what_space () const // If a constant is not expected, these can be *ptr instead. possible = (VS(dwarf_constant) | VS(constant) | VS(source_file) | VS(source_line) | VS(source_column)); - if ((expected & possible) == 0) - possible = VS(location) | VS(lineptr) | VS(macptr) | VS(rangelistptr); + if (expected & possible) + break; + + case DW_FORM_sec_offset: + possible = VS(location) | VS(lineptr) | VS(macptr) | VS(rangelistptr); break; case DW_FORM_string: @@ -124,8 +131,7 @@ dwarf::attr_value::what_space () const case DW_FORM_ref4: case DW_FORM_ref8: case DW_FORM_ref_udata: - possible = VS(reference); - break; + return VS_reference; default: throw std::runtime_error ("XXX bad form"); -- 2.47.3