Bug 18844 - assert failure in abidw at abg-dwarf-reader.cc:6537

The DWARF reader is not scheduling a declaration-only class for
resolution when the class has member types.  When reading the code of
build_class_type_and_add_to_ir(), we see that the scheduling is done
before getting out of the function.  But then, building members of the
class can trigger another invocation of
build_class_type_and_add_to_ir() before the current invocation
returns.  In that case, the declaration-only class being built appears
as not being scheduled for resolution.  And that is what violates the
assertion that declaration-only classes should be scheduled for
resolution whenever they are used.

This patch addresses the issue by scheduling the resolution earlier, when
we know we are dealing with a declaration-only class, and before
dealing with members of that classes.

	* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir):
	Schedule declaration-only class resolution before the class
	appears as usable as to other types being built.
	* tests/data/test-read-dwarf/test12-pr18844.so: Add a new binary
	test input.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: The reference
	ABI XML output for the binary above.
	* tests/data/Makefile.am: Add the new test inputs above to the
	source distribution.
	* tests/test-read-dwarf.cc (in_out_specs): Add the new test inputs
	above to the set of input this test harness has to run over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-08-18 12:33:57 +02:00
parent fce31333cb
commit ba5b4452d5
5 changed files with 44808 additions and 4 deletions

View File

@ -6469,14 +6469,12 @@ build_class_type_and_add_to_ir(read_context& ctxt,
}
ctxt.associate_die_to_type(dwarf_dieoffset(die), is_in_alt_di, result);
ctxt.maybe_schedule_declaration_only_class_for_resolution(result);
if (!has_child)
{
// TODO: set the access specifier for the declaration-only class
// here.
ctxt.maybe_schedule_declaration_only_class_for_resolution(result);
return result;
}
return result;
ctxt.die_wip_classes_map()[dwarf_dieoffset(die)] = result;

View File

@ -256,6 +256,8 @@ test-read-dwarf/test9-pr18818-clang.so.abi \
test-read-dwarf/test10-pr18818-gcc.so.abi \
test-read-dwarf/test11-pr18828.so \
test-read-dwarf/test11-pr18828.so.abi \
test-read-dwarf/test12-pr18844.so \
test-read-dwarf/test12-pr18844.so.abi \
\
test-diff-filter/test0-v0.cc \
test-diff-filter/test0-v1.cc \

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -110,6 +110,11 @@ InOutSpec in_out_specs[] =
"data/test-read-dwarf/test11-pr18828.so.abi",
"output/test-read-dwarf/test11-pr18828.so.abi",
},
{
"data/test-read-dwarf/test12-pr18844.so",
"data/test-read-dwarf/test12-pr18844.so.abi",
"output/test-read-dwarf/test12-pr18844.so.abi",
},
// This should be the last entry.
{NULL, NULL, NULL}
};