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.
diff --git a/tests/ChangeLog b/tests/ChangeLog
index a782591..8d2b83f 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,13 @@
+2012-03-21 Tom Tromey <tromey@redhat.com>
+
+ * 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.
+
2012-02-21 Kurt Roeckx <kurt@roeckx.be>
* run-alldts.sh: testrun ./alldts.