Commit Graph

43 Commits

Author SHA1 Message Date
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
2020-09-27 17:19:28 -07:00
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.
2020-09-27 17:18:38 -07:00
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.
2020-09-27 17:17:59 -07:00
Ian Lance Taylor
5dec0fae31 libbacktrace: fix tipo in comment
* simple.c (simple_unwind): Correct comment spelling.

Close #47
2020-09-27 17:17:10 -07:00
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
2020-09-27 17:16:15 -07:00
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.
2020-09-27 17:15:03 -07:00
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.
2020-09-27 17:14:27 -07:00
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.
2020-09-27 17:13:21 -07:00
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
2020-09-27 17:12:15 -07:00
Ian Lance Taylor
9b7f216e86 libbacktrace: mark test_large parameter unused in ztest.c 2020-05-13 11:11:13 -07:00
Ian Lance Taylor
d68a7ac6dd libbacktrace: treat EACCESS like ENOENT
For https://gcc.gnu.org/PR95061
2020-05-13 10:29:45 -07:00
Ian Lance Taylor
14465a9574 libbacktrace: declare getpagesize if necessary
Fixes https://gcc.gnu.org/PR95012.
2020-05-11 10:54:46 -07:00
Ian Lance Taylor
7206f5bd06 libbacktrace: don't crash if ELF file has no sections
Patch from Roland McGrath.

Fixes #41
2020-05-09 20:36:19 -07:00
Ian Lance Taylor
ca0de0517f libbacktrace: don't free ELF strtab if error occurs after saving syminfo
Fixes #29
2020-02-19 10:32:09 -08:00
Ian Lance Taylor
4e548e735f libbacktrace: add preliminary Mach-O support 2020-02-18 18:57:14 -08:00
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
2020-02-18 18:49:42 -08:00
Ian Lance Taylor
bd02146d90 Update copyright years. 2020-02-18 18:46:13 -08:00
Ian Lance Taylor
75cac302a5 libbacktrace: update to current libgo test file 2020-02-15 18:26:32 -08:00
Ian Lance Taylor
4e14a008cd libbacktrace: support short read
Fixes #32
2020-02-15 18:14:20 -08:00
Ian Lance Taylor
aced4e1f2a libbacktrace: if debug info large or split, read sections individually
Fixes #29
2020-02-15 17:58:09 -08:00
Ian Lance Taylor
0f06cda953 libbacktrace: support fetching executable name using sysctl
This supports FreeBSD and NetBSD when /proc is not mounted.
2020-02-15 15:33:11 -08:00
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.
2019-12-23 18:55:51 -08:00
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.
2018-06-05 08:00:51 -07:00
Ian Lance Taylor
22508c46b3 config.guess, config.sub: update to current GCC versions
Copied from GCC revision 256122.
2018-06-05 07:37:14 -07:00
Ian Lance Taylor
1b8128cf56 * backtrace.c: Revert last change. Don't call mmap
directly.

Updates #13
2018-04-17 10:59:18 -07:00
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
2018-04-17 07:04:02 -07:00
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.
2018-01-31 15:24:01 -08:00
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.
2018-01-25 10:14:34 -08:00
Ian Lance Taylor
8a4e4ea552 * pecoff.c (coff_add): Only release syms_view if it is valid. 2018-01-25 07:38:52 -08:00
Ian Lance Taylor
97dd0dfa9e * pecoff.c (coff_add): Another memcpy -> coff_read4 fix.
Updates #11
2018-01-25 07:34:02 -08:00
Ian Lance Taylor
4300eedae4 * pecoff.c (coff_add): Use coff_read4, not memcpy.
Fixes #3
2018-01-24 18:42:50 -08:00
Ian Lance Taylor
051ecb46f8 README: mention XCOFF, call this version 1.0
Fixes #1
2018-01-24 18:37:06 -08:00
Ian Lance Taylor
b0d690331d * mmap.c (backtrace_free_locked): Don't put more than 16 entries
on the free list.

Fixes #5
Fixes rust-lang/rust#29293
Fixes rust-lang/rust#37477
2018-01-24 18:25:39 -08:00
Ian Lance Taylor
3739537b9c libbacktrace: rebuild configury with GCC standard tool versions
Add required support files to the config subdirectory.

Update dtest to be based on a statically linked program.
2018-01-16 17:42:38 -08:00
Ian Lance Taylor
4183d76f92 Add text used for "inflate large" test. 2018-01-16 17:40:25 -08:00
Ian Lance Taylor
f2c17c0417 libbacktrace: update to GCC SVN revision 256776
This brings in this patch:

	* elf.c (codes) [GENERATE_FIXED_HUFFMAN_TABLE]: Fix size to be
	288.
	(main) [GENERATE_FIXED_HUFFMAN_TABLE]: Pass 288 to
	elf_zlib_inflate_table.  Generate elf_zlib_default_dist_table.
	(elf_zlib_default_table): Update.
	(elf_zlib_default_dist_table): New static array.
	(elf_zlib_inflate): Use elf_zlib_default_dist_table for dist table
	for block type 1.
	* ztest.c (struct zlib_test): Add uncompressed_len.
	(tests): Initialize uncompressed_len field.  Add new test case.
	(test_samples): Use uncompressed_len field.
2018-01-16 17:39:45 -08:00
Ian Lance Taylor
862169a1f5 .gitignore: add simple .gitignore file 2018-01-15 15:22:10 -08:00
Than McIntosh
ee9cd27e5e Restore functionality of 'install' target. (#10)
Previous change (update from gcc trunk) broke 'make install'; this
corrects the problem.
2018-01-15 12:06:55 -08:00
Than McIntosh
17f687d2b9 Update from gcc trunk version of libbacktrace at svn rev 256427. (#8)
Includes (among other things) support for compressed debug sections,
a variety of bugfixes, and expanded test coverage.
2018-01-12 10:26:02 -08:00
Ian Lance Taylor
14d377e9be README: correct link to C++ unwind API
Fixes #4
2017-05-29 11:48:14 -07:00
Ian Lance Taylor
ba79a27ee9 all: remove meaningless trailing whitespace 2016-09-11 06:45:37 -07:00
Ian Lance Taylor
84241313f2 libbacktrace: initial commit
This is a standalone version of the libbacktrace library that I
originally wrote for GCC.  This is a copy of libbacktrace from GCC
trunk, with all dependencies incorporated here.
2016-09-10 07:59:09 -07:00
Ian Lance Taylor
6a5a5fcdda Initial commit 2016-09-10 07:26:00 -07:00