diff options
author | Mark Wielaard <mjw@redhat.com> | 2011-02-25 13:50:10 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2011-02-25 13:50:10 +0100 |
commit | 0beedcfcbb94c334e63430c10157a63dd9606e5f (patch) | |
tree | 86f14d71ed2399fa2ca064128b7b6ee0ccd31a6b | |
parent | 9ee5559ff57d5566f533d3d77e58988aad2da71d (diff) | |
parent | 25f3fc402dd643ae8b269c76afc842e3d2765633 (diff) | |
download | elfutils-0beedcfcbb94c334e63430c10157a63dd9606e5f.tar.gz |
Merge branch 'dwarf' into mjw/dwarf_outputmjw/dwarf_output
-rw-r--r-- | libdw/ChangeLog | 7 | ||||
-rw-r--r-- | libdw/c++/dwarf_tracker | 42 | ||||
-rw-r--r-- | libdw/libdw.map | 6 | ||||
-rw-r--r-- | libdw/libdwP.h | 19 | ||||
-rw-r--r-- | tests/ChangeLog | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 11 | ||||
-rw-r--r-- | tests/dwarf_edit_output.cc | 10 |
7 files changed, 74 insertions, 25 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog index d9f743e0..7fb6eb00 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,10 @@ +2011-02-24 Roland McGrath <roland@redhat.com> + + * 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 <roland@redhat.com> * c++/dwarf-knowledge.cc (expected_value_space): 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. 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; +}; diff --git a/libdw/libdwP.h b/libdw/libdwP.h index a58d0665..0baa0e38 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -358,6 +358,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" @@ -482,7 +484,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 @@ -546,8 +547,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; @@ -626,11 +629,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) @@ -645,6 +647,9 @@ cu_data (struct Dwarf_CU *cu) } +__END_DECLS + + /* Aliases to avoid PLTs. */ INTDECL (dwarf_aggregate_size) INTDECL (dwarf_attr) 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 <roland@redhat.com> + + * Makefile.am (TESTS): Put the slow dwarfcmp tests last. + 2011-02-02 Josh Stone <jistone@redhat.com> * run-prelink-addr-test.sh: Add testfile55, 32 and 64-bit. diff --git a/tests/Makefile.am b/tests/Makefile.am index 616f900f..641bce2e 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 @@ -212,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); } |