18186 - Assertion in abigail::ir::class_decl:#️⃣:operator()

When the DIE of a class has its 'byte_size' property set, it means the
class is complete, even if the 'declaration' property is set to true
on it.  The DWARF reader was not honouring this in all cases and
sometimes some classes were unduly considered as non-complete.  The
binary the problem was exhibited on was generated by llvm.

This patch fixes that.

I couldn't produce a binary with similar DWARF output, so this patch
doesn't have a regression test associated to it :( I guess at some
point we should have another git repository with binaries and an
associated test harness, in which we'd stash binaries for which we
haven't wrote the sources ourselves.

	* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): When
	the size of the class is provided then the class is complete, no
	matter if this function called to update the class or to build it
	for the first time.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-04-01 09:43:44 +02:00
parent 388f990681
commit 8e2b0c2f10

View File

@ -6260,11 +6260,6 @@ build_class_type_and_add_to_ir(read_context& ctxt,
if (klass)
{
res = result = klass;
if (size)
{
result->set_size_in_bits(size);
result->set_is_declaration_only(false);
}
result->set_location(loc);
}
else
@ -6280,6 +6275,12 @@ build_class_type_and_add_to_ir(read_context& ctxt,
assert(result);
}
if (size)
{
result->set_size_in_bits(size);
result->set_is_declaration_only(false);
}
ctxt.associate_die_to_type(dwarf_dieoffset(die), is_in_alt_di, result);
if (!has_child)