summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* readelf: Don't print 'for section' when rela section sh_info is zero.Mark Wielaard2014-05-272-1/+20
| | | | | | This matches how handle_relocs_rel already printed the header. Signed-off-by: Mark Wielaard <[email protected]>
* unstrip: Allow prelinked, but non-split .bss section.Mark Wielaard2014-05-272-2/+8
| | | | | | | | If the section sh_size of the original and undo section are equal then match them and don't set split_bss. This is also what prelink's undo_sections allows. Signed-off-by: Mark Wielaard <[email protected]>
* unstrip: Add --force to force combining files when ELF headers don't match.Mark Wielaard2014-05-274-16/+65
| | | | | | | | | | | | | | Older versions of GNU binutils strip would drop some ELF header flags. Causing the main ELF file and the separate .debug file to have mismatched ELF header fields. Unfortunately some distros are still shipping such files. eu-unstrip doesn't want to recombine such files. Add a more explicit explanation which fields don't match and provide a --force, -F flag to force combining such files anyway (producing a warning). https://bugzilla.redhat.com/show_bug.cgi?id=698005 https://bugzilla.redhat.com/show_bug.cgi?id=806474 Signed-off-by: Mark Wielaard <[email protected]>
* Regenerate *.po files.elfutils-0.159Mark Wielaard2014-05-206-1110/+1114
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* backends: Add ebl_check_reloc_target_type.Mark Wielaard2014-05-1913-8/+105
| | | | | | | | | And implement for arm and ia64. Both have special section types that are valid targets for a reloc. Both refer to unwind data. elflint now just calls ebl_check_reloc_target_type instead of hard coding the expected section types. Signed-off-by: Mark Wielaard <[email protected]>
* tests: Don't use static functions in testfile-backtrace-demangle.Mark Wielaard2014-05-184-2/+9
| | | | | | | | | Compilers and demanglers might treat local/static functions different between versions. In particular g++ 4.1.2 and libstdc++ mangle and demangle the static void cxxfunc (int i) function as _Z7cxxfunci. While g++ 4.8.2 and libstdc++ mangle and demangle it as _ZL7cxxfunci. Signed-off-by: Mark Wielaard <[email protected]>
* Prepare 0.159 release.Mark Wielaard2014-05-1811-3279/+3358
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Don't leak fd on error in linux-proc-maps.c (grovel_auxv).Mark Wielaard2014-05-152-1/+9
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* Remove --enable-dwz. dwz alt debug is no longer experimental.Mark Wielaard2014-05-0310-32/+34
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Move dwz alt multi file searching to find_debuginfo callback.Mark Wielaard2014-05-0216-169/+461
| | | | | | | | | | 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]>
* libdwelf: Add dwelf_elf_gnu_build_id.Mark Wielaard2014-05-0116-126/+333
| | | | | | | | | Move internal function __libdwfl_find_build_id to libdwelf and use it to add a public dwelf_elf_gnu_build_id function to extract the NT_GNU_BUILD_ID from an ELF file using either the shdrs or phdrs. Adjust internal callers and add a testcase. Signed-off-by: Mark Wielaard <[email protected]>
* Move .gnu_debugaltlink handling from libdw to libdwflFlorian Weimer2014-05-014-120/+135
| | | | | | | Also use dwelf_dwarf_gnu_debugaltlink to locate the alternate debugging information. Signed-off-by: Florian Weimer <[email protected]>
* tests/allfcts.c: Install alternate debug informationFlorian Weimer2014-04-242-1/+40
| | | | | | This change also adds more error checking and reporting. Signed-off-by: Florian Weimer <[email protected]>
* libdwelf: Add dwelf_dwarf_gnu_debugaltlinkFlorian Weimer2014-04-2411-4/+215
| | | | Signed-off-by: Florian Weimer <[email protected]>
* libdw: Add dwarf_getalt, dwarf_setaltFlorian Weimer2014-04-247-1/+112
| | | | Signed-off-by: Florian Weimer <[email protected]>
* dwarf_elf_begin: Add .gnu_debugaltlink to the sectiondata arrayFlorian Weimer2014-04-243-18/+24
| | | | | | And use it if DWZ mode is enabled. Signed-off-by: Florian Weimer <[email protected]>
* libdwelf: New DWARF ELF Low-level Functions. Add dwelf_elf_gnu_debuglink.Mark Wielaard2014-04-2422-69/+408
| | | | | | | | New public header elfutils/libdwelf.h for low-level DWARF/ELF helper functions. The new function dwelf_elf_gnu_debuglink returns the name and crc as found in the .gnu_debuglink section of an ELF file. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: handle_core_item make sure variable length array isn't zero size.Mark Wielaard2014-04-242-1/+6
| | | | | | | | The printed array should have at least space for the terminating zero char. Found by gcc -fsanitize=undefined while running run-readelf-vmcoreinfo.sh. runtime error: variable length array bound evaluates to non-positive value 0 Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: __libdwfl_frame_reg_[gs]et use uint64_t when checking bits.Mark Wielaard2014-04-242-2/+8
| | | | | | | Found by gcc -fsanitize=undefined while running the backtrace-core-ppc test. runtime error: shift exponent 45 is too large for 32-bit type 'unsigned int' Signed-off-by: Mark Wielaard <[email protected]>
* readelf.c (print_gdb_index_section): Use unsigned int for 31 bits left shift.Mark Wielaard2014-04-242-1/+6
| | | | | | | Found by gcc -fsanitize=undefined. left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Mark Wielaard <[email protected]>
* libdw (get_sleb128_step): Remove undefined behavior.Mark Wielaard2014-04-242-2/+7
| | | | | | | | As pointed out by gcc -fsanitize=undefined left shifting a negative value is undefined. Replace it with a multiplication of the signed value as suggested by Richard Henderson and Josh Stone. Signed-off-by: Mark Wielaard <[email protected]>
* tests: run-nm-self.sh use test = not == for string comparisons.Mark Wielaard2014-04-232-1/+5
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* Unwinding is only supported on LinuxKurt Roeckx2014-04-2311-4/+152
| | | | Signed-off-by: Kurt Roeckx <[email protected]>
* Remove mudflap build option.Mark Wielaard2014-04-1825-183/+138
| | | | | | | | | The --enable-mudflap configure build has been broken for 2 years without anybody apparently noticing. GCC 4.9 removed mudflap support. Before release we now run make distcheck with valgrind support. Removal of the mudflap configure option simplifies the build a little. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Read the decompressed data when processing .zdebug DWARF sections.Mark Wielaard2014-04-157-9/+575
| | | | | | | | | | | | | readelf uses libdw to open the Dwarf and read some of the DWARF data. But it also uses its own parsers to display some of the low-level unprocessed data. If the DWARF debug section was zlib compressed it should actually use the decompressed section data from libdw instead of the raw section data. Includes a testcase for those sections that couldn't be properly displayed when compressed before. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: convert up to a target long in buf_read_ulong.Mark Wielaard2014-04-146-3/+78
| | | | | | | Add a i686 corefile test. Reported-by: Markus Engel <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* backends: Add aarch64 native and core unwind support.Mark Wielaard2014-04-1410-2/+137
| | | | | | | | Add aarch64 backend functions frame_nregs and set_initial_registers_tid. Mark pc_register in aarch64 prstatus_regs as pc_register. Add backtrace-core-aarch64 testcase. Signed-off-by: Mark Wielaard <[email protected]>
* CVE-2014-0172 Check for overflow before calling malloc to uncompress data.Mark Wielaard2014-04-092-1/+12
| | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1085663 Reported-by: Florian Weimer <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* backends: add ARM compatible mode to AARCH64Jean Pihet2014-03-302-2/+37
| | | | | | | | | Add the initial register setup for AARCH64 running ARM code (so called compat mode). This makes 'eu-stack -p' happy on ARM binaries while running on a AARCH64 kernel. Signed-off-by: Jean Pihet <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* backends: AARCH64_ABS32 and AARCH64_ABS64 are also valid in ET_REL.Mark Wielaard2014-03-192-3/+8
| | | | | | | This is tested now in a native aarch64 build by tests/run-elflint-self.sh since we added some .o files to the self tests. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: elf_from_remote_memory only trust shdrs of last file-only segment.Mark Wielaard2014-03-172-5/+19
| | | | | | | | | If the last PT_LOAD segment that contains the whole shdrs also extends the segment in memory beyond the end of file the program might be reusing the memory space that we expect the shdrs to be in. Don't trust the shdrs are valid in that case. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: test dwflsyms on ET_EXEC with minisymtabJosh Stone2014-03-115-1/+133
| | | | | | | | | | | | | | | | | | | | This adds testfilebaxmin, an ET_EXEC binary with .gnu_debugdata that doesn't match the load address of the main file. A previous bug made this trigger a kernel heuristic that forces the module to act like ET_DYN, which makes things like dwfl_module_relocate_address report relative addresses rather than proper absolute addresses. For example, before the fix dwflsyms would print: deregister_tm_clones (0) 0x400430, rel: 0x430 (.text) Now it properly prints: deregister_tm_clones (0) 0x400430, rel: 0x400430 (.text) These new test additions confirm that it's fixed. Signed-off-by: Josh Stone <[email protected]>
* libdwfl: dwfl_module_getdwarf.c (open_elf) only (re)set mod->e_type once.Josh Stone2014-03-112-6/+24
| | | | | | | | | As noted in https://sourceware.org/bugzilla/show_bug.cgi?id=16676#c2 for systemtap, the heuristic used by open_elf to set the kernel Dwfl_Module type to ET_DYN, even if the underlying ELF file e_type was set to ET_EXEC, could trigger erroneously for non-kernel/non-main (debug or aux) files. Make sure we only set the e_type of the module once when processing the main file (when the phdrs can be trusted).
* libdwfl: dwfl_linux_proc_find_elf use elf_from_remote_memory for (deleted).Mark Wielaard2014-03-105-48/+143
| | | | | | | | If a module has a "(deleted)" main ELF file, then try to read it from remote memory if the Dwfl has process state attached by reusing the ptrace mechanism from linux-pid-attach. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: elf_from_remote_memory should use pagesize, not p_align.Mark Wielaard2014-03-103-19/+50
| | | | | | | | | | elf_from_remote_memory would use the actual p_align of the PT_LOAD segments to calculate the loadbase, end and start of a segment. But the dynamic loader aligns the segments using the pagesize and only sanity checks the p_align values. So we should do the same to get accurate segment addresses. Also fixes a small memory leak in case the ELF image appears to be bad. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Print DW_FORM_sdata values as signed numbers.Mark Wielaard2014-03-102-7/+32
| | | | | | Printing DW_FORM_sdata numbers as unsigned values is misleading. Signed-off-by: Mark Wielaard <[email protected]>
* Fix abort() on missing section headers.Jan Kratochvil2014-03-042-3/+10
| | | | | | | | | | | libdw/ 2014-03-03 Jan Kratochvil <[email protected]> Fix abort() on missing section headers. * dwarf_begin_elf.c (check_section): Replace abort call by goto err. New label err to return NULL. Signed-off-by: Jan Kratochvil <[email protected]>
* libdwfl: linux-proc-maps.c (proc_maps_report): Don't assert on bad input.Mark Wielaard2014-03-032-1/+6
| | | | | | | | | | If ino == last_ino && dmajor == last_dmajor && dminor == last_dminor then we expect the file names to be the same as well. Which is reasonable if the input came from the /proc file system. But there could be bad user input if the file was supplied through dwfl_linux_proc_maps_report. Instead of asserting on the bad input, just signal a bad_report. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: elf-from-memory.c (elf_from_remote_memory): Check against p64 p_type.Mark Wielaard2014-02-262-1/+6
| | | | | | | There was a type in the case of parsing ELFCLASS64 phdrs. Check against p64 p_type, not the p32 p_type which at a different location in the union. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: More sanity checks before trying to display interpreter string.Mark Wielaard2014-02-242-2/+22
| | | | | | | Check there is a SHT_PROGBITS section at the offset given by p_offsets for a PT_INTERP segment before trying to display the interpreter string. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Robustify print_phdr program interpreter printing.Mark Wielaard2014-02-072-1/+9
| | | | | | | | Check phdr->p_filesz and make sure interpreter string is zero terminated before calling printf. Reported-by: Florian Weimer <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Read DW_AT_decl_file/line/column as unsignedJosh Stone2014-02-053-6/+17
| | | | | | | | | | | | 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 <[email protected]>
* backends: Make aarch64_regs.c checkable by -WprintfPetr Machata2014-01-302-22/+21
|
* backends: Add arm frame_nregs and set_initial_registers_tid.Mark Wielaard2014-01-306-2/+87
| | | | | | | | | | | | | 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 <[email protected]>
* backends: arm_cfi SP (r13) is restored from CFA by default.Mark Wielaard2014-01-304-1/+13
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* backends: Update arm_reloc.def.Mark Wielaard2014-01-302-2/+83
| | | | | | | | | 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 <[email protected]>
* Use -Wformat=2 by default for all files.Mark Wielaard2014-01-3012-92/+145
| | | | | | | | 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 <[email protected]>
* stack: Add -i, --inlines. Show inlined call frames using DWARF debuginfo.Mark Wielaard2014-01-277-79/+271
| | | | | | | | | | 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 <[email protected]>
* stack: Initialize -n maxframes to 256 by default.Mark Wielaard2014-01-272-2/+10
| | | | | | | Make -n default just 256 frames, 2048 was too big. Also Document magic number used in frames.allocated initialization. Signed-off-by: Mark Wielaard <[email protected]>
* stack: Add -d, --debugname. Lookup DWARF debuginfo name for frame address.Mark Wielaard2014-01-279-5/+196
| | | | | | | 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 <[email protected]>