From a455dd35b49e8a592605d6d63031b2e2ca01bd39 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 24 Feb 2011 14:40:44 -0800 Subject: Put the slow dwarfcmp tests last. --- tests/ChangeLog | 4 ++++ tests/Makefile.am | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index a00733f7..8a39c5bf 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2011-02-24 Roland McGrath + + * Makefile.am (TESTS): Put the slow dwarfcmp tests last. + 2011-02-02 Josh Stone * run-prelink-addr-test.sh: Add testfile55, 32 and 64-bit. diff --git a/tests/Makefile.am b/tests/Makefile.am index 616f900f..a33e0521 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -87,9 +87,11 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \ run-disasm-x86.sh run-disasm-x86-64.sh \ run-early-offscn.sh run-dwarf-getmacros.sh \ - run-dwarfcmp-self.sh run-dwarflint-self.sh run-dwarf-attributes.sh \ - run-dwarf_edit.sh dwarf_edit_output run-dwarfcmp-test-self.sh \ - run-test-flag-nobits.sh run-prelink-addr-test.sh + run-dwarf-attributes.sh \ + run-dwarf_edit.sh dwarf_edit_output \ + run-test-flag-nobits.sh run-prelink-addr-test.sh \ + run-dwarflint-self.sh \ + run-dwarfcmp-self.sh run-dwarfcmp-test-self.sh # run-show-ciefde.sh if !STANDALONE -- cgit v1.2.1 From 2cd13586ef3479b6ae2fe60486d6043f04b68af4 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 24 Feb 2011 15:11:58 -0800 Subject: Fix dwarf_path_finder::jump for the general case. --- libdw/c++/dwarf_tracker | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/libdw/c++/dwarf_tracker b/libdw/c++/dwarf_tracker index 07317ca2..917502c3 100644 --- a/libdw/c++/dwarf_tracker +++ b/libdw/c++/dwarf_tracker @@ -257,7 +257,6 @@ namespace elfutils assert (_m_tracker->_m_path.empty ()); assert (_m_tracker->_m_steps_taken == 0); assert (_m_tracker->_m_walkahead == NULL); - ::Dwarf_Off cu_offset = (*root).offset (); cu_offset = cu_offset; _m_tracker->_m_root = root; } @@ -301,12 +300,41 @@ namespace elfutils inline void prime_path_to (const typename dw::debug_info_entry &there) { - /* Since we can only used on a cloned tracker, _m_steps_taken - counting does not matter. */ - assert (_m_owner != NULL); - assert (this != _m_owner->_m_walkahead); - assert (at_top ()); - _m_path = path_to (there); + if (_m_owner != NULL) + { + /* Since this is a cloned tracker, + _m_steps_taken counting does not matter. */ + assert (this != _m_owner->_m_walkahead); + _m_path = path_to (there); + } + else + { + /* Spin the walk ahead until we get THERE. */ + const dwarf::debug_info_entry::identity_type id = there.identity (); + if (_m_seen->find (id) != _m_seen->end ()) + { + /* We're walking backwards now. We have to repeat the + whole walk to recover our _m_steps_taken state correctly. */ + _m_path.clear (); + clear_walk (); + } + + if (at_top ()) + { + /* We have to get the walk started. */ + const die first = (*_m_root).children ().begin (); + if (first == (*_m_root).children ().end ()) + unreachable (there); // Empty CU! + + step_forward (first); + if ((*first).identity () == id) + return; + } + + /* We have not walked past it yet, so just keep walking. */ + if (! walk_to (id)) + unreachable (there); + } } // Random access to a DIE, find the path of the walk that gets there. -- cgit v1.2.1 From 2b5a3e13064be99a415c173422a06a6b77623bda Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 24 Feb 2011 15:25:43 -0800 Subject: Make libdwP.h internal declarations C++-compatible. --- libdw/ChangeLog | 4 ++++ libdw/libdwP.h | 21 +++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 1b85aebf..35baf27c 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2011-02-24 Roland McGrath + + * libdwP.h: Make declarations C++-compatible using __BEGIN_DECLS. + 2011-02-23 Roland McGrath * c++/dwarf-knowledge.cc (expected_value_space): diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 8d49f501..58f3f908 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -1,5 +1,5 @@ /* Internal definitions for libdwarf. - Copyright (C) 2002-2010 Red Hat, Inc. + Copyright (C) 2002-2011 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -353,6 +353,8 @@ struct Dwarf_Macro_s }; +__BEGIN_DECLS + /* We have to include the file at this point because the inline functions access internals of the Dwarf structure. */ #include "memory-access.h" @@ -471,7 +473,6 @@ extern Dwarf_Die *__libdw_offdie (Dwarf *dbg, Dwarf_Off offset, extern int __dwarf_errno_internal (void); -#ifndef __cplusplus /* Reader hooks. */ /* Relocation hooks return -1 on error (in that case the error code @@ -535,8 +536,10 @@ __libdw_in_section (Dwarf *dbg, int sec_index, Elf_Data *data = __libdw_checked_get_data (dbg, sec_index); if (data == NULL) return false; - if (unlikely (addr < data->d_buf) - || unlikely (data->d_size - (addr - data->d_buf) < size)) + if (unlikely ((const char *) addr < (const char *) data->d_buf) + || unlikely (data->d_size - ((const char *) addr + - (const char *) data->d_buf) + < size)) { __libdw_seterrno (DWARF_E_INVALID_OFFSET); return false; @@ -615,11 +618,10 @@ int __libdw_read_begin_end_pair_inc (Dwarf *dbg, int sec_index, Dwarf_Addr *basep) internal_function; -unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index, - int err_nodata, unsigned char **endpp, - Dwarf_Off *offsetp) +unsigned char *__libdw_formptr (Dwarf_Attribute *attr, int sec_index, + int err_nodata, unsigned char **endpp, + Dwarf_Off *offsetp) internal_function; -#endif /* Not C++ */ static inline size_t cu_sec_idx (struct Dwarf_CU *cu) @@ -634,6 +636,9 @@ cu_data (struct Dwarf_CU *cu) } +__END_DECLS + + /* Aliases to avoid PLTs. */ INTDECL (dwarf_aggregate_size) INTDECL (dwarf_attr) -- cgit v1.2.1 From e15999014144beb60698d524612567a16f3581de Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 24 Feb 2011 15:33:47 -0800 Subject: Temporarily export __libdw_formptr for use by C++ code. --- libdw/ChangeLog | 3 +++ libdw/libdw.map | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 35baf27c..704dc116 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,8 @@ 2011-02-24 Roland McGrath + * libdw.map (ELFUTILS_PRIVATE_TMP): New version set; + add __libdw_formptr. + * libdwP.h: Make declarations C++-compatible using __BEGIN_DECLS. 2011-02-23 Roland McGrath diff --git a/libdw/libdw.map b/libdw/libdw.map index 1f71d03b..440daf96 100644 --- a/libdw/libdw.map +++ b/libdw/libdw.map @@ -254,3 +254,9 @@ ELFUTILS_0.149 { dwfl_dwarf_line; } ELFUTILS_0.148; + +# This will go away when we figure out the C++ exports. +ELFUTILS_PRIVATE_TMP { + global: + __libdw_formptr; +}; -- cgit v1.2.1 From cda1196d5d8b0e40013c9012967dbba7e8549f78 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 25 Feb 2011 13:04:21 +0100 Subject: Merge over dwarf string fixes from readelf master to dwarfstrings. * src/dwarfstrings.c (dwarf_tag_string): Add type_unit, rvalue_reference_type and template_alias. (dwarf_tag_string): Add GNU_* tags. (dwarf_attr_string): Add signature, main_subprogram, const_expr and enum_class. --- src/dwarfstrings.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/dwarfstrings.c b/src/dwarfstrings.c index b340f026..3909e131 100644 --- a/src/dwarfstrings.c +++ b/src/dwarfstrings.c @@ -97,6 +97,9 @@ dwarf_tag_string (unsigned int tag) [DW_TAG_mutable_type] = "mutable_type", [DW_TAG_condition] = "condition", [DW_TAG_shared_type] = "shared_type", + [DW_TAG_type_unit] = "type_unit", + [DW_TAG_rvalue_reference_type] = "rvalue_reference_type", + [DW_TAG_template_alias] = "template_alias", }; const unsigned int nknown_tags = (sizeof (known_tags) / sizeof (known_tags[0])); @@ -126,6 +129,26 @@ dwarf_tag_string (unsigned int tag) result = "class_template"; break; + case DW_TAG_GNU_BINCL: + result = "GNU_BINCL"; + break; + + case DW_TAG_GNU_EINCL: + result = "GNU_EINCL"; + break; + + case DW_TAG_GNU_template_template_param: + result = "GNU_template_template_param"; + break; + + case DW_TAG_GNU_template_parameter_pack: + result = "GNU_template_parameter_pack"; + break; + + case DW_TAG_GNU_formal_parameter_pack: + result = "GNU_formal_parameter_pack"; + break; + default: if (tag < DW_TAG_lo_user) snprintf (buf, sizeof buf, gettext ("unknown tag %hx"), tag); @@ -233,6 +256,11 @@ dwarf_attr_string (unsigned int attrnum) [DW_AT_elemental] = "elemental", [DW_AT_pure] = "pure", [DW_AT_recursive] = "recursive", + [DW_AT_signature] = "signature", + [DW_AT_main_subprogram] = "main_subprogram", + [DW_AT_data_bit_offset] = "data_bit_offset", + [DW_AT_const_expr] = "const_expr", + [DW_AT_enum_class] = "enum_class", [DW_AT_linkage_name] = "linkage_name", }; const unsigned int nknown_attrs = (sizeof (known_attrs) -- cgit v1.2.1 From 25f3fc402dd643ae8b269c76afc842e3d2765633 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 25 Feb 2011 13:45:14 +0100 Subject: Don't use dwarf_tag_string, but dwarf::tags::name for dwarf_edit_output test. --- tests/Makefile.am | 3 +-- tests/dwarf_edit_output.cc | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index a33e0521..641bce2e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -214,8 +214,7 @@ dwarf_print_LDADD = $(libdwpp) $(libmudflap) -ldl dwarf_edit_SOURCES = dwarf_edit.cc print-die.cc dwarf_edit_LDADD = $(libdwpp) $(libmudflap) -ldl -dwarf_edit_output_SOURCES = dwarf_edit_output.cc print-die.cc \ - ../src/dwarfstrings.c +dwarf_edit_output_SOURCES = dwarf_edit_output.cc print-die.cc dwarf_edit_output_LDADD = $(libdwpp) $(libmudflap) -ldl arextract_LDADD = $(libelf) $(libmudflap) diff --git a/tests/dwarf_edit_output.cc b/tests/dwarf_edit_output.cc index b1483d19..7e3def94 100644 --- a/tests/dwarf_edit_output.cc +++ b/tests/dwarf_edit_output.cc @@ -37,8 +37,6 @@ #include "c++/subr.hh" -#include "../src/dwarfstrings.h" - using namespace elfutils; using namespace std; @@ -520,7 +518,7 @@ test_last_two_dies (dwarf_edit &in, dwarf_output &out, int tag, bool same, cmp compare; if (compare.compare_dies (*die1, *die2, in) != same) error (-1, 0, "dwarf_comparator fail %s test #%d '%s'", - dwarf_tag_string (tag), n, name); + dwarf::tags::name (tag).c_str (), n, name); } dwarf_output::compile_units_type::const_iterator cu; @@ -537,7 +535,7 @@ test_last_two_dies (dwarf_edit &in, dwarf_output &out, int tag, bool same, it++; } if (show_output) - cout << "offset last (" << dwarf_tag_string (tag) << ") cu1: " + cout << "offset last (" << dwarf::tags::name (tag) << ") cu1: " << hex << off1 << endl; cu++; @@ -549,14 +547,14 @@ test_last_two_dies (dwarf_edit &in, dwarf_output &out, int tag, bool same, it++; } if (show_output) - cout << "offset last (" << dwarf_tag_string (tag) << ") cu2: " + cout << "offset last (" << dwarf::tags::name (tag) << ") cu2: " << hex << off2 << endl; bool both_zero = off1 == 0 && off2 == 0; bool equal = off1 == off2; if (! both_zero && equal != same) error (-1, 0, "dwarf_comparator fail %s test #%d '%s'", - dwarf_tag_string (tag), n, name); + dwarf::tags::name (tag).c_str (), n, name); } -- cgit v1.2.1