* include/abg-dwarf-reader.h (enum status): New enum.
(read_corpus_from_elf): Return an instance of status above, and
return the corpus by parameter.
* src/abg-dwarf-reader.cc (create_default_dwfl): Add a comment
about elfutils wanting the Dwfl_Callbacks::debuginfo_path to be an
absolute path.
(read_corpus_from_elf): Return an instance of status above, and
return the corpus by parameter.
* tools/abg-tools-utils.h (make_path_absolute): Declare new function.
* tools/abg-tools-utils.cc (make_path_absolute): New
implementation.
* tools/bidiff.cc (options::di_root_path[12]): Make these be
shared pointers.
(parse_command_line): ensure the debug info root paths are
absolute.
(main): Adjust. Give meaningful errors when the debug info or
symbol files couldn't be read.
* tools/bidw.cc (options::di_root_path): Make this be a shared
pointer.
(parse_command_line): Ensure the debug info root path is absolute.
(main): Adjust. Give meaningful errors when the debug info or
symbol files couldn't be read.
* tools/bilint.cc (options::di_root_path): Make this be a shared
pointer.
(parse_command_line): Ensure the debug info root path is absolute.
(main): Adjust. Give meaningful errors when the debug info or
symbol file couldn't be read.
* tests/test-diff-dwarf.cc (main): Adjust.
* tests/test-read-dwarf.cc (main): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-dwarf-reader.h (read_corpus_from_elf): Take a
debug_info_root_path parameter.
src/abg-dwarf-reader.cc (create_default_dwfl): Take a
debug_info_root_path. Use that to initialize the Dwfl_Callbacks
structure used by dwfl_begin.
(create_default_dwfl_sptr, read_corpus_from_elf): Likewise, Take a
debug_info_root_path parameter.
* tests/test-diff-dwarf.cc (main): Adjust.
* tests/test-read-dwarf.cc (main): Likewise.
* tools/bidiff.cc (options::dir_root_path[12]): New member.
(options::options): Initialize it.
(display_usage): Add help string for the --debug-info-dir[12]
options.
(parse_command_line): Handle the new --debug-info-dir[12] options.
(main): Pass the debug info directories to read_corpus_from_elf.
* bidw.cc (options::::di_root_path): New member.
(options::options): Initialize it.
(display_usage): Add help string for the new --debug-info-dir
option.
(parse_command_line): Handle the new --debug-info-dir.
(main): Pass the debug info root path to read_corpus_from_elf.
* tools/bilint.cc (options::di_root_path): New member.
(options::options): Initialize it.
(display_usage): Add help string for the new --debug-info-dir.
(parse_command_line): Handle --debug-info-dir command line option.
(main): Pass the debug info root path to read_corpus_from_elf.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/bilint.cc (options::options): Initialize ...
(options::{diff, bidiff}): ... new members.
(display_usage): Update the display usage string for --diff &
--bidiff options.
(parse_command_line): Support the --diff and --bidiff options.
(main): Require the --diff option to actually diff the emitted
output with input. Make --noout really work for when reading
from dwarf.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-reader.cc (read_context::clear_type_map): New member
function.
(read_translation_unit_from_input): Read up to the next element
node if we are not on an element node already. Clear the type
map. Realize that we might be on the next 'abi-instr' node upon
completion.
(read_corpus_from_input): Read up to the next element node if we
are not on an element node already. It must be an "abi-corpus"
node. THen Advance to the next 'abi-instr' element node before
handing it to read_translation_unit_from_input.
* src/abg-writer.cc (write_context::clear_type_id_map): New member
function.
(write_translation_unit): Call it.
* tools/abg-tools-utils.cc (guess_file_type): Read enough bytes to
detect abi-corpus files magic bytes.
* tools/bilint.cc (main): Do not write the corpus file to the
output stream if --noout has been provided.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-reader.h (read_corpus_from_native_xml)
(read_corpus_from_native_xml_file): Declare new entry points.
* include/abg-writer.h (write_corpus_to_native_xml)
(write_corpus_to_native_xml_file): Likewise.
* src/abg-reader.cc (read_translation_unit_from_input): Renamed
read_input into this. Support new 'path' attribute for
'abi-instr' XML element.
(read_corpus_from_input): New static function.
(read_translation_unit_from_file)
(read_translation_unit_from_buffer)
(read_translation_unit_from_istream): Update wrt read_input ->
read_translation_unit_from_input.
(read_corpus_from_native_xml, read_corpus_from_native_xml)
(read_corpus_from_native_xml_file): Define new entry points.
* src/abg-writer.cc (write_translation_unit): Write 'path'
attribute into the 'abi-instr' xml element.
(write_corpus_to_native_xml, write_corpus_to_native_xml_file):
Define new entry points.
* tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS,
FILE_TYPE_ZIP_CORPUS}): New enumerators.
* tools/abg-tools-utils.cc (guess_file_type): Support detection of
the new xml file format containing a document root 'abi-corpus'
root element.
* tools/bidiff.cc (main): Support diffing xml corpus-es and zip
corpus-es.
* tools/bidw.cc (main): Recognize elf files before reading them.
* tools/bilint.cc (main): Support reading xml/zip corpus-es too.
* tests/data/test-read-write/test[0-23].xml: Update 'path'
attribute.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-libxml-utils.h (new_reader_from_istream): Declare
new public entry point.
* src/abg-libxml-utils.cc (xml_istream_input_read)
(xml_istream_input_close): New static functions.
(new_reader_from_istream): Define new public input function.
* include/abg-reader.h (read_translation_unit_from_istream):
Declare new entry points.
* src/abg-reader.cc (read_translation_unit_from_istream): Define
new entry points.
* tools/bilint.cc (options::{read_from_stdin, noout}): New
members.
(display_usage): Document --stdin and --noout.
(parse_command_line): Adjust to consider that no option on the
command line means reading from stdin, just like --stdin. Support
the --noout option as well.
(main): Support Read the abi instr from stdin; in that case, what
was read is just serialized back to stdout, unless --noout was
supplied.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-reader.h: New file with abigail::xml_reader APIs.
* include/abg-writer.h: New file with abigail::xml_writer APIs.
* include/Makefile.am: Add the new files above to the source
distribution.
* src/abg-reader.cc: Update top-file comments.
(namespace xml_reader): Rename namespace
reader into this.
(read_to_translation_unit, read_corpus_from_archive): New static
functions.
(read_translation_unit_from_file)
(read_translation_unit_from_file, read_corpus_from_file): New
entry points.
(struct array_deleter): New functor.
(translation_unit::read): Remove this.
* src/abg-writer.cc: Update top file comments.
(namespace xml_writer): Rename namespace
writer into this.
(struct archive_write_ctxt): New internal type.
(create_archive_write_context, write_translation_unit_to_archive)
(write_translation_unit, write_corpus_to_archive): New low level
static functions overloads.
(write_corpus_to_archive, write_translation_unit): Public higher
level overloads.
(translation_unit::write): Remove.
(dump): Update for new xml_writer namespace.
* include/abg-ir.h (translation_unit::{read, write}): Remove these
serialization methods.
* include/abg-corpus.h (corpus_sptr): New convenience typedef.
(corpus::{read, write}): Remove these methods.
* src/abg-corpus.cc (corpus::{read, write})
(corpus::impl::{serialized_tus, archive}): Remove these members.
(corpus::impl::{get_archive, close_archive, write_tu_to_archive,
read_to_translation_unit}): Remove these methods.
* tests/test-bidiff.cc (main): Update for usage of the new
xml_reader API.
* tests/test-read-write.cc (main): Likewise. Update for the usage
of the new xml_writer API, too.
* tests/test-walker.cc (main): Update for the usage of the new
xml_reader API.
* tests/test-write-read-archive.cc (main): Likewise. And for the
xml_writer API, too.
* tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise.
* tools/bidiff.cc (main): Likewise, for xml_reader APIs.
* tools/bilint.cc (main): Likewise, for xml_writer APIs, too.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>