Ian Lance Taylor
3bd5a08e4f
libbacktrace: use BACKTRACE_MOREDATA_VERSION rather than 3
...
Patch from Andi Kleen.
* pecoff.c (coff_syminfo): Use BACKTRACE_MOREDATA_VERSION.
* xcoff.c (xcoff_syminfo): Likewise.
(xcoff_lookup_pc): Likewise.
(xcoff_fileline): Likewise.
* unknown.c (unknown_fileline): Likewise.
2026-09-01 15:11:24 -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
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
6ce91a2ef7
libbacktrace: avoid -Wpointer-arith errors
...
Based on patch from Kirill Müller.
* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wpointer-arith.
* pecoff.c (coff_add): Cast void pointers.
* xcoff.c (xcoff_add): Likewise.
* configure: Regenerate.
2024-08-05 16:49:57 -07:00
Ian Lance Taylor
0dd27b95f9
libbacktrace: fix syntax of Windows registration functions
...
Adjust the syntax to keep MSVC happy.
Fixes #131
* pecoff.c (LDR_DLL_NOTIFICATION): Put function modifier
inside parentheses.
(LDR_REGISTER_FUNCTION): Likewise.
2024-07-30 09:28:33 -07:00
Ian Lance Taylor
1dd5c408fe
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:29:35 -07:00
Ian Lance Taylor
8c05bcb94f
libbacktrace: update copyright years
2024-07-11 18:14:01 -07:00
Ian Lance Taylor
e3e64ddd18
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.
Fixes #122
2024-07-11 15:42:10 -07:00
Ian Lance Taylor
11427f31a6
libbacktrace: add DLLS as they are loaded
...
Patch from Björn Schäpers.
* pecoff.c (struct dll_notification_data): Define.
(LDR_DLL_NOTIFICATION): New typedef.
(LDR_REGISTER_FUNCTION): New typedef.
(struct dll_notification_context): Define.
(dll_notification): New static function.
(backtrace_initialize): Register DLL notification.
2024-05-03 15:27:21 -07:00
Ian Lance Taylor
0e933e763f
libbacktrace: load Windows modules
...
Patch from Björn Schäpers <bjoern@hazardy.de >.
* configure.ac: Checked for tlhelp32.h
* pecoff.c: Include <tlhelp32.h> if available.
(backtrace_initialize): Use tlhelp32 api for a snapshot to
detect loaded modules.
(coff_add): New argument for the module handle of the file,
to get the base address.
* configure, config.h.in: Regenerate.
2024-05-01 10:40:39 -07:00
Ian Lance Taylor
14818b7783
libbacktrace: support ASLR on Windows
...
Patch from Björn Schäpers.
* pecoff.c: Include <windows.h> if available.
(coff_add): On Windows call GetModuleHandle to get base address.
2023-11-30 11:46:57 -08:00
Jakub Jelinek
5496ee0a1a
Update copyright years.
2021-01-18 14:56:19 -08:00
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
bd02146d90
Update copyright years.
2020-02-18 18:46:13 -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
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
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
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