Commit Graph

29 Commits

Author SHA1 Message Date
Ivan Molodetskikh
279f7ba0df libbacktrace: Fix missing table assignment in RLE seq decode
Fixes segfault when decompressing mesa debuginfo on Aeryn.
2026-06-27 11:05:12 +03:00
Ivan Molodetskikh
bd2106db68 libbacktrace: support compressed block with window descriptor
Some debuginfo on AerynOS has this format.
2026-06-26 10:46:33 +03:00
Ian Lance Taylor
99c13e53bf libbacktrace: support compressed block with no sequences
* elf.c (elf_zstd_decompress_frame): Support a compressed block
	with no sequences, only literals.

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/164
2026-06-26 10:46:17 +03:00
Ian Lance Taylor
7fbe1d1345 libbacktrace: support multiple zstd frames
Based on patch by GitHub user ofats.

	* elf.c (elf_zstd_decompress_frame): New static function,
	broken out of elf_zstd_decompress.
	(elf_zstd_decompress): Call elf_zstd_decompress_frame in a loop.
	* zstdtest.c (test_large): Compress the file in chunks.
2026-06-26 10:41:29 +03:00
Ivan Molodetskikh
5745b489a2 callstack: Calculate end address from highest LOAD header
Headers aren't guaranteed to be sorted in final address order. For
example, from readelf -lW of a .so built with clang:

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0x0000000000000040 0x0000000000000040 0x000230 0x000230 R   0x8
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x5e8274 0x5e8274 R   0x1000
  LOAD           0x5e8280 0x00000000005e9280 0x00000000005e9280 0x51e990 0x51e990 R E 0x1000
  LOAD           0xb06c10 0x0000000000b08c10 0x0000000000b08c10 0x031628 0x0323f0 RW  0x1000
  LOAD           0xb38240 0x0000000000b3b240 0x0000000000b3b240 0x009aa8 0x011c40 RW  0x1000
  DYNAMIC        0xb32270 0x0000000000b34270 0x0000000000b34270 0x000410 0x000410 RW  0x8
  GNU_RELRO      0xb06c10 0x0000000000b08c10 0x0000000000b08c10 0x031628 0x0323f0 R   0x1
  GNU_EH_FRAME   0x4e8360 0x00000000004e8360 0x00000000004e8360 0x029cf4 0x029cf4 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0
  NOTE           0x000270 0x0000000000000270 0x0000000000000270 0x000024 0x000024 R   0x4
2026-06-26 10:41:29 +03:00
Bartosz Taudul
7974a74580 Add external_file support to libbacktrace
- Add external_file field to backtrace_state struct
- Add backtrace_create_state_for_file() function that marks
  state for external ELF files not loaded in current process
- In backtrace_initialize, use external_file flag to:
  - Pass exe=0 to elf_add for ET_DYN files (allows DWARF loading)
  - Skip dl_iterate_phdr enumeration (avoids noise from current process)

This enables symbol resolution from arbitrary ELF files on disk,
with caller responsible for address translation.
2026-03-30 19:52:12 +02:00
Bartosz Taudul
2f1fc19f88 libbacktrace: use correct names in #undef of ELF macros (b9e4006) 2026-03-30 19:40:30 +02:00
Bartosz Taudul
52607f70fe libbacktrace: add casts to avoid undefined shifts (78af4ff, 0034e33) 2026-03-30 19:38:45 +02:00
Simonas Kazlauskas
10b5f0d878 fix: GetDebugInfoDescriptor signature 2025-11-13 19:19:52 +02:00
Bartosz Taudul
e26c34346b libbacktrace: support FDPIC (1dd5c40) 2024-08-24 18:15:52 +02:00
Bartosz Taudul
0d0e56dca3 libbacktrace: avoid infinite recursion (febbb9b) 2024-08-24 18:02:05 +02:00
Bartosz Taudul
12c8592325 libbacktrace: fix UBSAN issues (5aa9254) 2024-08-24 18:01:10 +02:00
Bartosz Taudul
ba79deddf6 libbacktrace: it's OK if zstd decompressor sees no backward bits (4ead348) 2024-08-24 17:55:41 +02:00
Ikko Eltociear Ashimine
dfbf0652f2 libbacktrace: update elf.cpp
previouly -> previously
2024-07-01 02:20:56 +09:00
Bartosz Taudul
2df972d586 libbacktrace: don't assume compressed section is aligned (7ead8c1) 2024-03-13 00:29:01 +01:00
Bartosz Taudul
49478ec3b3 libbacktrace: skip all LZMA block header padding bytes (28824f2) 2024-03-13 00:24:13 +01:00
Bartosz Taudul
1f90cd473b libbacktrace: use real .opd for debuginfo on ppc64 v1 ABI (592e9c8) 2024-03-13 00:23:08 +01:00
Bartosz Taudul
a9feb75bdf libbacktrace: read symbol table of debuginfo file (36cfdc1) 2024-03-13 00:20:14 +01:00
trodrigues
8503f32b36 fix typos and compilation warnings 2023-12-09 09:37:14 -06:00
trodrigues
e80e1d2484 fix line endings 2023-12-06 12:29:26 -06:00
Tiago Rodrigues
8dfc5fe41f re-apply diff 2023-12-06 12:39:52 -05:00
Tiago Rodrigues
38559172bb checkout elf.cpp as it looks like line ending were screwed up 2023-12-06 12:37:53 -05:00
trodrigues
b835d73590 Add support for libbacktrace to detect new elfs have been dynamically loaded after backtrace_initialize() has been called, and consider them for symbol resolution 2023-12-05 20:09:11 -06:00
Bartosz Taudul
77402eb9c2 libbacktrace: minor fixes for zstd decompression (cdb64b68) 2023-04-05 17:24:19 +02:00
Bartosz Taudul
b53acde418 Fix type. 2023-01-05 20:34:50 +01:00
Bartosz Taudul
236bbfa8b1 libbacktrace: unpack literals into output buffer (da7eff2) 2023-01-05 20:31:05 +01:00
Bartosz Taudul
d8fc004bfa libbacktrace: rewrite and simplify main zstd loop (fd9442f) 2023-01-05 20:29:51 +01:00
Bartosz Taudul
08d403e324 libbacktrace: support zstd decompression (c992dd8) 2023-01-05 20:27:36 +01:00
Bartosz Taudul
06c7984a16 Move all client headers and sources to public/ directory. 2022-07-17 15:47:38 +02:00