| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libdwfl/
2014-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Access deleted files by /dev/PID/mem.
* dwfl_module.c (dwfl_report_module_pid): New function.
* dwfl_module_getdwarf.c (open_elf): Call __libdw_open_file_at_offset.
* libdwfl.h (dwfl_report_module_pid): New declaration.
* libdwflP.h (struct Dwfl_Module): New field pid.
(INTDECL (dwfl_report_module_pid)): New.
* linux-proc-maps.c (proc_maps_report): New variable first_high.
(proc_maps_report) (report): Possibly call dwfl_report_module_pid.
tests/
2014-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Access deleted files by /dev/PID/mem.
* Makefile.am (check_PROGRAMS): Add deleted and deleted-lib.so.
(TESTS, EXTRA_DIST): Add run-deleted.sh.
(deleted_LDADD, deleted_lib_so_LDFLAGS, deleted_lib_so_CFLAGS): New.
* deleted-lib.c: New file.
* deleted.c: New file.
* run-deleted.sh: New file.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
libdw/
2014-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix abort() on missing section headers.
* dwarf_begin_elf.c (check_section): Replace abort call by a return;
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
./
2014-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Extend __libdw_open_file and elf_begin as *_at_offset.
* NEWS (libelf): New, with elf_begin_at_offset.
libdwfl/
2014-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Extend __libdw_open_file and elf_begin as *_at_offset.
* libdwflP.h (__libdw_open_file_at_offset): New declaration.
* open.c (__libdw_open_file): Rename to ...
(__libdw_open_file_at_offset): ... here and add parameters start_offset
and maximum_size.
(__libdw_open_file): New wrapper of it.
libelf/
2014-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Extend __libdw_open_file and elf_begin as *_at_offset.
* elf_begin.c (elf_begin): Rename to ...
(elf_begin_at_offset): ... here and add parameters start_offset and
maximum_size.
(elf_begin): New wrapper of it.
* libelf.h (elf_begin_at_offset): New declaration.
* libelf.map (ELFUTILS_1.7): New, with elf_begin_at_offset.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
| |
Check phdr->p_filesz and make sure interpreter string is zero terminated
before calling printf.
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Section 2.14 of the DWARF v3 & v4 standards specifies that all three
declaration coordinates are unsigned integer constants. DWARF v2 did
not specify signedness. Now dwarf_decl_* use dwarf_formudata to read
these values.
Also, an assertion on the range of line/column is now a handled error,
setting DWARF_E_INVALID_DWARF for values greater than INT_MAX.
Signed-off-by: Josh Stone <jistone@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows CFI unwinding for ARM. It relies on having .debug_frame around
which is always the case in our testsuite. All native backtrace tests PASS
on arm if debuginfo (for glibc) is installed on the system. Otherwise the
tests SKIP.
For non-debug unwinding ARM uses EXIDX tables, not .eh_frames, which
would have to be translated to CFI to do unwinding without .debug_frame
available.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
The elflint self test now also checks ET_REL files. Update the list of
relocation types to include all known relocations from elf.h.
R_ARM_SWI24 was obsolete and is now named R_ARM_TLS_DESC. The only other
relocation used in the dynamic linker is R_ARM_IRELATIVE.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
This just makes sure that all format strings are given as literals to
printf like functions so the compiler can see and check them. Remove
all no_Wformat, add -Wformat=2 unconditionally to AM_CFLAGS.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
Using dwarf_getscopes_die we can get all scopes that make up the current
subprogram representing an address. Using the call_file/line/column
attributes we can also show the source locations of these "inlined" calls.
Includes a test that shows that when DWARF debuginfo is available all
inlined function call frames and their source location can be shown.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
Make -n default just 256 frames, 2048 was too big. Also Document magic
number used in frames.allocated initialization.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
Includes test that shows -d matches the function name that corresponds to
the actual source line we report with -s for a frame address.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
dwarf_getscopes returns the number of scope DIEs containing a PC address.
It returns -1 for errors or 0 if no scopes match PC. If dwarf_getscopes
returned 0, then scopes will not be allocated and handle_address might free
the uninitialized scopes pointer. Make sure it always has a defined value.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some self tests would run for a really long time (especially under valgrind)
because we included all libebl backends in the list (there are 12 backends).
Now only test two explicitly. Also there were no ET_REL files in the
self test file list. So add two ET_REL files. The total number of self test
files is now 12.
run-nm-self.sh would run 4 * 3 * 3 * 22 = 792 tests (on all self test files).
Reduce the number of different files to test to 3 (one ET_EXEC, one ET_DYN
and one ET_REL file). Reducing the number of test runs to 99.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
There can be more than 3 frames, but depending on the system/installed
glibc we might not be able to unwind fully till the end.
cxxfunc -> f -> main
Expect to see the top two and a warning that there are more frames
(exit code 1)
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
Not setting a vendor code before use would be invalid which we tried to
catch. But to detect that we do need to initialize the vendor array to
zero first.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
| |
Without config.h, there is no possibility of large file support.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
| |
Needed when /proc/sys/kernel/core_uses_pid is set to 0. Try to rename
the core file, and if it does still fail, skip the test.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For PPC64 we skip resetting the return register if it is already set.
This is because on PPC64 there are two DWARF registers numbers that can
represent the same register. Setting the return address again confuses
the unwinder. But we do want to reset it if the register number
(non-translated by the ppc64 ebl) is equal to the actual register number
as set in the CIE as return address. This happens on older toolchains in
.debug_frame where the return address is set to 108, but the ebl abi_cfi
also sets register number 65.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
On older kernels the ptrace detach stop trick doesn't work reliably.
Just keep the child processes attached and stopped during the tests,
dwfl_linux_proc_attach will handle that fine now. Also on older kernels
raise would sometimes return anyway and cause a spurious assert. Just
ignore it.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
To distinguish between the current PPC64 ELF ABI and the revised
ELFv2 ABI that will not use function descriptors binutils started
to emit the version (currently 1) in the ehdr e_flags. Recognize
all valid versions (0, 1 or 2) in elflint by adding the hook
ppc64_machine_flag_check.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
The testcase originally came from GCC which was testing the runtime
unwinder using _Unwind_ForcedUnwind. Since we are using our own external
unwinder we can just abort at the right place and unwind from there.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
Setup initial CIE values for aarch64 for use with dwarf_frame functions.
Register info prefix should be the empty string (not NULL) when not used.
Add an EM_AARCH64 testcase to tests/run-addrcfi.sh to check both issues.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
When the dwfl_linux_proc_find_elf callback is used together with the
dwfl_linux_proc_report callback that reads /proc/PID/maps files we might
see and try to open special character device files that cannot be normally
read and processed by libelf (and might hang the library on the initial
open or read from the file). Make sure we only try to open and return
regular files.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
core_next_thread would allocate a new thread_arg each time but never free
it. We only need one active thread_arg to keep the state. Free it when
there are no more threads. It was also not possible to start walking all
threads in the core again. Just reset the note offset at the start.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
We might already have allocated memory to hold the build_id early in
consider_notes when we called consider_phdr for the program headers
we've read from the image. We would leak that memory when we don't use
it then because we return early/fail. This can be because either we
didn't find the correct bias or we skip the module because it would
conflict in address space with any already existing module of DWFL.
In both cases explicitly free the build_id memory.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
Use to list modules detected for process or core file by stack program
and to see build-ids and which main elf and debug files were recognized
by libdwfl callbacks.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Check up front whether we attached correctly, if not error out. Make sure
callbacks report -1 only on real errors and DWARF_CB_ABORT if exiting early
(but not in error). Handle all errors from frame callback in print_frames
after printing of good frames. Print as much information as possible like
tid, address and module name if known with error messages. Only exit with
exit code zero if everything went fine. Exit with error code one if there
were any non-fatal errors. Exit with error code two if no frames could be
printed or a fatal error occurred.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Resolving addresses to function symbol names can be expensive. Use -q
to only print addresses (use together with --build-id to process later).
Demangle names by default, but add the -r option to not demangle and
show the raw names.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were using dwfl_standard_argp but trying to add our own and substract
some options from it. dwfl_standard_argp also handles kernel, modules,
executables without state and process maps that stack doesn't support.
That made argp parsing somewhat ugly and meant our --help and --usage
didn't really match. Just handle the dwfl_standard_argp options we do
want directly ('-p', '--core', '-e' and '--debuginfo-path'). That way
we can also do sanity checking on the options given.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
| |
A convenient format for offline processing of the backtrace.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Limit the number of frames printed per thread (defaults to 64) and resolve
addresses to names, modules and source after unwinding so the thread is
only stopped for the minimum time needed to do the actual unwinding. The
thread doesn't need to wait for the lookups and printing of information.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|