Commit Graph
19 Commits
Author SHA1 Message Date
Ian Lance Taylor 0b9b49cf4a libbacktrace: make backtrace_syminfo_to_full_callback_moredata static
* elf.c (backtrace_syminfo_to_full_callback_moredata): Move to
	elf.c from fileline.c and make static.
	* fileline.c (backtrace_syminfo_to_full_callback_moredata):
	Moved to elf.c.
	* internal.h (backtrace_syminfo_to_full_callback_moredata): Don't
	declare.
2026-09-03 12:30:32 -07:00
Ian Lance Taylor 735c54d9dc libbacktrace: handle MOREDATA correctly without debug info
Based on patch from Andi Kleen.

	* elf.c (elf_nodebug): Handle state->moredata.
	* fileline.c (backtrace_syminfo_to_full_callback): Remove
	incorrect comment about MOREDATA.
	(backtrace_syminfo_to_full_callback_moredata): New function.
	* internal.h (backtrace_syminfo_to_full_callback_moredata):
	Declare.
	* strippedtest.c: New file.
	* configure.ac: check whether objcopy supports --strip-debug.
	* Makefile.am (strippedtest_SOURCES): New variable.
	(strippedtest_CFLAGS, strippedtest_LDFLAGS): Likewise.
	(strippedtest_LDADD): Likewise.
	(check_PROGRAMS): Add strippedtest.
	(MAKETESTS): Add strippedtest_stripped
	(%_stripped): New rule.
	* configure, Makefile.in: Regenerate.
2026-09-01 15:17:39 -07:00
Ian Lance Taylor 6f8310e238 libbacktrace: support returning discriminator field
Based on patch from Andi Kleen.

	* backtrace.h (backtrace_create_state): Rewrite comment to change
	threaded parameter to flags.
	(backtrace_full_callback, backtrace_syminfo_callback): Document
	behavior change if moredata flag is set.
	(struct backtrace_moredata): Define.
	* backtrace-supported.h.in (BACKTRACE_SUPPORTS_MOREDATA): Define.
	* internal.h (struct backtrace_state): Add moredata field.
	(BACKTRACE_MOREDATA_VERSION): Define.
	* state.c (backtrace_create_state): Change threaded parameter to
	flags.  Set state moredata field based on flags.
	* dwarf.c (struct line): Add disc field.
	(struct function): Add caller_disc field.
	(call_callback): New static function.
	(add_line): Add disc parameter.  Change all callers.  Store disc
	in new line value.
	(read_line_program): Track discriminator value.
	(read_line_info): Initialize disc field in final line entry.
	(read_function_entry): Handle DW_AT_GNU_discriminator.
	(report_inlined_functions): Add disc parameter. Change all
	callers. Call call_callback rather than calling callback
	directly.
	(dwarf_lookup_pc): Handle inlined discriminators. Call
	call_callback rather than calling callback directly.
	(dwarf_fileline): Call call_callback rather than calling callback
	directly.
	* elf.c (elf_syminfo): Pass moredata if requested.
	* macho.c (macho_syminfo): Likewise.
	* pecoff.c (coff_syminfo): Likewise.
	* xcoff.c (xcoff_syminfo): Likewise.
	(xcoff_lookup_pc): Likewise.
	* backtrace.c: #include <string.h>.
	(unwind): Pass moredata if requested.
	* unknown.c: #include <string.h>.
	(unknown_fileline): Pass moredata if requested.
	* fileline.c (backtrace_syminfo_to_full_callback): Add comment
	about moredata.
	* mdtest.c: New test file.
	* Makefile.am (mdtest_SOURCES): Define.
	(mdtest_CFLAGS, mdtest_LDFLAGS, mdtest_LDADD): Define.
	(BUILDTESTS): Add mdtest.
	* Makefile.in: Regenerate.
2026-07-06 12:42:21 -07:00
Jakub Jelinek 42962d2cfb Update copyright years. 2026-05-03 18:21:13 -07:00
Jakub Jelinek bdd324c192 Update copyright years. 2026-05-03 18:20:27 -07:00
John David Anglin 793921876c libbacktrace: Add hpux fileline support
Fixes libstdc++ stacktrace tests.

2025-04-10  John David Anglin  <danglin@gcc.gnu.org>

libbacktrace/ChangeLog:
	* fileline.c (hpux_get_executable_path): New.
	(fileline_initialize): Add pass to get hpux executable path.
2025-04-10 14:43:16 -07:00
Ian Lance Taylor 1db85642e3 libbacktrace: use WIN32_LEAN_AND_MEAN, not WIN32_MEAN_AND_LEAN
Patch from awmorgan.

	* fileline.c: Use WIN32_LEAN_AND_MEAN, not WIN32_MEAN_AND_LEAN.
	* pecoff.c: Likewise.

Fixes #144
2024-11-29 13:21:28 -08:00
Ian Lance Taylor 8c05bcb94f libbacktrace: update copyright years 2024-07-11 18:14:01 -07:00
Ian Lance Taylor 25889d241c libbacktrace: call GetModuleFileNameA on Windows
Patch from Björn Schäpers.

	* fileline.c: Include <windows.h> if available.
	(windows_get_executable_path): New static function.
	(fileline_initialize): Call windows_get_executable_path.
	* configure.ac: Checked for windows.h
	* configure: Regenerate.
	* config.h.in: Regenerate.
2023-11-29 14:09:55 -08:00
Ian Lance Taylor c1c86fa2f0 libbacktrace: look for _pgmptr on Windows
Patch from Andres Freund:
	* configure.ac: Check for _pgmptr declaration.
	* fileline.c (fileline_initialize): Check for _pgmfptr before
	/proc/self/exec.
	* configure, config.h.in: Regenerate.
2023-07-31 17:02:14 -07:00
Jakub Jelinek 5496ee0a1a Update copyright years. 2021-01-18 14:56:19 -08:00
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.
2020-09-27 17:29:53 -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 bd02146d90 Update copyright years. 2020-02-18 18:46:13 -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
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 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