Commit Graph

4 Commits

Author SHA1 Message Date
Dodji Seketeli
c4e7f9792d Harden debug info path management & better error reporting
* 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>
2014-06-04 16:30:18 +02:00
Dodji Seketeli
cf80e9d378 Support debug info files being outside the expected system directories
* 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>
2014-05-22 13:14:44 +02:00
Dodji Seketeli
c469546e45 Initial support for DW_TAG_partial_unit
* src/abg-dwarf-reader.cc (read_context::cur_tu_die_): New member.
	(read_context::read_context): Initialize the new member.
	(read_context::cur_tu_die): New accessors.
	(find_last_import_unit_point_before_die): New static function.
	(get_parent_die): Take a logical current die offset parameter.  If
	the die we want the parent for is a partial unit, then find the
	last DW_TAG_imported_unit that imports that partial unit before
	the logical current die and return the parent of that
	DW_TAG_imported_unit die.
	(get_scope_for_die): Take a logical current die offset parameter.
	Adjust.
	(build_translation_unit_and_add_to_ir): Set/unset the current
	translation unit DIE in the context.  Adjust.
	(build_namespace_decl_and_add_to_ir)
	(build_class_type_and_add_to_ir, build_qualified_type)
	(build_pointer_type_def, build_reference_type, build_typedef_type)
	(build_var_decl, build_function_decl, build_ir_node_from_die):
	Take a logical current die offset parameter.  Adjust.
	(build_corpus): Accept that we can have DIE that are not
	DW_TAG_compile_unit at the top level, because, well, we can now
	have DW_TAG_partial_unit too.
	* tests/data/test-read-dwarf/test2-{0,1}.cc: New test source
	files.
	* tests/data/test-read-dwarf/test2.h: Likewise.
	* tests/data/test-read-dwarf/test2.so: New input binary to read.
	* tests/data/test-read-dwarf/test2.so.abi: New reference test to
	compare against.
	* tests/test-read-dwarf.cc: Adjust to launch the new test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-05-19 17:26:40 +02:00
Dodji Seketeli
8f9b8e76a0 Add regression tests for dwarf reading
* tests/test-read-dwarf.cc: New dwarf reading regression test.
	* tests/data/test-read-dwarf/test0: New test input.
	* data/test-read-dwarf/test0: Likewise.
	* data/test-read-dwarf/test0.abi: Likewise.
	* data/test-read-dwarf/test0.cc: Likewise.
	* data/test-read-dwarf/test1: Likewise.
	* data/test-read-dwarf/test1.abi: Likewise.
	* data/test-read-dwarf/test1.cc: Likewise.
	* tests/Makefile.am: Build the new tests/test-read-dwarf.cc file.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-07 15:51:52 +01:00