]> git.ipfire.org Git - thirdparty/elfutils.git/commit
Fix bug using dwarf_next_unit to iterate over .debug_types
authorTom Tromey <tromey@redhat.com>
Wed, 21 Mar 2012 14:54:32 +0000 (08:54 -0600)
committerMark Wielaard <mjw@redhat.com>
Wed, 21 Mar 2012 15:32:47 +0000 (16:32 +0100)
commit581c3f60e2b1fc7ddaf4260bb5a9cb59f8e3f0d0
treeb56cf7ffba1cf97c14e7546029a1fb07e2b53ab7
parent30bb714e7446d35d15cd53b3c794dd8ac08d0a29
Fix bug using dwarf_next_unit to iterate over .debug_types

* libdw_findcu.c (findcu_cb): Move earlier.
(__libdw_intern_next_unit): Add new CU to search tree here...
(__libdw_findcu): ... not here.

* typeiter.c: New file.
* run-typeiter.sh: New file.
* testfile59.bz2: New file.
* Makefile.am (noinst_PROGRAMS): Add typeiter.
(TESTS): Add run-typeiter.sh.
(EXTRA_DIST): Add run-typeiter.sh, testfile59.bz2.
(typeiter_LDADD): New variable.

If you call dwarf_next_unit to iterate over .debug_types, then call
dwarf_offdie_types, you can see a failure if some earlier call
happened to call __libdw_intern_next_unit via dwarf_formref_die.

What happens is that __libdw_intern_next_unit updates the Dwarf's
next_tu_offset, but does not add the TU to the TU search tree.  So,
the call to dwarf_offdie_types does not find the TU in the tree, and
will not search any more, causing a failure.

This fix changes __libdw_intern_next_unit to add the TU to the search
tree, rather than relying on __libdw_findcu to do it.
libdw/ChangeLog
libdw/libdw_findcu.c
tests/ChangeLog
tests/Makefile.am
tests/run-typeiter.sh [new file with mode: 0755]
tests/testfile59.bz2 [new file with mode: 0755]
tests/typeiter.c [new file with mode: 0644]