| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
__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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
| |
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
./
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
e0c7abd450c9e49093cfae30af8a22782a74a403)
to branch 'com.redhat.elfutils' (head 2c784d50eee72e33972c333138a3a28df304da63)
|
|
|
|
|
|
| |
c44dcfac5b545aecb173fede31f34cb003be0173)
to branch 'com.redhat.elfutils' (head 4196d4e01486bdeb0c0632291881d1c6d7163fab)
|
|
|
|
|
|
|
| |
* dwfl-bug-addr-overflow.c: New file.
* Makefile.am (TESTS): Add it.
(dwfl_bug_addr_overflow_LDADD): New variable.
|
|
|
|
|
| |
* ia64_symbol.c (ia64_reloc_simple_type): Treat SECREL types as simple.
|
|
|
|
|
|
| |
1ac619debea0e3ecfd2704e8bdc803c6c893b62a)
to branch 'com.redhat.elfutils' (head 830d38d0a2ce24911160a871963f093209e69d9e)
|
| |
|
| |
|
|
|
|
|
|
| |
4f8fc821345feef58624f0aa5b470d4827577d8c)
to branch 'com.redhat.elfutils' (head 76e26cb54695fd3b21ee8fb5be3036bd68200633)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
and 7b542932f3e2947183b45bdbf39d448f457da9fd
|
| |
|
|
|
|
|
|
| |
* dwarf_attr_integrate.c (dwarf_attr_integrate): Treat
DW_AT_specification the same as DW_AT_abstract_origin.
|
| |
|
| |
|
|
|