libabigail/tests/data
Dodji Seketeli ce5e4889b1 Plug leak of debug info handles
On recent elfutils where the libdw's function dwarf_getalt exists, we
don't need to try and find the alternate debug info file ourselves by
using the function dwfl_standard_find_debuginfo.  Furthermore, when we
use that function on those recent elfutils versions, we leak the elf
resources allocated in the debug info resources; we also leak the file
descriptor to access the alternate debug info sections.

More generally, we also leak debug info handles used to access debug
info when using get_soname_of_elf_file and get_type_of_elf_file.

This patch plugs those leaks.

In the first case, if the function dwarf_getalt exists, the patch just
uses it to get the alternate debug info.  Otherwise, the patch uses
the dwfl_standard_find_debuginfo function like we used to, but then it
tries hard to free the file descriptor and debuginfo memory of the
alternate debug info.

	* configure.ac: Check the presence of dwarf_getalt in libdw.  If
	it's present, define the preprocessor macro
	LIBDW_HAS_DWARF_GETALT.  Update the autoconf configuration
	summary.
	* src/abg-dwarf-reader.cc: Add config.h.
	(find_alt_debug_info_location): Factorize this out of ...
	(find_alt_debug_info): ... this function.  Use dwarf_getalt if
	present, otherwise, keep using dwfl_standard_find_debuginfo.  In
	the later case, return the file descriptor opened to access the
	alternate debug info, by parameter, so that the caller can fclose
	it.
	(read_context::alt_fd_): New data member.
	(read_context::read_context): Initialize the new alt_fd_ data
	member.
	(read_context::load_debug_info): Store the file descriptor used to
	access the alternate debug info into the new alt_fd_ data member.
	(read_context::~read_context): New desctructor.
	(get_soname_of_elf_file, get_type_of_elf_file): Free the elf
	handle.
	(read_context::load_debug_info): Be paranoid in making sure we
	never override alt_dwarf_.
	* tests/data/test-alt-dwarf-file/test0-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-22 23:20:13 +02:00
..
test-abicompat Implement a [suppress_file] suppression directive 2016-05-08 12:39:26 +02:00
test-abidiff Bug 19638 - DWARF reader fails to link clone function to its declaration 2016-02-17 16:30:01 +01:00
test-abidiff-exit Forgot to add test2-filtered-removed-fns-v{0,1}.o 2016-03-07 12:29:54 +01:00
test-alt-dwarf-file Plug leak of debug info handles 2016-05-22 23:20:13 +02:00
test-core-diff Fix further reaching reverse path calculation in core diff algo 2014-02-10 15:51:09 +01:00
test-diff-dwarf Bug 19964 - Cannot load function aliases on ppc64 2016-04-25 14:48:11 +02:00
test-diff-dwarf-abixml Avoid canonicalizing function types too early 2015-11-09 18:33:58 +01:00
test-diff-filter Bug 19885 - Cannot associates a function DIE to a symbol on powerpc64 2016-03-30 20:17:42 +02:00
test-diff-pkg Bug 19961 - Distinguish between PI executable and shared library 2016-04-20 17:05:16 +02:00
test-diff-suppr Implement a [suppress_file] suppression directive 2016-05-08 12:39:26 +02:00
test-lookup-syms Re-build a test input file with debug info 2014-05-14 11:32:06 +02:00
test-read-dwarf Fixup virtual member functions with linkage and no underlying symbol 2016-02-25 16:49:39 +01:00
test-read-write Implement string interning for Libabigail 2016-02-24 15:13:20 +01:00
test-types-stability Bug 19204 - libabigail aborts on DWARF referencing non-existing DIE 2016-01-21 10:48:32 +01:00
test-write-read-archive Support new 'abi-corpus' native XML format (.abi) 2014-01-07 14:12:26 +01:00
Makefile.am Implement a [suppress_file] suppression directive 2016-05-08 12:39:26 +02:00