libabigail/tests/data/test-read-dwarf/test23-first-tu.cc
Dodji Seketeli 8b2f4ac43f Support DW_TAG_type_unit
Type units sections are sections in which the compiler emits types
uniquely identified by a signature.  This is so that the linker can
later discard redundant types (types having the same signature) from
the debug info and thus reduce the overall size of debug info.

These types are children DIEs of DW_TAG_type_unit.

Because DIEs coming from that .debug_types section can have the same
offset as DIEs coming from the .debug_info section, this patch defines
a new DIE source to identify DIEs coming from .debug_types section.
The name of that new source is the new TYPE_UNIT_DIE_SOURCE enumerator
of the die_source enum.  The patch also creates the necessary maps
containing DIEs coming from this new source and adjusts the
accompanying accessors accordingly.

	* src/abg-dwarf-reader.cc (TYPE_UNIT_DIE_SOURCE): New enumerator
	in enum die_source.
	(read_context::{type_unit_die_decl_map_, type_unit_die_type_map_,
	type_unit_die_wip_classes_map_,
	type_unit_die_wip_function_types_map_,
	type_unit_types_to_canonicalize_,
	type_units_tu_die_imported_unit_points_map_,
	type_section_die_parent_map_}): New data members.
	(read_context::{get_die_source, associate_die_to_decl,
	lookup_decl_from_die_offset, die_type_map, clear_die_type_maps,
	die_wip_classes_map, die_wip_function_types_map,
	types_to_canonicalize, clear_types_to_canonicalize,
	tu_die_imported_unit_points_map, die_parent_map}): Support
	TYPE_UNIT_DIE_SOURCE.
	(get_parent_die, get_scope_for_die): Likewise.
	(read_context::{lookup_decl_from_type_unit_die_offset,
	type_section_die_parent_map}): Define new member functions.
	(read_context::build_die_parent_maps): Build a DIE -> parent map
	for DIEs coming from the .debug_types section.
	* tests/data/test-read-dwarf/libtest23.so: New test input.
	* tests/data/test-read-dwarf/libtest23.so.abi: New reference output.
	* tests/data/test-read-dwarf/test23-first-tu.cc: Source code of
	the new binary above.
	* tests/data/test-read-dwarf/test23-second-tu.cc: Likewise.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-read-dwarf.cc (in_out_specs): Make this test harness
	execute over the new test input and reference output.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-26 20:07:03 +02:00

16 lines
357 B
C++

// Compile with:
// g++ -g -Wall -c -fPIC -fdebug-types-section test23-first-tu.cc
// g++ -g -Wall -c -fPIC -fdebug-types-section test23-second-tu.cc
// g++ -g -shared -fuse-ld=gold -o libtest23.so test23-first-tu.o test23-second-tu.o
#include <string>
#include <iostream>
using std::cout;
using std::string;
void
emit(string& s)
{
cout << s << "\n";
}