Alexandros Theodotou
208a7bace5
fix meson version
2 years ago
Alexandros Theodotou
be7dbb436d
meson external project
2 years ago
Alexandros Theodotou
5cdfe9719c
use configure & make
2 years ago
Alexandros Theodotou
57463fe1d7
add configure_h source
2 years ago
Alexandros Theodotou
01ba453003
remove warning level
2 years ago
Alexandros Theodotou
5048694526
add meson wrapper
2 years ago
Ian Lance Taylor
4f57c99971
libbacktrace: don't special case file 0
...
It's no longer necessary as file 0 is now set up in all cases.
* dwarf.c (read_line_program): Don't special case file 0.
(read_function_entry): Likewise.
Fixes #69
2 years ago
Ian Lance Taylor
59473f7906
libbacktrace: pass -1 to error callback for unrecognized DWARF
...
PR libbacktrace/98818
* dwarf.c (dwarf_buf_error): Add errnum parameter. Change all
callers.
* backtrace.h: Update backtrace_error_callback comment.
2 years ago
Ian Lance Taylor
7854b0bc25
libbacktrace: check for objcopy --add-gnu-debuglink using --help
...
* configure.ac: Check for objcopy --add-gnu-debuglink by using
objcopy --help.
* configure: Regenerate
2 years ago
Ian Lance Taylor
dedbe13fda
libbacktrace: don't fail tests if dwz fails
...
* Makefile.am (%_dwz): If dwz fails, use uncompressed debug info.
* Makefile.in: Regenerate.
2 years ago
Ian Lance Taylor
096650403a
libbacktrace: use correct directory/filename for DWARF 5
...
PR debug/98716
* dwarf.c (read_v2_paths): Allocate zero entry for dirs and
filenames.
(read_line_program): Remove parameter u, change caller. Don't
subtract one from dirs and filenames index.
(read_function_entry): Don't subtract one from filenames index.
2 years ago
Jakub Jelinek
5496ee0a1a
Update copyright years.
2 years ago
Ian Lance Taylor
1da441c1b0
libbacktrace: correct buffer overflow tests
...
* dwarf.c (resolve_string): Use > rather than >= to check whether
string index extends past buffer.
(resolve_addr_index): Similarly for address index.
3 years ago
Ian Lance Taylor
f24e9f401f
libbacktrace: update README
3 years ago
Ian Lance Taylor
73eb1803b1
libbacktrace: use __attribute__((__fallthrough__))
...
Use an attribute rather than a comment when falling through a switch case.
* internal.h (ATTRIBUTE_FALLTHROUGH): Define.
* elf.c (elf_zlib_inflate): Use ATTRIBUTE_FALLTHROUGH.
3 years ago
Ian Lance Taylor
5009c11398
libbacktrace: replace Tom Sawyer with Opticks
...
The main source uses Opticks now.
3 years ago
Ian Lance Taylor
3bd25ab355
libbacktrace/ChangeLog:
...
PR libbacktrace/97082
* Makefile.am (check_DATA): Add mtest.dSYM if USE_DSYMUTIL.
* Makefile.in: Regenerate.
3 years ago
Ian Lance Taylor
1286f69fde
libbacktrace: only run dsymutil with Mach-O
...
libbacktrace/ChangeLog:
PR libbacktrace/97227
* configure.ac (USE_DSYMUTIL): Define instead of HAVE_DSYMUTIL.
* Makefile.am: Change all uses of HAVE_DSYMUTIL to USE_DSYMUTIL.
* configure: Regenerate.
* Makefile.in: Regenerate.
3 years ago
Ian Lance Taylor
95e8e96c86
libbacktrace: handle pc == low correctly
...
* dwarf.c (report_inlined_functions): Handle PC == -1 and PC ==
p->low.
(dwarf_lookup_pc): Likewise.
3 years ago
Ian Lance Taylor
c8a81d4e3a
libbacktrace: use ELF symbol table if no debug info available
...
PR libbacktrace/97080
* fileline.c (backtrace_syminfo_to_full_callback): New function.
(backtrace_syminfo_to_full_error_callback): New function.
* elf.c (elf_nodebug): Call syminfo_fn if possible.
* internal.h (struct backtrace_call_full): Define.
(backtrace_syminfo_to_full_callback): Declare.
(backtrace_syminfo_to_full_error_callback): Declare.
* mtest.c (f3): Only check all[i] if data.index permits.
3 years ago
Iain Sandoe
753968c2e8
libbacktrace, Mach-O : Support PowerPC archs.
...
This adds the PPC architecture variants for Mach-O libbacktrace.
With this (as for X86 and Arm) when dsymutil is run on the binary
we get a basic usable backtrace.
Testsuite results on powerpc-apple-darwin9 are the same as for X86:
* btest fails (TBC why)
* dwarf5 tests fail because dsymutil does not handle that so far.
libbacktrace/ChangeLog:
* macho.c (MACH_O_CPU_TYPE_PPC): New.
(MACH_O_CPU_TYPE_PPC64): New.
Add compile-tests for powerpc to the Mach-O variants.
Close #55
3 years ago
Ian Lance Taylor
77bcaa99f5
libbacktrace: support MiniDebugInfo
...
libbacktrace/ChangeLog:
PR libbacktrace/93608
Add support for MiniDebugInfo.
* elf.c (struct elf_view): Define. Replace most uses of
backtrace_view with elf_view.
(elf_get_view): New static functions. Replace most calls of
backtrace_get_view with elf_get_view.
(elf_release_view): New static functions. Replace most calls of
backtrace_release_view with elf_release_view.
(elf_uncompress_failed): Rename from elf_zlib_failed. Change all
callers.
(LZMA_STATES, LZMA_POS_STATES, LZMA_DIST_STATES): Define.
(LZMA_DIST_SLOTS, LZMA_DIST_MODEL_START): Define.
(LZMA_DIST_MODEL_END, LZMA_FULL_DISTANCES): Define.
(LZMA_ALIGN_SIZE, LZMA_LEN_LOW_SYMBOLS): Define.
(LZMA_LEN_MID_SYMBOLS, LZMA_LEN_HIGH_SYMBOLS): Define.
(LZMA_LITERAL_CODERS_MAX, LZMA_LITERAL_CODER_SIZE): Define.
(LZMA_PROB_IS_MATCH_LEN, LZMA_PROB_IS_REP_LEN): Define.
(LZMA_PROB_IS_REP0_LEN, LZMA_PROB_IS_REP1_LEN): Define.
(LZMA_PROB_IS_REP2_LEN, LZMA_PROB_IS_REP0_LONG_LEN): Define.
(LZMA_PROB_DIST_SLOT_LEN, LZMA_PROB_DIST_SPECIAL_LEN): Define.
(LZMA_PROB_DIST_ALIGN_LEN): Define.
(LZMA_PROB_MATCH_LEN_CHOICE_LEN): Define.
(LZMA_PROB_MATCH_LEN_CHOICE2_LEN): Define.
(LZMA_PROB_MATCH_LEN_LOW_LEN): Define.
(LZMA_PROB_MATCH_LEN_MID_LEN): Define.
(LZMA_PROB_MATCH_LEN_HIGH_LEN): Define.
(LZMA_PROB_REP_LEN_CHOICE_LEN): Define.
(LZMA_PROB_REP_LEN_CHOICE2_LEN): Define.
(LZMA_PROB_REP_LEN_LOW_LEN): Define.
(LZMA_PROB_REP_LEN_MID_LEN): Define.
(LZMA_PROB_REP_LEN_HIGH_LEN): Define.
(LZMA_PROB_LITERAL_LEN): Define.
(LZMA_PROB_IS_MATCH_OFFSET, LZMA_PROB_IS_REP_OFFSET): Define.
(LZMA_PROB_IS_REP0_OFFSET, LZMA_PROB_IS_REP1_OFFSET): Define.
(LZMA_PROB_IS_REP2_OFFSET): Define.
(LZMA_PROB_IS_REP0_LONG_OFFSET): Define.
(LZMA_PROB_DIST_SLOT_OFFSET): Define.
(LZMA_PROB_DIST_SPECIAL_OFFSET): Define.
(LZMA_PROB_DIST_ALIGN_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_CHOICE_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_CHOICE2_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_LOW_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_MID_OFFSET): Define.
(LZMA_PROB_MATCH_LEN_HIGH_OFFSET): Define.
(LZMA_PROB_REP_LEN_CHOICE_OFFSET): Define.
(LZMA_PROB_REP_LEN_CHOICE2_OFFSET): Define.
(LZMA_PROB_REP_LEN_LOW_OFFSET): Define.
(LZMA_PROB_REP_LEN_MID_OFFSET): Define.
(LZMA_PROB_REP_LEN_HIGH_OFFSET): Define.
(LZMA_PROB_LITERAL_OFFSET): Define.
(LZMA_PROB_TOTAL_COUNT): Define.
(LZMA_IS_MATCH, LZMA_IS_REP, LZMA_IS_REP0): Define.
(LZMA_IS_REP1, LZMA_IS_REP2, LZMA_IS_REP0_LONG): Define.
(LZMA_DIST_SLOT, LZMA_DIST_SPECIAL, LZMA_DIST_ALIGN): Define.
(LZMA_MATCH_LEN_CHOICE, LZMA_MATCH_LEN_CHOICE2): Define.
(LZMA_MATCH_LEN_LOW, LZMA_MATCH_LEN_MID): Define.
(LZMA_MATCH_LEN_HIGH, LZMA_REP_LEN_CHOICE): Define.
(LZMA_REP_LEN_CHOICE2, LZMA_REP_LEN_LOW): Define.
(LZMA_REP_LEN_MID, LZMA_REP_LEN_HIGH, LZMA_LITERAL): Define.
(elf_lzma_varint): New static function.
(elf_lzma_range_normalize): New static function.
(elf_lzma_bit, elf_lzma_integer): New static functions.
(elf_lzma_reverse_integer): New static function.
(elf_lzma_len, elf_uncompress_lzma_block): New static functions.
(elf_uncompress_lzma): New static function.
(backtrace_uncompress_lzma): New function.
(elf_add): Add memory and memory_size parameters. Change all
callers. Look for .gnu_debugdata section, and, if found,
decompress it and use it for symbols and debug info. Permit the
descriptor parameter to be -1.
* internal.h (backtrace_uncompress_lzma): Declare.
* mtest.c: New file.
* xztest.c: New file.
* configure.ac: Check for nm, xz, and comm programs. Check for
liblzma library.
(HAVE_MINIDEBUG): Define.
* Makefile.am (mtest_SOURCES): Define.
(mtest_CFLAGS, mtest_LDADD): Define.
(TESTS): Add mtest_minidebug if HAVE_MINIDEBUG.
(%_minidebug): New pattern rule, if HAVE_MINIDEBUG.
(xztest_SOURCES, xztest_CFLAGS, xztest_LDADD): Define.
(xztest_alloc_SOURCES, xztest_alloc_CFLAGS): Define
(xztest_alloc_LDADD): Define.
(BUILDTESTS): Add mtest, xztest, xztest_alloc.
(CLEANFILES): Add files created by minidebug pattern.
(btest.lo): Correct INCDIR reference.
(mtest.lo, xztest.lo, ztest.lo): New targets.
* configure: Regenerate.
* config.h.in: Regenerate.
* Makefile.in: Regenerate.
Close #38
3 years ago
Ian Lance Taylor
2f5efbfa32
libbacktrace: don't strip leading underscore on 64-bit PE
...
* pecoff.c (coff_initialize_syminfo): Add is_64 parameter.
(coff_add): Determine and pass is_64.
Closes #28
3 years ago
Ian Lance Taylor
4ae8d988a7
libbacktrace: fetch executable path on macOS
...
PR libbacktrace/96973
* fileline.c (macho_get_executable_path): New static function.
(fileline_initialize): Call macho_get_executable_path.
3 years ago
Ian Lance Taylor
430dc8b6fe
libbacktrace: avoid ambiguous binary search
...
Searching for a range match can cause the search order to not match
the sort order, which can cause libbacktrace to miss matching entries.
Allocate an extra entry at the end of function_addrs and unit_addrs vectors,
so that we can safely compare to the next entry when searching.
Adjust the matching code accordingly.
Fixes #44
* dwarf.c (function_addrs_search): Compare against the next entry
low address, not the high address.
(unit_addrs_search): Likewise.
(build_address_map): Add a trailing unit_addrs.
(read_function_entry): Add a trailing function_addrs.
(read_function_info): Likewise.
(report_inlined_functions): Search backward for function_addrs
match.
(dwarf_lookup_pc): Search backward for unit_addrs and
function_addrs matches.
3 years ago
Ian Lance Taylor
5dec0fae31
libbacktrace: fix tipo in comment
...
* simple.c (simple_unwind): Correct comment spelling.
Close #47
3 years ago
Ian Lance Taylor
030bd0a709
libbacktrace: correct memory lengths in Mach-O dsym support
...
* macho.c (macho_add_dsym): Make space for '/' in dsym. Use
correct length when freeing diralc.
Close #40
3 years ago
Ian Lance Taylor
b3b57f9ee0
libbacktrace: correctly swap Mach-O 32-bit file offset
...
libbacktrace/ChangeLog:
PR libbacktrace/96973
* macho.c (macho_add_fat): Correctly swap 32-bit file offset.
3 years ago
Ian Lance Taylor
886aef3783
libbacktrace: only match magic number at start of line
...
libbacktrace/ChangeLog:
PR libbacktrace/96971
* filetype.awk: Only match magic number at start of line.
3 years ago
Ian Lance Taylor
89b2b5066b
libbacktrace: add Mach-O 64-bit FAT support
...
libbacktrace/:
* macho.c (MACH_O_MH_MAGIC_FAT_64): Define.
(MACH_O_MH_CIGAM_FAT_64): Define.
(struct macho_fat_arch_64): Define.
(macho_add_fat): Add and use is_64 parameter.
(macho_add): Recognize 64-bit fat files.
3 years ago
Ian Lance Taylor
aaa51b6dbe
libbacktrace: test linker support for DWARF 5
...
On AIX, the compiler supports DWARF 5 but the linker does not.
2020-07-07 Clement Chigot <clement.chigot@atos.net>
* configure.ac: Test linker support for DWARF5
* configure: Regenerate
3 years ago
Ian Lance Taylor
9b7f216e86
libbacktrace: mark test_large parameter unused in ztest.c
3 years ago
Ian Lance Taylor
d68a7ac6dd
libbacktrace: treat EACCESS like ENOENT
...
For https://gcc.gnu.org/PR95061
3 years ago
Ian Lance Taylor
14465a9574
libbacktrace: declare getpagesize if necessary
...
Fixes https://gcc.gnu.org/PR95012 .
3 years ago
Ian Lance Taylor
7206f5bd06
libbacktrace: don't crash if ELF file has no sections
...
Patch from Roland McGrath.
Fixes #41
3 years ago
Ian Lance Taylor
ca0de0517f
libbacktrace: don't free ELF strtab if error occurs after saving syminfo
...
Fixes #29
3 years ago
Ian Lance Taylor
4e548e735f
libbacktrace: add preliminary Mach-O support
3 years ago
Ian Lance Taylor
929d6205cf
libbacktrace: always pass -g when compiling test code
...
This approach required adding a few casts to ztest.c, as it is now
compiled with -Wall.
Fixes GCC PR libbacktrace/90636
3 years ago
Ian Lance Taylor
bd02146d90
Update copyright years.
3 years ago
Ian Lance Taylor
75cac302a5
libbacktrace: update to current libgo test file
3 years ago
Ian Lance Taylor
4e14a008cd
libbacktrace: support short read
...
Fixes #32
3 years ago
Ian Lance Taylor
aced4e1f2a
libbacktrace: if debug info large or split, read sections individually
...
Fixes #29
3 years ago
Ian Lance Taylor
0f06cda953
libbacktrace: support fetching executable name using sysctl
...
This supports FreeBSD and NetBSD when /proc is not mounted.
3 years ago
Ian Lance Taylor
559ab7cab4
libbacktrace: update to current version from GCC trunk
...
This adds DWARF 5 support as well as an enhanced testsuite.
Patch assembled by Than McIntosh.
4 years ago
Ian Lance Taylor
5a99ff7fed
config.guess, config.sub: update to latest versions
...
Update to config.guess 2018-05-19 and config.sub 2018-05-24 from
git://git.savannah.gnu.org/config.git revision
3a2a927f547ee478147008c3fda2adb8a2b2ebc4.
This brings in musl support.
5 years ago
Ian Lance Taylor
22508c46b3
config.guess, config.sub: update to current GCC versions
...
Copied from GCC revision 256122.
5 years ago
Ian Lance Taylor
1b8128cf56
* backtrace.c: Revert last change. Don't call mmap
...
directly.
Updates #13
5 years ago
Ian Lance Taylor
012b950b37
Copy changes from GCC:
...
2018-04-17 Ian Lance Taylor <iant@golang.org>
* backtrace.c (backtrace_full): When testing whether we can
allocate memory, call mmap directly, and munmap the memory.
2018-04-04 Jakub Jelinek <jakub@redhat.com>
PR other/85161
* elf.c (elf_zlib_fetch): Fix up predefined macro names in test for
big endian, only use 32-bit loads if endianity macros are predefined
and indicate big or little endian.
2018-02-15 Jakub Jelinek <jakub@redhat.com>
PR other/82368
* elf.c (SHT_PROGBITS): Undefine and define.
2018-02-14 Jakub Jelinek <jakub@redhat.com>
PR other/82368
* elf.c (EM_PPC64, EF_PPC64_ABI): Undefine and define.
(struct elf_ppc64_opd_data): New type.
(elf_initialize_syminfo): Add opd argument, handle symbols
pointing into the PowerPC64 ELFv1 .opd section.
(elf_add): Read .opd section on PowerPC64 ELFv1, pass pointer
to structure with .opd data to elf_initialize_syminfo.
2018-01-19 Tony Reix <tony.reix@atos.net>
* xcoff.c (xcoff_incl_compare): New function.
(xcoff_incl_search): New function.
(xcoff_process_linenos): Use bsearch to find include file.
(xcoff_initialize_fileline): Sort include file information.
Fixes #13
5 years ago
Ian Lance Taylor
177940370e
* elf.c (elf_add): Close descriptor if we use a debugfile.
...
* btest.c (check_open_files): New static function.
(main): Call check_open_files.
5 years ago
Ian Lance Taylor
811741b03b
* elf.c (elf_open_debugfile_by_debuglink): Don't check CRC if the
...
desired CRC is zero.
(elf_add): Don't clear *found_sym and *found_dwarf if debuginfo.
5 years ago