17 Commits

Author SHA1 Message Date
Jakub Jelinek
254a858ae7 Update copyright years. 2026-01-02 09:56:11 +01:00
Jakub Jelinek
6441eb6dc0 Update copyright years. 2025-01-02 11:59:57 +01:00
Ian Lance Taylor
bab7a64c1a libbacktrace: recognize new Mach-O DWARF sections
Patch from Pavel Safonov.

These sections are used on macOS Sequoia.

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/136

	* macho.c (dwarf_section_names): Add __debug_addr and
	__debug_line_str.
2024-10-25 15:20:55 -07:00
Ian Lance Taylor
c6803cdaba libbacktrace: support FDPIC
Based on patch by Max Filippov.

	* internal.h: If FDPIC, #include <link.h> and/or <sys/link.h>.
	(libbacktrace_using_fdpic): Define.
	(struct libbacktrace_base_address): Define.
	(libbacktrace_add_base): Define.
	(backtrace_dwarf_add): Change base_address to struct
	libbacktrace_base_address.
	* dwarf.c (struct dwarf_data): Change base_address to struct
	libbacktrace_base_address.
	(add_ranges, find_address_ranges, build_ddress_map): Likewise.
	(build_dwarf_data, build_dwarf_add): Likewise.
	(add_low_high_range): Change base_address to struct
	libbacktrace_base_address.  Use libbacktrace_add_base.
	(add_ranges_from_ranges, add_ranges_from_rnglists): Likewise.
	(add_line): Use libbacktrace_add_base.
	* elf.c (elf_initialize_syminfo): Change base_address to struct
	libbacktrace_base_address.  Use libbacktrace_add_base.
	(elf_add): Change base_address to struct
	libbacktrace_base_address.
	(phdr_callback): Likewise.  Initialize base_address.m.
	(backtrace_initialize): If using FDPIC, don't call elf_add with
	main executable; always use dl_iterate_phdr.
	* macho.c (macho_add_symtab): Change base_address to struct
	libbacktrace_base_address.  Use libbacktrace_add_base.
	(macho_syminfo): Change base_address to struct
	libbacktrace_base_address.
	(macho_add_fat, macho_add_dsym, macho_add): Likewise.
	(backtrace_initialize): Likewise.  Initialize base_address.m.
	* pecoff.c (coff_initialize_syminfo): Change base_address to
	struct libbacktrace_base_address.  Use libbacktrace_add_base.
	(coff_add): Change base_address to struct
	libbacktrace_base_address.  Initialize base_address.m.
2024-07-15 17:28:28 -07:00
Ian Lance Taylor
b870086904 libbacktrace: correctly gather Mach-O symbol table
For PR libbacktrace/97082.
	* macho.c (MACH_O_N_EXT): Don't define.
	(MACH_O_N_UNDF): Define.
	(macho_defined_symbol): Don't discard N_EXT symbols.  Do
	discard N_UNDF symbols.
2024-07-11 17:54:43 -07:00
Ian Lance Taylor
b96789abf8 libbacktrace: suggest how to fix missing debug info
* elf.c (elf_nodebug): Suggest -g.
	* macho.c (macho_nodebug): Suggest -g and dsymutil.
	* pecoff.c (coff_nodebug): Suggest -g.
2024-07-11 15:39:07 -07:00
Ian Lance Taylor
02f7525e5e libbacktrace: remove trailing whitespace
* dwarf.c: Remove trailing whitespace.
	* macho.c: Likewise.
2024-07-11 15:29:24 -07:00
Jakub Jelinek
a945c346f5 Update copyright years. 2024-01-03 12:19:35 +01:00
Jakub Jelinek
83ffe9cde7 Update copyright years. 2023-01-16 11:52:17 +01:00
Ian Lance Taylor
d8ddf1fa09 libbacktrace: don't exit Mach-O dyld library loop on one failure
* macho.c (backtrace_initialize) [HAVE_MACH_O_DYLD_H]: Don't exit
	loop if we can't find debug info for one shared library.
2022-07-07 16:54:05 -07:00
Jakub Jelinek
7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
Jakub Jelinek
99dee82307 Update copyright years. 2021-01-04 10:26:59 +01:00
Iain Sandoe
d1339b519a 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.
2020-09-16 19:37:28 +01:00
Ian Lance Taylor
a8a7a97b4e 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.
2020-09-08 14:51:32 -07:00
Ian Lance Taylor
488e33339e 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-08 13:20:26 -07:00
Ian Lance Taylor
74c176ca2f 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-08-24 13:10:26 -07:00
Ian Lance Taylor
dea40c941a libbacktrace: add Mach-O support
libbacktrace/
	PR libbacktrace/88745
	* macho.c: New file.
	* filetype.awk: Recognize Mach-O files.
	* Makefile.am (FORMAT_FILES): Add macho.c.
	(check_DATA): New variable.  Set to .dSYM if HAVE_DSYMUTIL.
	(%.dSYM): New pattern target.
	(test_macho_SOURCES, test_macho_CFLAGS): New targets.
	(test_macho_LDADD): New target.
	(BUILDTESTS): Add test_macho.
	(macho.lo): Add dependencies.
	* configure.ac: Recognize macho file type.  Check for
	mach-o/dyld.h.  Don't try to run objcopy if we don't find it.
	Look for dsymutil and define a HAVE_DSYMUTIL conditional.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* config.h.in: Regenerate.
2020-05-09 16:09:37 -07:00