summaryrefslogtreecommitdiffstats
path: root/libdwfl/find-debuginfo.c
Commit message (Collapse)AuthorAgeFilesLines
* Trust AC_SYS_LARGEFILE to provide large file supportJosh Stone2015-10-091-8/+8
| | | | | | | | | | | | | | | AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS in config.h if needed for LFS, and this automatically maps things like open to open64. But quite a few places used explicit 64-bit names, which won't work on platforms like FreeBSD where off_t is always 64-bit and there are no foo64 names. It's better to just trust that AC_SYS_LARGEFILE is doing it correctly. But we can verify this too, as some file could easily forget to include config.h. The new tests/run-lfs-symbols.sh checks all build targets against lfs-symbols (taken from lintian) to make sure everything was implicitly mapped to 64-bit variants when _FILE_OFFSET_BITS is set. Signed-off-by: Josh Stone <[email protected]>
* Fix finding split debug info files not located by the build-id mechanismDodji Seketeli2015-08-141-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [This bug has been found by using elfutils in the context of libabigail. The initial bug report is https://sourceware.org/bugzilla/show_bug.cgi?id=18792. The interesting comments start at is https://sourceware.org/bugzilla/show_bug.cgi?id=18792#c4] suppose we have a debug info file that is located at a /prefix1/usr/lib/debug/prefix2/libfoo.so. Suppose also that the debug info describes a binary that is located at /prefix1/prefix2/libfoo.so Suppose the debug_link property inside the binary /prefix1/prefix2/libfoo.so correctly contains the string "libfoo.so" that designates the name of the debug info file. The problem is, when find_debuginfo_in_path() is called with its file_name parameter set to "/prefix1/prefix2/libfoo.so" and mod->dwfl->callbacks->debuginfo_path set to "/prefix1/lib/debug/", it fails to locate the debug info file libfoo.so under "/prefix1/usr/lib/debug/prefix2/". This patch fixes the issue by making find_debuginfo_in_path() try all the sub-strings of "/prefix1/prefix2/libfoo.so "under" "/prefix1/usr/lib/debug/", to find libfoo.so. That is, it tries, in order: - /prefix1/usr/lib/debug/prefix1/prefix2/libfoo.so - /prefix1/usr/lib/debug/prefix2/libfoo.so <-- and boom, it finds it! Note that the patch tries the variations between the two candidates above too. The patch uses a goto. I dislike gotos like anyone else, but then here, not using this would imply a bigger change of the logic of that function. So I am proposing the scheme based on the goto instead. * libdwfl/find-debuginfo.c (find_debuginfo_in_path): Try to locate the debug info file named debuglink_file under mod->dwfl->callbacks->debuginfo_path, by looking at the set of sub-trees under mod->dwfl->callbacks->debuginfo_path which is common to the set of non-absolute parent trees of file_name. https://bugzilla.redhat.com/show_bug.cgi?id=1253367 Signed-off-by: Dodji Seketeli <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Don't leak fname if file is main file by another name in try_open.Mark Wielaard2015-06-191-1/+2
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Fix memory leak in find_debuginfo_in_path.Mark Wielaard2015-06-091-10/+8
| | | | | | | | | commit c4f133 libdwfl: find_debuginfo_in_patch don't alloca/strdupa strings of unknown size. Introduced a memory leak in the case nothing was found. Make sure before returning all temporary strings are all freed. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Check file_name is not NULL before calling canonicalize_file_name.Mark Wielaard2015-06-051-1/+1
| | | | | | canonicalize_file_name is marked as taking a nonnull argument. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: find_debuginfo_in_patch don't alloca/strdupa strings of unknown size.Mark Wielaard2015-05-271-7/+31
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Move dwz alt multi file searching to find_debuginfo callback.Mark Wielaard2014-05-021-9/+89
| | | | | | | | | | Don't hard code the Dwarf dwz alt multi file search but allow the user to override it through the standard Dwfl_Callbacks. Also move ownership completely to the user of dwarf_setalt by removing free_alt from Dwarf and adding alt, fd and elf fields to Dwfl_Module. Add a relative .dwz file test case. Signed-off-by: Mark Wielaard <[email protected]>
* Update name, license and contributor policy.Mark Wielaard2012-06-051-40/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change name from "Red Hat elfutils" to "elfutils". * Update license of standalone tools and test from GPLv2 to GPLv3+. * Change license of libraries from GPLv2+exception to GPLv2/LGPLv3+. * Add Developer Certificate of Origin based contributor policy. top-level: - COPYING: Upgraded from GPLv2 to GPLv3. - CONTRIBUTING, COPYING-GPLv2, COPYING-LGPLv3: New files. - NEWS: Added note about new contribution and license policy. - Makefile.am: Updated to GPLv3, added new files to EXTRA_DIST. - configure.ac: Update to GPLv3, changed AC_INIT name to 'elfutils'. backends, lib, libasm, libcpu, libdw, libdwfl, libebl, libelf: - All files updated to GPLv2/LGPLv3+. Except some very small files (<5 lines) which didn't have any headers at all before, the linker .maps files and the libcpu/defs files which only contain data and libelf/elf.h which comes from glibc and is under LGPLv2+. config: - elfutils.spec.in: Add new License: headers and new %doc files. - Update all license headers to GPLv2/LGPLv3+ for files used by libs. src, tests: - All files updated to GPLv3+. Except for the test bz2 data files, the linker maps and script files and some very small files (<5 lines) that don't have any headers. Signed-off-by: Richard Fontana <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Fix debuginfo search when dwfl_build_id_find_debuginfo closes fd on ↵Roland McGrath2010-06-301-1/+1
| | | | success.
* Indentation fix.Roland McGrath2010-06-301-2/+2
|
* libdwfl: Ignore debuginfo-path hits that find the main file again.Roland McGrath2010-06-141-2/+24
|
* Fix uninitialized variable in error case.Roland McGrath2010-02-151-2/+2
|
* libdwfl automagic decompression supportRoland McGrath2009-01-051-6/+12
|
* libdwfl/Roland McGrath2008-05-071-3/+19
| | | | | | | | 2008-05-06 Roland McGrath <[email protected]> * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use FTS_LOGICAL here too. (dwfl_linux_kernel_find_elf): Likewise.
* src/Roland McGrath2007-10-041-10/+61
| | | | | | | | | | | | | | | | | | | | 2007-10-04 Roland McGrath <[email protected]> * readelf.c (print_archive_index): New variable. (options, parse_opt): Accept -c/--archive-index to set it. (dump_archive_index): New function. (process_file): Take new arg WILL_PRINT_ARCHIVE_INDEX. Call dump_archive_index on archives if set. (main): Update caller. (any_control_option): Give it file scope, moved out of ... (parse_opt): ... here. tests/ 2007-10-04 Roland McGrath <[email protected]> * run-readelf-test4.sh: New file. * Makefile.am (TESTS, EXTRA_DIST): Add it.
* 2007-01-10 Roland McGrath <[email protected]>Roland McGrath2007-01-111-11/+10
| | | | | | | | | | * linux-kernel-modules.c (report_kernel): Check asprintf return value directly instead of via side effect, to silence warn_unused_result. (dwfl_linux_kernel_report_offline): Likewise. (dwfl_linux_kernel_find_elf): Likewise. (dwfl_linux_kernel_module_section_address): Likewise. * find-debuginfo.c (try_open): Likewise.
* libdwfl/Roland McGrath2006-08-151-4/+1
| | | | | | | | | | | | | | | | | | | 2006-08-14 Roland McGrath <[email protected]> * linux-kernel-modules.c (try_kernel_name): If the call to dwfl_standard_find_debuginfo produces no results, try it again with NULL as DEBUGLINK_FILE to try *FNAME with .debug suffix. * find-debuginfo.c (DEFAULT_DEBUGINFO_PATH): Macro moved ... * libdwflP.h: ... to here. * linux-kernel-modules.c (try_kernel_name): Skip manual open if it repeats the first thing dwfl_standard_find_debuginfo will try. * linux-kernel-modules.c (MODULE_SECT_NAME_LEN): New macro. (dwfl_linux_kernel_module_section_address): If a /sys file is missing and the section name is >= MODULE_SECT_NAME_LEN, try truncating the section name.
* Fix FSF address. No exception for libdwarf.Ulrich Drepper2006-04-041-1/+1
|
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2006-04-041-10/+46
| | | | | | 4f8fc821345feef58624f0aa5b470d4827577d8c) to branch 'com.redhat.elfutils' (head 76e26cb54695fd3b21ee8fb5be3036bd68200633)
* 2005-08-23 Roland McGrath <[email protected]>Roland McGrath2005-08-231-4/+11
| | | | | | * dwarf_attr_integrate.c (dwarf_attr_integrate): Treat DW_AT_specification the same as DW_AT_abstract_origin.
* Merge all of libdwfl.a into libdw.a. libdwfl.a is not installed.Ulrich Drepper2005-07-281-1/+2
| | | | | | Fix building of libdwfl. libdwfl.a must not depend on libwu.a since the latter is not available after installation. Add copies of the crc32 files to libdwfl.
* Adjust for monotone.Ulrich Drepper2005-07-261-0/+157