aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace/elf.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-07sort.c: New file.Ian Lance Taylor1-2/+2
* sort.c: New file. * stest.c: New file. * internal.h (backtrace_qsort): Declare. * dwarf.c (read_abbrevs): Call backtrace_qsort instead of qsort. (read_line_info, read_function_entry): Likewise. (read_function_info, build_dwarf_data): Likewise. * elf.c (elf_initialize_syminfo): Likewise. * Makefile.am (libbacktrace_la_SOURCES): Add sort.c. (stest_SOURCES, stest_LDADD): Define. (check_PROGRAMS): Add stest. From-SVN: r208392
2014-01-02Update copyright years in libbacktrace/Richard Sandiford1-1/+1
From-SVN: r206292
2013-12-06elf.c (ET_DYN): Undefine and define again.Jakub Jelinek1-11/+43
* elf.c (ET_DYN): Undefine and define again. (elf_add): Add exe argument, if true and ehdr.e_type is ET_DYN, return early -1 without closing the descriptor. (struct phdr_data): Add exe_descriptor. (phdr_callback): If pd->exe_descriptor is not -1, for very first call if dlpi_name is NULL just call elf_add with the exe_descriptor, otherwise backtrace_close the exe_descriptor if not -1. Adjust call to elf_add. (backtrace_initialize): Adjust call to elf_add. If it returns -1, set pd.exe_descriptor to descriptor, otherwise set it to -1. From-SVN: r205748
2013-11-19backtrace.h (backtrace_syminfo_callback): Add symsize argument.Jakub Jelinek1-2/+2
* backtrace.h (backtrace_syminfo_callback): Add symsize argument. * elf.c (elf_syminfo): Pass 0 or sym->size to the callback as last argument. * btest.c (struct symdata): Add size field. (callback_three): Add symsize argument. Copy it to the data->size field. (f23): Set symdata.size to 0. (test5): Likewise. If sizeof (int) > 1, lookup address of ((uintptr_t) &global) + 1. Verify symdata.val and symdata.size values. From-SVN: r205028
2013-11-19configure.ac: Check for support of __atomic extensions.Ian Lance Taylor1-21/+10
* configure.ac: Check for support of __atomic extensions. * internal.h: Declare or #define atomic functions for use in backtrace code. * atomic.c: New file. * dwarf.c (dwarf_lookup_pc): Use atomic functions. (dwarf_fileline, backtrace_dwarf_add): Likewise. * elf.c (elf_add_syminfo_data, elf_syminfo): Likewise. (backtrace_initialize): Likewise. * fileline.c (fileline_initialize): Likewise. * Makefile.am (libbacktrace_la_SOURCES): Add atomic.c. * configure, config.h.in, Makefile.in: Rebuild. From-SVN: r204994
2013-11-18elf.c (SHN_UNDEF): Define.Jakub Jelinek1-3/+9
* elf.c (SHN_UNDEF): Define. (elf_initialize_syminfo): Add base_address argument. Ignore symbols with st_shndx == SHN_UNDEF. Add base_address to address fields. (elf_add): Adjust caller. From-SVN: r204975
2013-11-18* elf.c (phdr_callback): Process info->dlpi_addr == 0 normally.Jakub Jelinek1-6/+2
From-SVN: r204971
2013-11-16backtrace.h (backtrace_syminfo): Update comment and parameter name to take ↵Ian Lance Taylor1-14/+22
any address, not just a PC value. * backtrace.h (backtrace_syminfo): Update comment and parameter name to take any address, not just a PC value. * elf.c (STT_OBJECT): Define. (elf_nosyms): Rename parameter pc to addr. (elf_symbol_search): Rename local variable pc to addr. (elf_initialize_syminfo): Add STT_OBJECT symbols to elf_symbols. (elf_syminfo): Rename parameter pc to addr. * btest.c (global): New global variable. (test5): New test. (main): Call test5. From-SVN: r204904
2013-10-18elf.c (elf_add): Don't get the wrong offsets if a debug section is missing.Ian Lance Taylor1-2/+9
* elf.c (elf_add): Don't get the wrong offsets if a debug section is missing. From-SVN: r203810
2013-07-23elf.c (elf_syminfo): Loop over the elf_syminfo_data chain.Alexander Monakov1-5/+39
* elf.c (elf_syminfo): Loop over the elf_syminfo_data chain. From-SVN: r201159
2013-07-23elf.c (backtrace_initialize): Pass elf_fileline_fn to dl_iterate_phdr callbacks.Alexander Monakov1-1/+1
* elf.c (backtrace_initialize): Pass elf_fileline_fn to dl_iterate_phdr callbacks. From-SVN: r201158
2013-01-14Update copyright years in libbacktrace.Richard Sandiford1-1/+1
From-SVN: r195165
2012-10-26re PR other/55087 (bogus "linux-vdso.so.1: No such file or directory" caused ↵Ian Lance Taylor1-1/+3
by libbacktrace) PR other/55087 * posix.c (backtrace_open): Add does_not_exist parameter. * elf.c (phdr_callback): Do not warn if shared library could not be opened. * fileline.c (fileline_initialize): Update calls to backtrace_open. * internal.h (backtrace_open): Update declaration. From-SVN: r192861
2012-10-10elf.c: Rename all Elf typedefs to start with b_elf, and be all lower case.Ian Lance Taylor1-61/+61
* elf.c: Rename all Elf typedefs to start with b_elf, and be all lower case. From-SVN: r192331
2012-10-10* elf.c (elf_add_syminfo_data): Add casts to avoid warning.Hans-Peter Nilsson1-2/+2
From-SVN: r192311
2012-10-09Add support for tracing through shared libraries.Ian Lance Taylor1-29/+243
* configure.ac: Check for link.h and dl_iterate_phdr. * elf.c: #include <link.h> if system has dl_iterate_phdr. #undef ELF macros before #defining them. (dl_phdr_info, dl_iterate_phdr): Define if system does not have dl_iterate_phdr. (struct elf_syminfo_data): Add next field. (elf_initialize_syminfo): Initialize next field. (elf_add_syminfo_data): New static function. (elf_add): New static function, broken out of backtrace_initialize. Call backtrace_dwarf_add instead of backtrace_dwarf_initialize. (struct phdr_data): Define. (phdr_callback): New static function. (backtrace_initialize): Call elf_add. * dwarf.c (struct dwarf_data): Add next and base_address fields. (add_unit_addr): Add base_address parameter. Change all callers. (add_unit_ranges, build_address_map): Likewise. (add_line): Add ddata parameter. Change all callers. (read_line_program, add_function_range): Likewise. (dwarf_lookup_pc): New static function, broken out of dwarf_fileline. (dwarf_fileline): Call dwarf_lookup_pc. (build_dwarf_data): New static function. (backtrace_dwarf_add): New function. (backtrace_dwarf_initialize): Remove. * internal.h (backtrace_dwarf_initialize): Don't declare. (backtrace_dwarf_add): Declare. * configure, config.h.in: Rebuild. From-SVN: r192267
2012-09-27re PR other/54726 (libbacktrace segfaults on gcc_asserts with stripped gcc)Ian Lance Taylor1-1/+1
PR other/54726 * elf.c (backtrace_initialize): Set *fileln_fn, not state->fileln_fn. From-SVN: r191811
2012-09-17libbacktrace/:Ian Lance Taylor1-0/+688
* Initial implementation. ./: * MAINTAINERS (Various Maintainers): Add libbacktrace. * configure.ac (host_libs): Add libbacktrace. (target_libraries): Add libbacktrace. * Makefile.def (host_modules): Add libbacktrace. (target_modules): Likewise. * configure, Makefile.in: Rebuild. gcc/go: * config-lang.in (target_libs): Add target-libbacktrace. From-SVN: r191397