From: Roland McGrath Date: Fri, 2 Jul 2010 02:00:25 +0000 (-0700) Subject: Correct v4 form categorization on input. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb3081c9cdc8f2564c9dc185d378569dacd13564;p=thirdparty%2Felfutils.git Correct v4 form categorization on input. --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index b39bbf689..e4872780c 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2010-07-01 Roland McGrath + + * c++/values.cc (is_list, what_space): Handle v4 CU rules. + 2010-06-23 Roland McGrath * cfi.c (dwarf_cfi_validate_fde): Function removed. diff --git a/libdw/c++/values.cc b/libdw/c++/values.cc index e40fcaa28..851abf689 100644 --- a/libdw/c++/values.cc +++ b/libdw/c++/values.cc @@ -1,5 +1,5 @@ /* -*- C++ -*- interfaces for libdw. - Copyright (C) 2009 Red Hat, Inc. + Copyright (C) 2009-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -72,6 +72,7 @@ using namespace std; dwarf::value_space dwarf::attr_value::what_space () const { + const uint_fast16_t version = _m_attr.cu->version; unsigned int expected = expected_value_space (dwarf_whatattr (thisattr ()), _m_tag); unsigned int possible = 0; @@ -88,8 +89,11 @@ dwarf::attr_value::what_space () const case DW_FORM_block1: case DW_FORM_block2: case DW_FORM_block4: - /* Location expression or target constant. */ - possible = VS(location) | VS(constant); + /* Location expression in DWARF 3, or target constant. */ + possible = VS(constant); + if (version >= 4) + break; + possible |= VS(location); if ((expected & possible) != possible) /* When both are expected, a block is a location expression. */ break; @@ -109,10 +113,10 @@ dwarf::attr_value::what_space () const case DW_FORM_data4: case DW_FORM_data8: - // If a constant is not expected, these can be *ptr instead. + // If a constant is not expected, these can be *ptr instead in DWARF 3. possible = (VS(dwarf_constant) | VS(constant) | VS(source_file) | VS(source_line) | VS(source_column)); - if (expected & possible) + if (version >= 4 || (expected & possible)) break; case DW_FORM_sec_offset: @@ -559,6 +563,9 @@ dwarf::attr_value::location () const bool dwarf::location_attr::is_list () const { + if (_m_attr.thisattr ()->cu->version >= 4) + return dwarf_whatform (_m_attr.thisattr ()) == DW_FORM_sec_offset; + switch (dwarf_whatform (_m_attr.thisattr ())) { case DW_FORM_block: