summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Make it explicit in comments that dwarf_macro_paramN fetche (N-1)th parampmachata/macroPetr Machata2014-11-071-4/+4
|
* Fix dwarf_macro_param1Petr Machata2014-11-071-1/+1
|
* End Dwarf in dwarf-getmacros test casePetr Machata2014-11-071-0/+2
|
* Nits for additional filesPetr Machata2014-11-071-4/+4
|
* Update per the reviewPetr Machata2014-11-044-24/+23
|
* Additional files for .debug_macro supportPetr Machata2014-11-043-0/+177
|
* Test cases for .debug_macro supportPetr Machata2014-10-173-174/+663
| | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
* Support .debug_macroPetr Machata2014-10-1711-711/+1364
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - This code is based on the following proposal: http://www.dwarfstd.org/ShowIssue.php?issue=110722.1 - dwarf_getmacros serves either of .debug_macinfo or .debug_macro transparently, but if the latter uses opcode 0xff, it bails out with an error. The reason is that in .debug_macro, 0xff is a custom code that can mean anything, while in .debug_macinfo there's fixed semantics associated with 0xff. - dwarf_getmacros_off is a new interface used for requesting iteration through transparently included units. - dwarf_macro_getparamcnt and dwarf_macro_param are new interfaces used for requesting number of parameters of an opcode and individual parameters. dwarf_macro_getsrcfiles is a new interface used for requesting a file part of .debug_line unit associated with macro unit that the opcode comes from. - The existing interfaces dwarf_macro_opcode, dwarf_macro_param1 and dwarf_macro_param2 remain operational for old- as well as new-style Dwarf macro sections, if applicable. - dwarf_getsrclines was made into a light wrapper around a worker function that loads line unit given its offset. The worker also caches loaded units in an offset-keyed search tree, so that we don't end up re-reading units even though they were read in a different domain (e.g. a macro unit request can prime cache for later CU lookup). dwarf_macro_getsrcfiles calls the worker function under covers. Signed-off-by: Petr Machata <pmachata@redhat.com>
* Drop unused field struct Dwarf_Files_s.cuPetr Machata2014-10-153-5/+6
| | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
* dwarf.h: Add DW_AT_GNU_deleted.Mark Wielaard2014-10-052-0/+5
| | | | | | | | | DW_AT_GNU_deleted is added by G++ for C++11 deleted special member functions (= delete;). This is a constant only addition to dwarf.h. No other part of elfutils currently depends on this attribute. Also added to https://fedorahosted.org/elfutils/wiki/DwarfExtensions Signed-off-by: Mark Wielaard <mjw@redhat.com>
* tests: run-deleted.sh unset VALGRIND_CMD before running deleted.Mark Wielaard2014-10-022-0/+12
| | | | | | | We don't want to run the deleted test process under valgrind then eu-stack will see the valgrind process backtrace. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdw: dwarf_aggregate_size return CU address_size for sizeless pointer/refs.Mark Wielaard2014-10-028-4/+182
| | | | | Tested-by: Conrad Meyer <cse.cem@gmail.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Support note NT_FILE for locating files.Jan Kratochvil2014-09-2611-37/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Martin Milata: ------------------------------------------------------------------------------ RFE: dwfl_core_file_report: use NT_FILE core note if the link_map chain is broken https://bugzilla.redhat.com/show_bug.cgi?id=1129777 The dwfl_core_file_report function follows dynamic linker's link_map chain in order to determine the shared libraries used by the executable. As this data structure is located in writable memory it can be overwritten by garbage, which is sometimes the case. https://github.com/abrt/satyr/issues/127#issuecomment-46957546 Since version 3.7 (commit 2aa362c49), Linux kernel adds NT_FILE note to core files which contains the files mapped by the process, including shared libraries. ------------------------------------------------------------------------------ dwfl_core_file_report now tries to fall back on NT_FILE if the link_map chain is broken. elfutils would already find the appropriate binary file from /usr/lib/debug/.build-id/ symbolic links. But those symbolic links do not have to be present on the system while NT_FILE still points to the correct binaries. Filenames from the note NT_FILE are used only if link_map filenames failed to locate matching binaries. tests/test-core.core.bz2 had to have its NT_FILE disabled as run-unstrip-n.sh otherwise FAILs: FAIL: 0x7f67f2aaf000+0x202000 - . - /home/jkratoch/redhat/elfutils-libregr/test-core-lib.so PASS: 0x7f67f2aaf000+0x202000 - . - test-core-lib.so As test-core-lib.so is found in link_map but it is not present on the disk elfutils now chooses the more reliable filename from NT_FILE (although that filename is also not found on the disk). Updating the expected text would be also sufficient. libdwfl/ 2014-09-26 Jan Kratochvil <jan.kratochvil@redhat.com> Support NT_FILE for locating files. * core-file.c (dwfl_core_file_report): New variables note_file and note_file_size, set them and pass them to dwfl_segment_report_module. * dwfl_segment_report_module.c: Include common.h and fcntl.h. (buf_has_data, buf_read_ulong, handle_file_note): New functions. (invalid_elf): New function from code of dwfl_segment_report_module. (dwfl_segment_report_module): Add parameters note_file and note_file_size. New variables elf and fd, clean them up in finish. Move some code to invalid_elf. Call handle_file_note, if it found a name verify the file by invalid_elf. Protect elf and fd against cleanup by finish if we found the file for new Dwfl_Module. * libdwflP.h (dwfl_segment_report_module): Add parameters note_file and note_file_size. tests/ 2014-09-26 Jan Kratochvil <jan.kratochvil@redhat.com> Support NT_FILE for locating files. * Makefile.am (TESTS): Add run-linkmap-cut.sh. (EXTRA_DIST): Add run-linkmap-cut.sh, linkmap-cut-lib.so.bz2, linkmap-cut.bz2 and linkmap-cut.core.bz2 . * linkmap-cut-lib.so.bz2: New file. * linkmap-cut.bz2: New file. * linkmap-cut.core.bz2: New file. * run-linkmap-cut.sh: New file. * run-unstrip-n.sh: Update its expected output. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* libdwfl: dwfl_segment_report_module use ei_class, ei_data and e_type.Mark Wielaard2014-09-232-20/+28
| | | | | | | | To make it easier to see that the code is using the correct fields of the ehdr e32/e64 union extract ei_class, ei_data and e_type early and use them directly. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* readelf: Fix typo in a check in handle_relocs_relaPetr Machata2014-09-232-1/+5
| | | | | | | | - Testing shdr makes no sense, that pointer was dereferenced several times throughout the section. destshdr on the other hand is not tested at all. Signed-off-by: Petr Machata <pmachata@redhat.com>
* Add is_executable to Dwfl_Module.Jan Kratochvil2014-09-184-4/+17
| | | | | | | | | | | | | | | | Next patch will find module names from NT_FILE note so that main executable will no longer necessarily have the name "[exe]" or "[pie]". -e|--executable still should be able to override such module. libdwfl/ 2014-09-18 Jan Kratochvil <jan.kratochvil@redhat.com> * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Use IS_EXECUTABLE. * dwfl_segment_report_module.c (dwfl_segment_report_module): Set IS_EXECUTABLE. * libdwflP.h (struct Dwfl_Module): New field is_executable. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Rename read_ubyte_unaligned_inc to read_addr_unaligned_incPetr Machata2014-09-124-27/+27
| | | | | | | | | | | | | | - The behavior of this function has been changed to read only address-sized quantities, i.e. the size of 2 is no longer allowed. (Size of 1 never was.) The two outstanding uses, both in readelf.c, which actually do use this call to read address-sized units, were updated, rejecting fields that indicate weird address sizes. - The three related calls, read_sbyte_unaligned_inc, read_ubyte_unaligned and read_sbyte_unaligned were dropped. There are currently no uses for these calls. Signed-off-by: Petr Machata <pmachata@redhat.com>
* Accept DW_AT_GNU_call_site_* as attributes that hold location expressionsPetr Machata2014-09-112-1/+11
| | | | | | | | | | | - These are extension attributes that correspond in behavior to attributes described in this proposal: http://www.dwarfstd.org/ShowIssue.php?issue=100909.2 - N.B.: DW_AT_call_site_data_location doesn't have a DW_AT_GNU_* counterpart. Signed-off-by: Petr Machata <pmachata@redhat.com>
* elf_begin sets elf_errno for cases that the file is completely unreadablePetr Machata2014-09-112-3/+11
| | | | | | | | | | | | | | - The problem this is trying to solve can be seen for example thus: $ eu-readelf -a / eu-readelf: failed reading '/': (null) With the fix we see a proper error number and get a reasonable error message: $ eu-readelf -a / eu-readelf: failed reading '/': invalid file descriptor Signed-off-by: Petr Machata <pmachata@redhat.com>
* Fix resolving ELF symbols for live PIDs with deleted filesJan Kratochvil2014-08-297-8/+138
| | | | | | | | | | | | | | | | For deleted shared library files the offsets to the symbol table were calculated wrongly from the phdrs because the main_bias wasn't taken into account. Formerly shared libraries did not get resolved properly: #2 0x00007fc4d86c56d6 #3 0x0000000000400938 main Fixed elfutils produce: #2 0x00007f61094876d6 libfunc #3 0x0000000000400938 main Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Prevent premature @AR@ replacement in a sed expression.elfutils-0.160Josh Stone2014-08-252-1/+5
| | | | | | | | | | | | The Makefile rule for make-debug-archive has a sed expression to replace @AR@ will the installed name, but this was itself getting replaced when the Makefile was configured, for a pattern like "s,ar,/path/prefix-,g". Havoc ensued in the resulting make-debug-archive. The fix matches it using a regex bracket expression, "[@]AR[@]", so sed will still match it, but it's immune to configure's replacement. Signed-off-by: Josh Stone <jistone@redhat.com>
* Prepare 0.160 release.Mark Wielaard2014-08-2511-2729/+2895
| | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdw: Add new function dwarf_cu_die.Mark Wielaard2014-08-157-3/+101
| | | | | | | | | | Given a Dwarf_Die or Dwarf_Attribute it is often convenient to get at the CU DIE and the CU header information. There is dwarf_diecu but that doesn't provide all information from the header and it doesn't work for attributes. Add a new dwarf_cu_die function that provides all information given a Dwarf_CU, which both Dwarf_Die and Dwarf_Attribute reference. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdw: Add new function dwarf_cu_getdwarf.Mark Wielaard2014-08-157-2/+75
| | | | | | | | | | | In both systemtap and libabigail there is a need to get the actual Dwarf underlying an Dwarf_Die or Dwarf_Attribute. Following a DIE reference might end up in an alternate Dwarf since the addition of DWZ multifile forms. Both Dwarf_Die and Dwarf_Attribute already contain a Dwarf_CU handle. Add a function dwarf_cu_getdwarf to retrieve the underlying Dwarf using the Dwarf_CU. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Handle LZMA .ko.xz compressed kernel modules.Mark Wielaard2014-08-152-0/+7
| | | | | | | Linux kernel modules can not just be compressed with gz and bz2, but also with xz. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* aarch64: use <sys/user.h> defined register structuresKyle McMartin2014-08-015-4/+39
| | | | | | | | | | | glibc now supplies these (compatible) structs instead of including the kernel's <asm/ptrace.h> header, so let's use them. Annoyingly this will cause new elfutils to FTBFS on old glibc, and vice versa. So include a new configure check for the new struct names and use the old ones if they are not avilable. Signed-off-by: Kyle McMartin <kyle@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Fix report_r_debug for prelinked librariesJan Kratochvil2014-07-282-3/+16
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* m4: Handle cross-compile situations in biarch.m4 tests.Mark Wielaard2014-07-142-1/+6
| | | | | Reported-by: Leonard Crestez <lcrestez@ixiacom.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Add ppc64le ELFv2 abi support to backends and elflint.Mark Wielaard2014-07-046-2/+45
| | | | | | | | | | The big endian vs little endian changes are already handled by detecting the EI_DATA data encoding. And the function descriptors are already not used when we see there is no .opd section. This change adds new checks for st_other bits, new relocations and recognizes DT_PPC64_OPT. Signed-off-by: Menanteau Guy <menantea@linux.vnet.ibm.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Update elf.h from glibc.Mark Wielaard2014-07-042-1/+33
| | | | | | | Includes new bits needed for ppc64le ELFv2 abi. https://bugzilla.redhat.com/show_bug.cgi?id=1110249 Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: aarch64_return_value_location should handle DW_ATE_boolean.Mark Wielaard2014-07-042-0/+6
| | | | | | | Found with run-native-test.sh om debian arm64. http://bugs.debian.org/753552 Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Make the attach code build again on non-Linux hosts.Kurt Roeckx2014-06-252-0/+21
| | | | Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
* dwarf.h: Remove non-existing DW_TAG_mutable_type.Mark Wielaard2014-06-224-4/+13
| | | | | | | | | | | | | | | The DW_TAG_mutable_type was only mentioned in an early draft of DWARFv3. But was removed because there are no C++ mutable qualified types. It was replaced by a new attribute DW_AT_mutable on DW_TAG_member DIEs. The new attribute is available in dwarf.h. http://dwarfstd.org/ShowIssue.php?issue=050223.1 DW_TAG_mutable_type was only used internally in some backends (which just ignored it anyway). dwarves did use it to turn it into a string value, libabigail used it and ignored it (patches to remove sent). GCC, GDB and binutils don't use nor define it. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libebl: Add ebl_func_addr_mask plus ARM backend implementation.Mark Wielaard2014-06-2212-14/+70
| | | | | | | | | | | | | | The ARM EABI says that the zero bit of function symbol st_value indicates whether the symbol points to a THUMB or ARM function. Also the return value address in an unwind will contain the same extra bit to indicate whether to return to a regular ARM or THUMB function. Add a new ebl function to mask off such bits and turn a function value into a function address so that we get the actual value that a function symbol or return address points to. It isn't easily possible to reuse the existing ebl_resolve_sym_value for this purpose, so we end up with another hook that can be used from dwfl_module_getsym, handle_cfi and elflint. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends (*_return_value_location): call dwarf_peeled_die_typePetr Machata2014-06-2012-325/+208
| | | | | | ... instead of inlining equivalent code. Signed-off-by: Petr Machata <pmachata@redhat.com>
* tests/backtrace.c (frame_callback): Error on seeing more than 16 frames.Mark Wielaard2014-06-172-0/+11
| | | | | | Don't fill up the test logs with obviously bogus frames. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* tests: backtrace.c accept __libc_do_syscall as first frame symname.Mark Wielaard2014-06-172-1/+7
| | | | | | | | On some architectures (Debian armhl) system calls go through __libc_do_syscall instead of __kernel_vsyscall. Accept either of these symbol names for the first backtrace frame. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* tests: backtrace-subr.sh add check_native_unsupported.Mark Wielaard2014-06-173-4/+18
| | | | | | | | The special arm check in check_unsupported should only trigger for native tests, otherwise on arm various backtrace tests would be skipped that should work just fine. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: linux-core-attach.c handle possible unaligned data access.Mark Wielaard2014-06-172-11/+20
| | | | | | | | Use libdw/memory-access.h macros read_4ubyte_unaligned_noncvt and read_8ubyte_unaligned_noncvt to access possibly unaligned data in core files. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Record dwfl_attach_state error and return it on failure.Mark Wielaard2014-06-117-35/+107
| | | | | | | | | | | When dwfl_attach_state fails functions that need the process state should return the error that caused the attach to fail. Use this in the backtrace test to signal any attach failure. This makes sure that architectures that don't provide unwinder support get properly detected (and the tests SKIPs) Also don't assert when trying to attach a non-core ELF file, but return an error to indicate failure. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: dwfl_standard_argp should not fail when not able to attach Dwfl.Mark Wielaard2014-06-112-8/+10
| | | | | | | | | | | | | | | | As pointed out in https://bugzilla.redhat.com/show_bug.cgi?id=1107654 commit 191080 introduced a thinko that caused dwfl_standard_argp to fail if the Dwfl couldn't be attached. Instead of generating a warning as the comment intended, the failure would be fatal. But even warning about dwfl_core_file_attach () or dwfl_linux_proc_attach () failing would be a mistake. The caller/user might not be interested in such a non-fatal issue. So just ignore if the call failed for whatever reason. If the caller is interested in warning up front about this issue, then dwfl_pid () should be called to check the Dwfl is attached. Things should work just fine for anything that doesn't call any of the dwfl_state related functions. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* readelf: Skip section if name is NULL in print_debug.Mark Wielaard2014-05-272-1/+7
| | | | | | | | Don't crash and burn when a section doesn't have a name (possibly invalid ELF file string table). Just try the next section instead of calling strcmp on NULL. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* 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 <mjw@redhat.com>
* 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 <mjw@redhat.com>
* 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 <mjw@redhat.com>
* Regenerate *.po files.elfutils-0.159Mark Wielaard2014-05-206-1110/+1114
| | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
* 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 <mjw@redhat.com>
* 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 <mjw@redhat.com>
* Prepare 0.159 release.Mark Wielaard2014-05-1811-3279/+3358
| | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
* 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 <mjw@redhat.com>