On Wed, 2011-03-16 at 14:40 -0700, Roland McGrath wrote:
> I didn't do that, because I wanted the normal circularity
check to catch
> that. If we get a failure because of any circular reference,
> self-reference or not, it is probably is something we need to
> investigate. I cannot imagine when anything like that isn't some bug in
> the producer.
Well, that's what dwarflint is for. There is nothing algorithmically
difficult about handling direct self-reference in the hash function.
It exists in some data, whether by producer bug or not, so we have to
handle it. The kludge is just too ugly.
We cannot have ugly code :)
I added a dwarflint pass for it.
Attached and on the mjw/check_self_referential_die
Output of warning (on dwarfcmp, the problematic binary):
warning: .debug_info: DIE 0xed86a: attribute containing_type references DIE itself.
warning: .debug_info: DIE 0x1710eb: attribute containing_type references DIE itself.
Petr, if you think that is correct, I like to merge it to the dwarf
branch.
I removed the special DW_AT_containing_type case and just ignore all
self referential attribute values. Although I was tempted to just remove
it completely (since it is wrong, wrong, wrong).
It seems Dodji just posted a patch for gcc that might fix this issue by
properly outputting pointer-to-member-function. I haven't tried it yet
though.
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00949.html
It is used to get at the die_info_pair of a debug_info_entry in for
example get_die_info () from value::value_reference to access the
reference_hash of the die that it points to.
Cheers,
Mark
commit fab4929d16ea08b0929795d2cbd44f42cc161a0e
Author: Mark Wielaard <mjw(a)redhat.com>
Date: Thu Mar 17 12:46:06 2011 +0100
Workaround all self referential ref values, not just DW_AT_containing_type.
diff --git a/libdw/c++/dwarf_output b/libdw/c++/dwarf_output
index aeb192c..aab1598 100644
--- a/libdw/c++/dwarf_output
+++ b/libdw/c++/dwarf_output
@@ -1402,10 +1402,11 @@ namespace elfutils
= dynamic_cast<const entry *> (it->second._m_value);
if (ref != NULL)
{
- // Workaround weird case (bug?)
- //
https://fedorahosted.org/pipermail/elfutils-devel/2011-Februa
- if (it->first == DW_AT_containing_type
- && ref->_m_pending == this)
+ // Workaround weird cases of self-referential DIE.
+ // This really is a bug in the producer and dwarflint
+ // should warn about it. But it is easy to work around
+ // so just do it for now, by ignoring such values.
+ if (ref->_m_pending == this)
continue;
else
attr_rhashes ^= ref->get_reference_hash (stack);