mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-29 21:32:08 +00:00
ce5e4889b1
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>
2 lines
61 B
Plaintext
2 lines
61 B
Plaintext
found the alternate debug info file 'test0-common-dwz.debug'
|