summaryrefslogtreecommitdiff
path: root/libdwfl/libdwfl.h
Commit message (Collapse)AuthorAgeFilesLines
* debuginfod: Make sure there is only one typedef for debuginfod_clientMark Wielaard2023-02-061-0/+3
| | | | | | | | | | | | Both debuginfod.h and libdwfl.h have a simple typedef for struct debuginfod_client. Some compilers pedantically warn when including both headers that such typedefs are only officially supported in C11. So guard them with _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF to make them happy. https://sourceware.org/bugzilla/show_bug.cgi?id=30077 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: add dwfl_report_offline_memoryAleksei Vetrov2022-10-161-0/+4
| | | | | | | | | | | | | This method allows to read and report ELF from memory instead of opening a file. That way arbitrary memory can be worked with, e.g. when coming from a stream without the need to persist. Another useful application is for fuzzing, because fuzzers might be able to track accesses to the memory and change the fuzzer input to cover more edge cases through more targeted input. Hence, add a new function along with a test case. Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
* libdwfl: Add new function dwfl_frame_regDi Chen2022-07-311-0/+6
| | | | | | | | | | | | | | Dwfl has most of the infrastructure to keep the full unwind state, including the state of unwound registers per frame using Dwfl_Thread_Callbacks. But there is no public API to access the state, except for the PC (dwfl_frame_pc). This commit adds a new function dwfl_frame_reg to get the value of the DWARF register number in the given frame. https://sourceware.org/bugzilla/show_bug.cgi?id=28579 Signed-off-by: Di Chen <dichen@redhat.com>
* Introduce public dwfl_get_debuginfod_client APIMilian Wolff2022-07-131-0/+10
| | | | | | | | | | | | | | | | | Dwfl can use debuginfod internally, which was so far totally opaque to the outside. While the functionality is great for users of the dwfl API, the long wait times induced by downloading of data over debuginfod lead to complaints by endusers. To offer them a bit more insight into the internal ongoings, one can now use e.g. `debuginfod_set_progressfn` on the handle returned by `dwfl_get_debuginfod_client` to report download progress. Rename get_client to dwfl_get_debuginfod_client and make it public. Unconditionally compile debuginfod-client.c and stub the new public function and always return NULL when debuginfod integration was disabled. Signed-off-by: Milian Wolff <mail@milianw.de>
* libdwfl: Update docs and nonnull attributes for dwfl_module_addrinfoMark Wielaard2022-05-271-16/+16
| | | | | | | | Make clear that both the offset and sym arguments cannot be NULL. https://bugzilla.redhat.com/show_bug.cgi?id=1986555 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: fix spelling typos in comments and ChangeLogDmitry V. Levin2020-12-121-4/+4
| | | | | | | | | | | | | | adresses -> addresses boundery -> boundary explictly -> explicitly fo -> for layed -> laid partical -> particular setion -> section substract -> subtract wil -> will Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* libdwfl: remove broken coalescing logic in dwfl_report_segmentOmar Sandoval2019-12-181-16/+4
| | | | | | | | | | | | dwfl_report_segment has some logic that detects when a segment is contiguous with the previously reported segment, in which case it's supposed to coalesce them. However, in this case, it actually returns without updating the segment array at all. As far as I can tell, this has always been broken. It appears that no one uses the coalescing logic anyways, as they pass IDENT as NULL. Let's just get rid of the logic and add a test case. Signed-off-by: Omar Sandoval <osandov@fb.com>
* Make __attribute__ conditional in all installed headersUlf Hermann2017-05-021-1/+1
| | | | | | | | | | __attribute__ is a GNU extension. If we want to link against the libraries using a different compiler, it needs to be disabled. It was already disabled in libdw.h, and this patch extends this to the other headers. We move the defines to libelf.h as that is included in all the others. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove redundant NULL tests.Chih-Hung Hsieh2015-09-141-1/+1
| | | | | | | | GCC6 and Clang give warnings on redundant NULL tests of parameters that are declared with __nonnull_attribute__. Signed-off-by: Chih-Hung Hsieh <chh@google.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Fix finding split debug info files not located by the build-id mechanismDodji Seketeli2015-08-141-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [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 <dodji@seketeli.org> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Add dwfl_core_file_attach and dwfl_linux_proc_attach.Mark Wielaard2013-12-311-6/+20
| | | | | | | | | | | | | | Rewrite __libdwfl_attach_state_for_pid and __libdwfl_attach_state_for_core as public functions and don't call them from dwfl_linux_proc_report and dwfl_core_file_report anymore. This lets the user attach state explicitly independ from how the dwfl modules have been reported. Since attaching state is an explicit action now the error can be returned directly and we don't need to keep track of process_attach_error. dwfl_linux_proc_attach lets the user can tell libdwfl whether caller takes care of ptrace attaching and stopping the threads under inspection, or whether the callback needs to take care of that and detaching again. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Add dwfl_getthread_frames.Mark Wielaard2013-12-231-0/+21
| | | | | | | | | | | | | | | | dwfl_getthread_frames is a convenience function for when the user is only interested in one specific thread id of a process. It can be implemented by a simple wrapper function that removes an extra callback layer just to filter on thread id. But it also provides an optimized path to getting access to just one particular Dwfl_Thread of the Dwfl process by providing and (optional) new callback for the state provider. The pid_thread_callbacks now provide an (optional) pid_getthread that doesn't need to travers all threads anymore. Which is implemented for the linux-pid-attach provider. stack now uses this to implement a new '-1' option that shows just one specific thread of a process. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Introduce dwfl_module_getsym_info and dwfl_module_addrinfo.Mark Wielaard2013-12-201-20/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some arches like ppc64 use function descriptor values instead of function addresses causing matching of names and addresses to fail when using dwfl_module_getsym or dwfl_module_addrsym. Add ebl hook to resolve any function descriptor values found in non-ET_REL modules. The new function dwfl_module_getsym_info doesn't adjust the symbol value in any way, but returns the adjusted and/or resolved address associated with the symbol separately. The new function dwfl_module_addrinfo resolves against both the address associated with the symbol (which could be the function entry address) value and the adjusted st_value. So that it is easy to resolve and match either function descriptors and/or function entry addresses. Since these new functions also return more information they replace the dwfl_module_getsym_elf and dwfl_module_addrsym_elf functions that never made it into a released elfutils version. addr2line and readelf now use the new functions when looking up functions names. addr2line will now also display the section the address was found in when given -x. Extra testcases were added for both addr2line and the dwflsyms testscase. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Add dwfl_module_getsymtab_first_global.Mark Wielaard2013-12-161-0/+7
| | | | | | | | | | New function that provides the index after the last non-local symbol as returned by dwfl_module_getsym and dwfl_module_getsym_info. Allows users to first search through all global symbols before searching the local symbols in the table like dwfl_module_addrsym and dwfl_module_addrsym_info do as optimization. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Add dwfl_module_addrsym_elf and dwfl_module_getsym_elf.Mark Wielaard2013-11-271-1/+24
| | | | | | | | | | | Introduce two new functions that also return the elf associated with a symbol to make symbol section indexing work for non-special sections. Simplify code by removing dwfl_file where appropriate and just track Elf directly. Document limitations of shndx with existing dwfl_module_addrsym and dwfl_module_getsym. Extend dwflsyms testcase to check some more symbol and section (index) properties. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Code cleanup: Remove const in prototypeJan Kratochvil2013-11-141-1/+1
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Fix dwfl_attach_state machine->elfJan Kratochvil2013-11-141-7/+7
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Unwinder for x86*.Jan Kratochvil2013-11-071-2/+135
| | | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Fix executable_for_core for non-dwfl_standard_argpJan Kratochvil2013-10-301-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | ./ 2013-10-30 Jan Kratochvil <jan.kratochvil@redhat.com> * NEWS (Version 0.158): New. libdw/ 2013-10-30 Jan Kratochvil <jan.kratochvil@redhat.com> * libdw.map (ELFUTILS_0.158): New. libdwfl/ 2013-10-30 Jan Kratochvil <jan.kratochvil@redhat.com> * argp-std.c (parse_opt): Use executable parameter of dwfl_core_file_report. * core-file.c (dwfl_core_file_report): Add parameter executable. Set it to DWFL. Add NEW_VERSION for it. (_compat_without_executable_dwfl_core_file_report): New. Twice. * libdwfl.h (dwfl_core_file_report): Add parameter executable, update the function comment. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Add parameter add_p_vaddr to dwfl_report_elf.Jan Kratochvil2013-05-051-5/+12
| | | | | | | | | | | | | | | | | | | | | | libdwfl/ * dwfl_report_elf.c (__libdwfl_report_elf): Add parameter add_p_vaddr. Set it to true for ET_EXEC and ET_CORE. Provide alternative setup of START and BIAS if !ADD_P_VADDR. Set END from BIAS, not BASE. (dwfl_report_elf): Add parameter add_p_vaddr. Pass it down. Add NEW_VERSION. (_compat_without_add_p_vaddr_dwfl_report_elf) <SHARED>: New, with COMPAT_VERSION. * libdwfl.h (dwfl_report_elf): Add parameter add_p_vaddr. Describe it. * libdwflP.h (__libdwfl_report_elf): Add parameter add_p_vaddr. * link_map.c (report_r_debug): Use true add_p_vaddr for dwfl_report_elf. * linux-kernel-modules.c (report_kernel): Use false add_p_vaddr for dwfl_report_elf. * offline.c (process_elf): Use true add_p_vaddr for dwfl_report_elf. tests/ * dwfl-report-elf-align.c: Use false add_p_vaddr for dwfl_report_elf. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* libdwfl/Jan Kratochvil2012-10-171-1/+2
| | | | | | | | 2012-10-17 Jan Kratochvil <jan.kratochvil@redhat.com> * libdwfl.h (dwfl_module_getelf): Add __nonnull_attribute__. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* 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 <rfontana@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Add dwfl_dwarf_line, addr2line -F to print out more line info bits.Roland McGrath2010-08-241-0/+3
|
* Export dwfl_core_file_report.Roland McGrath2010-03-111-1/+10
|
* CFI support: lookup by PC and translate into DWARF location per registerRoland McGrath2009-07-081-0/+14
|
* Make dwfl_module_getsym yield shndx -1 for any non-allocated section.Roland McGrath2009-04-081-5/+6
|
* Fix up bogon and missing log entries from .pmachata.threads branch.Roland McGrath2008-08-251-3/+42
|
* src/Roland McGrath2007-10-041-17/+72
| | | | | | | | | | | | | | | | | | | | 2007-10-04 Roland McGrath <roland@redhat.com> * 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 <roland@redhat.com> * run-readelf-test4.sh: New file. * Makefile.am (TESTS, EXTRA_DIST): Add it.
* libdw/Roland McGrath2007-04-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 2007-04-16 Roland McGrath <roland@redhat.com> * libdw.map (ELFUTILS_0.127): Add dwfl_module_address_section. libdwfl/ 2007-04-16 Roland McGrath <roland@redhat.com> * derelocate.c (cache_sections): Apply bias to sh_addr. (compare_secrefs): Fix address comparison to avoid signed overflow. (find_section): New function, broken out of ... (dwfl_module_relocate_address): ... here, call it. (check_module): New function, broken out of ... (dwfl_module_relocate_address): ... here, call it. (dwfl_module_address_section): New function. * libdwfl.h: Declare it. tests/ 2007-04-16 Roland McGrath <roland@redhat.com> * dwfl-addr-sect.c: New file. * Makefile.am (noinst_PROGRAMS): Add it. (dwfl_addr_sect_LDADD): New variable.
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2007-03-131-0/+14
| | | | | | e0c7abd450c9e49093cfae30af8a22782a74a403) to branch 'com.redhat.elfutils' (head 2c784d50eee72e33972c333138a3a28df304da63)
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2007-02-051-1/+2
| | | | | | c44dcfac5b545aecb173fede31f34cb003be0173) to branch 'com.redhat.elfutils' (head 4196d4e01486bdeb0c0632291881d1c6d7163fab)
* 2007-01-10 Roland McGrath <roland@redhat.com>Roland McGrath2007-01-101-2/+4
| | | | | | | * dwfl-bug-addr-overflow.c: New file. * Makefile.am (TESTS): Add it. (dwfl_bug_addr_overflow_LDADD): New variable.
* 2006-10-09 Roland McGrath <roland@redhat.com>Roland McGrath2006-10-101-1/+2
| | | | | * ia64_symbol.c (ia64_reloc_simple_type): Treat SECREL types as simple.
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2006-07-121-11/+34
| | | | | | 1ac619debea0e3ecfd2704e8bdc803c6c893b62a) to branch 'com.redhat.elfutils' (head 830d38d0a2ce24911160a871963f093209e69d9e)
* Add extern "C" for libdwfl.h and libebl.h.Ulrich Drepper2006-05-271-0/+8
|
* 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)
* libdw/Roland McGrath2006-02-271-1/+4
| | | | | | | | | | | | | 2006-02-22 Roland McGrath <roland@redhat.com> * libdw.map: Bump to 0.120; export dwfl_version. libdwfl/ * dwfl_version.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_version.
* 2005-12-22 Roland McGrath <roland@redhat.com>Roland McGrath2005-12-231-0/+5
| | | | | | | | | | | | * argp-std.c (parse_opt): Call dwfl_end in failure cases. * linux-proc-maps.c (proc_maps_report): New function, broken out of ... (dwfl_linux_proc_report): ... here. Call it. (dwfl_linux_proc_maps_report): New function. * libdwfl.h: Declare it. * libdwflP.h: Add INTDECL. * argp-std.c (options, parse_opt): Grok -M/--linux-process-map.
* merge of 2cc527e6d8c8ff19dab478f7d12e58f1cfa6d6f5Roland McGrath2005-12-051-0/+14
| | | | and 7b542932f3e2947183b45bdbf39d448f457da9fd
* Update new test after merge.Roland McGrath2005-11-171-1/+14
|
* 2005-08-23 Roland McGrath <roland@redhat.com>Roland McGrath2005-08-231-8/+81
| | | | | | * dwarf_attr_integrate.c (dwarf_attr_integrate): Treat DW_AT_specification the same as DW_AT_abstract_origin.
* Add a few missing extern for function prototypes.Ulrich Drepper2005-07-281-6/+6
|
* libdwfl.h: Use "" for libdw.h #include.Roland McGrath2005-07-281-1/+1
|
* Adjust for monotone.Ulrich Drepper2005-07-261-0/+262