The Git repository of the Libabigail Project
Go to file
Dodji Seketeli 843de38b6c Read abixml as a whole file and fix lots discrepancies with dwarf
Forcing each TU to be read in a self contained way was a mistake
because it introduces differences with how DWARF is represented.  In
DWARF, types need to be reconciled at the DSO level. I.e, some types
that are only declared in some TUs are to be defined later in other
TUs.  So abixml needs to reflect that, otherwise, some types read from
abixml might wrongly appear to be different from the same type read
from DWARF.

But then we need to be able to use a type (refer to its type id)
before defining it later.  That means, we need to read the abixml file
in, as a whole.  Rather than walking it with a cursor like we used to
do.

This patch does that.  That implies to be able to build (on-demand)
an entire translation unit, just because we refer to a type that is
inside that TU.

The patch also fixes some ancillary issues that are related or
uncovered by this "whole-corpus" way of seeing things; these issues were
causing type hashing differences with what the DWARF reader does.

	* src/abg-reader.cc (class read_context): Move data member at
          the top of the class like what is done elsewhere in the code
          base.
	(read_context::m_corp_node): New data member.
	(read_context::read_context): Initialize it.
	(read_context::{get,set}_corpus_node): New accessors.
	(read_context::map_id_and_node): Accept that a node id previously
	defined is defined again.  In that case we just remember the first
	mapping id -> xml-node.  That seems to work for now.
	(read_context::get_translation_unit): Fix the logic.
	(read_context::m_wip_types_map): Rename
	read_context::m_wip_classes_map into this.
	(read_context::clear_wip_types_map): Rename
	read_context::clear_wip_classes into this.
	(read_context::mark_type_as_wip): Rename
	read_context::mark_class_as_wip into this.
	(read_context::unmark_type_as_wip): Rename
	read_context::unmark_type_as_wip into this.
	(read_context::is_wip_type): Rename read_context::is_wip_class
	into this.
	(read_context::types_equal): New member function.
	(read_context::clear_per_translation_unit_data): Do not clear
	anything anymore as the previous data that were per-tu are now
	per-corpus.
	(read_context::clear_per_corpus_data): Clear here the previous
	data that were per-tu.
	(read_context::maybe_canonicalize_type): Add a new force_delay
	flag that forces the type to be late-canonicalized.  Also force
	late-canonicalize references, pointers, qualified-type and typedef
	because they must be canonicalized once they've been added to
	their context; but then this function might be called too early,
	before they are added to their context.
	(read_context::type_id_new_in_translation_unit): Remove this
	member function.
	(read_translation_unit_from_input): Be able to either use the
	xmlTextReader interface, or get the current 'abi-instr' xml
	element node.  If using the xmlTextReader interface, use it to
	move to the 'abi-instr' node, expand it and then use that.  In
	either case, call read_translation_unit() with the 'abi-instr' xml
	element node.
	(read_translation_unit): Take an 'abi-instr' XML element in
	argument now, use that to read the translation unit, as opposed to
	using the xmlTextReader interface we where using before to walk
	the sub-tree of the abi-instr xml node.
	(read_context::get_scope_for_node): If the scope is a new
	translation unit, then build the new translation unit.
	(read_symbol_db_from_input): Take the function and variable symbol
	data bases, and read the current xml element node (do not use the
	xmlTextReader interface anymore) to populate the function and
	variable symbols.
	(read_elf_needed_from_input): Do not use the xmlTextReader
	interface anymore.  Rather, use the current xml element node, look
	for the 'elf-needed' xml element node and use it to populate the
	set of elf dependencies.
	(read_corpus_from_input): Rework to expand the contents of the
	corpus node and use the result, rather than just exclusively
	relying on the xmlTextReader interface.
	(build_function_parameter): Build a proper IR node for variadic
	parameters.  Build function type node *after* having built all the
	parameters IR, so that parameter indexing is the same as what is
	done in the DWARF reader.  Also, if the function is not being
	added to its context yet, then delay the canonicalizing of its
	type, just like what is done by the DWARF reader.
	(build_qualified_type_decl, build_pointer_type_def)
	(build_reference_type_def, build_enum_type_decl, build_type_decl):
	Adjust.  Do not enforce anymore that the ID of this type be new in
	the current TU.  Delay canonicalizing if the type is not being
	added to its context.  For typedefs, use an adapted way of
	checking the consistency of the underlying type.
	(build_array_type_def): Do not enforce anymore that the ID of this
	type be new in the current TU.  Support the fact that the array
	might not have any DW_AT_byte_size attribute.  Force late
	canonicalizing if the array is not being added to its context.
	(build_class_decl): Adjust.  Reuse the
	read_context::maybe_canonicalize_type() function rather than
	trying to determine locally when to canonicalize.
	(build_template_tparameter): Adjust

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-29 16:23:15 +02:00
doc Add a --stats to abidiff and abidw 2015-08-20 13:25:42 +02:00
include Fix template comparison operators 2015-08-29 16:23:15 +02:00
m4 Delete ltsugar.m4 and pkg.m4 files from m4/ 2015-01-06 09:54:45 +01:00
scripts Initial DOT work. 2013-07-23 23:13:55 +02:00
src Read abixml as a whole file and fix lots discrepancies with dwarf 2015-08-29 16:23:15 +02:00
tests Misc style cleanups 2015-08-22 14:32:20 +02:00
tools Misc style cleanups 2015-08-22 14:32:20 +02:00
.gitignore Update .gitignore 2014-11-01 12:10:06 +01:00
abigail.m4 For usage from within GCC set header path to $includedir/libabigail 2013-08-14 16:10:15 +02:00
AUTHORS Initial AUTHORS and README 2013-02-28 13:25:20 +01:00
ChangeLog Update ChangeLog file 2015-06-25 08:13:21 +02:00
COMMIT-LOG-GUIDELINES Allow introductory text in commit log and ignore it when generating ChangeLog 2014-11-18 23:18:06 +01:00
COMPILING White space fix in COMPILING 2013-08-22 17:40:50 +02:00
config.h.in Make abipkgdiff compare tar archives containing binaries 2015-08-22 14:32:20 +02:00
configure.ac Misc style cleanups 2015-08-22 14:32:20 +02:00
CONTRIBUTING Update the CONTRIBUTING file 2015-03-19 12:47:59 +01:00
COPYING Use a better wording for the COPYING file 2015-04-22 09:53:18 +02:00
COPYING-GPLV3 Update licence texts 2015-04-20 13:51:21 +02:00
COPYING-LGPLV2 Initial import of gen-changelog.py 2014-11-18 23:18:06 +01:00
COPYING-LGPLV3 LGPLv3 License the library 2013-07-23 23:13:55 +02:00
gen-changelog.py [gen-changelog] Make subject line always come first 2014-11-18 23:18:06 +01:00
install-sh Add missing autoconfiscation files into version control 2013-03-01 00:47:49 +01:00
libabigail.pc.in Make libxml2 a private dependency wrt pkconfig 2013-08-22 17:41:29 +02:00
ltmain.sh Add missing autoconfiscation files into version control 2013-03-01 00:47:49 +01:00
Makefile.am Update licence texts 2015-04-20 13:51:21 +02:00
README Prepare for publishing 2013-07-23 23:13:55 +02:00
test21-type-suppr-0.suppr Pimplify abigail::comparison::diff type 2014-09-19 12:28:18 +02:00
test21-type-suppr-report-0.txt Pimplify abigail::comparison::diff type 2014-09-19 12:28:18 +02:00

This is the Application Binary Interface Generic Analysis and
Instrumentation Library.

It aims at constructing, manipulating, serializing and de-serializing
ABI-relevant artifacts.

The set of artifacts that we are intersted is made of quantities like
types, variable, fonctions and declarations of a given library or
program.  For a given library or program this set of quantities is
called an ABI corpus.

This library aims at (among other things) providing a way to comparing
two ABI Corpuses, provide detailed information about their
differences, and help build tools to infer interesting conclusions
about these differences.

You are welcome to contribute to this project after reading the files
CONTRIBUTING and COMMIT-LOG-GUIDELINES files in the source tree.

Communicating with the maintainers of this project -- including
sending patches to be include to the source code -- happens via email
at libabigail@sourceware.org.