mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-22 16:56:57 +00:00
reader: Fix corpus group reading
Reading of corpus group is broken in the ABIXML reader. Only the main corpus is read and then, abixml::reader::read_corpus_group_from_input fails to read subsequent corpora. This patch fixes abixml::reader::read_corpus_group_from_input and makes it call a new abixml::reader::initialize function, much like what the ELF based readers are doing. * src/abg-fe-iface.cc (fe_iface::priv::initialize): Do not clear the corpus group upon initialization. * src/abg-reader.cc (reader::initialize): Define new function. Make it call fe_iface::initialize. (reader::clear_per_corpus_data): Remove. (reader::read_corpus): Remove call to clear_per_corpus_data. (reader::read_corpus_group_from_input): After calling reader::read_corpus and adding the resulting corpus to the group, get the next sibling XML element node. If it's an "abi-corpus" node then re-initialize the reader by invoking the new reader::initialize and move on to read it by invoking reader::read_corpus again. * tests/data/test-diff-suppr/test45-abi-report-1.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
a08a60fcd9
commit
960d3c2d56
@ -46,7 +46,6 @@ struct fe_iface::priv
|
||||
corpus_path.clear();
|
||||
dt_soname.clear();
|
||||
suppressions.clear();
|
||||
corpus_group.reset();
|
||||
corpus.reset();
|
||||
}
|
||||
}; //end struct fe_iface::priv
|
||||
|
@ -187,6 +187,22 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/// The initializer of the reader.
|
||||
///
|
||||
/// Resets the reader so that it can be re-used to read another
|
||||
/// binary and build a corpus that is part of the same corpus group.
|
||||
///
|
||||
/// In other words, the same reader is used to analyse all the
|
||||
/// binaries that are part of the same corpus group.
|
||||
///
|
||||
/// @param corpus_path the new corpus path.
|
||||
void
|
||||
initialize(const string& corpus_path)
|
||||
{
|
||||
fe_iface::initialize(corpus_path);
|
||||
clear_types_to_canonicalize();
|
||||
}
|
||||
|
||||
/// Test if logging was requested.
|
||||
///
|
||||
/// @return true iff logging was requested.
|
||||
@ -888,18 +904,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/// Clear all the data that must absolutely be cleared at the end of
|
||||
/// the parsing of an ABI corpus.
|
||||
void
|
||||
clear_per_corpus_data()
|
||||
{
|
||||
clear_type_map();
|
||||
clear_types_to_canonicalize();
|
||||
clear_xml_node_decl_map();
|
||||
clear_id_xml_node_map();
|
||||
clear_decls_stack();
|
||||
}
|
||||
|
||||
#ifdef WITH_DEBUG_SELF_COMPARISON
|
||||
/// Perform a debugging routine for the "self-comparison" mode.
|
||||
///
|
||||
@ -1177,9 +1181,6 @@ public:
|
||||
get_environment().set_self_comparison_debug_input(corpus());
|
||||
#endif
|
||||
|
||||
if (!corpus_group())
|
||||
clear_per_corpus_data();
|
||||
|
||||
ir::corpus& corp = *corpus();
|
||||
|
||||
corp.set_origin(corpus::NATIVE_XML_ORIGIN);
|
||||
@ -1237,9 +1238,6 @@ public:
|
||||
get_environment().set_self_comparison_debug_input(corpus());
|
||||
#endif
|
||||
|
||||
if (!corpus_group())
|
||||
clear_per_corpus_data();
|
||||
|
||||
ir::corpus& corp = *corpus();
|
||||
corp.set_origin(corpus::NATIVE_XML_ORIGIN);
|
||||
|
||||
@ -2310,7 +2308,14 @@ read_corpus_group_from_input(fe_iface& iface)
|
||||
corpus_sptr corp;
|
||||
fe_iface::status sts;
|
||||
while ((corp = rdr.read_corpus(sts)))
|
||||
rdr.corpus_group()->add_corpus(corp);
|
||||
{
|
||||
rdr.corpus_group()->add_corpus(corp);
|
||||
node = xmlNextElementSibling(node);
|
||||
if (!node || !xmlStrEqual(node->name, BAD_CAST("abi-corpus")))
|
||||
break;
|
||||
rdr.initialize("");
|
||||
rdr.set_corpus_node(node);
|
||||
}
|
||||
|
||||
xmlTextReaderNext(reader.get());
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function
|
||||
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
|
||||
Functions changes summary: 0 Removed (142 filtered out), 0 Changed (1 filtered out), 0 Added functions
|
||||
Variables changes summary: 0 Removed (1 filtered out), 0 Changed, 0 Added variable
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user