Skip to content

fix: missing libc symbols#303

Merged
not-matthias merged 3 commits intomainfrom
cod-2520-investigate-incomplete-symbolication-in-profiles-with
Apr 22, 2026
Merged

fix: missing libc symbols#303
not-matthias merged 3 commits intomainfrom
cod-2520-investigate-incomplete-symbolication-in-profiles-with

Conversation

@not-matthias
Copy link
Copy Markdown
Member

No description provided.

cpp_my_benchmark_stripped.bin is the C++ benchmark binary with DWARF
sections removed (strip --strip-debug) but .symtab/.dynsym intact,
plus a .gnu_debuglink pointing to cpp_my_benchmark.debug.

cpp_my_benchmark.debug contains the extracted DWARF sections
(objcopy --only-keep-debug). Together they mimic the libc + libc6-dbg
split where system libraries ship stripped and debug packages provide
separate .debug files.
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 20, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks


Comparing cod-2520-investigate-incomplete-symbolication-in-profiles-with (9b26b2b) with main (218b80c)

Open in CodSpeed

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for resolving DWARF from separate debug info files referenced via .gnu_debuglink, improving symbolization for stripped binaries (e.g., distro-provided *-dbg packages).

Changes:

  • Implement .gnu_debuglink-based lookup (GDB-style search order) and fallback when DWARF is missing in the main binary.
  • Add a regression test covering stripped-binary + separate debug file resolution.
  • Introduce new perf-map test artifacts and add crc32fast dependency for CRC verification.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/executor/wall_time/perf/debug_info.rs Adds .gnu_debuglink lookup + fallback logic and a new test for stripped binaries.
Cargo.toml Adds crc32fast dependency for debuglink CRC validation.
Cargo.lock Records dependency graph update including crc32fast.
testdata/perf_map/cpp_my_benchmark_stripped.bin New LFS-tracked stripped ELF fixture containing .gnu_debuglink.
testdata/perf_map/cpp_my_benchmark.debug New LFS-tracked separate debug file fixture with DWARF sections.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/executor/wall_time/perf/debug_info.rs Outdated
Comment thread src/executor/wall_time/perf/debug_info.rs Outdated
@not-matthias not-matthias force-pushed the cod-2520-investigate-incomplete-symbolication-in-profiles-with branch from 1d8f9ea to 93e8801 Compare April 21, 2026 13:45
Copy link
Copy Markdown
Contributor

@GuillaumeLagrange GuillaumeLagrange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

olgtm

Comment thread testdata/perf_map/cpp_my_benchmark.debug
Comment thread src/executor/wall_time/perf/elf_helper.rs
Comment thread src/executor/wall_time/perf/elf_helper.rs Outdated
Comment thread src/executor/wall_time/perf/module_symbols.rs
libc.so.6 and libc.so.6.debug are the stripped libc plus its separate
debug file from Ubuntu 22.04 (jammy) glibc 2.35-0ubuntu3, amd64.

Extracted from the official .deb packages:

  pool/main/g/glibc/libc6_2.35-0ubuntu3_amd64.deb
  pool/main/g/glibc/libc6-dbg_2.35-0ubuntu3_amd64.deb

via `ar x` + `tar --zstd -xf data.tar.zst`. The debug file originally
lives under /usr/lib/debug/.build-id/89/c3cb85...1969.debug; it is
renamed to libc.so.6.debug in testdata/ for readability. Tests that
need the .gnu_debuglink basename stage a tempdir copy with the expected
name.

Build-id: 89c3cb85f9e55046776471fed05ec441581d1969

These fixtures exercise the build-id and .gnu_debuglink resolution
paths against a real-world stripped system library, complementing the
synthetic cpp_my_benchmark pair.
@not-matthias not-matthias force-pushed the cod-2520-investigate-incomplete-symbolication-in-profiles-with branch from 93e8801 to 6cdbf5b Compare April 22, 2026 09:45
Stripped system libraries (e.g. libc.so.6) ship without DWARF and with
only .dynsym. Installing debug packages like libc6-dbg drops a companion
.debug file, but the runner had no way to find it — leaving "Unknown
symbol" entries and missing file/line info in flamegraphs.

Resolve debug files via two mechanisms:

1. Build-ID lookup at /usr/lib/debug/.build-id/XX/YYYYYY.debug, which is
   how Ubuntu/Debian debug packages actually install files.
2. .gnu_debuglink with the standard GDB search order (same dir, .debug/
   subdir, /usr/lib/debug/<path>/) and CRC32 validation to avoid using
   stale debug files after binary upgrades.

The resolved debug file is used both for DWARF (file/line lookup in
ModuleDebugInfo) and for merging the full .symtab into ModuleSymbols.
@not-matthias not-matthias force-pushed the cod-2520-investigate-incomplete-symbolication-in-profiles-with branch from 5650976 to 9b26b2b Compare April 22, 2026 10:58
@not-matthias not-matthias merged commit 9b26b2b into main Apr 22, 2026
18 checks passed
@not-matthias not-matthias deleted the cod-2520-investigate-incomplete-symbolication-in-profiles-with branch April 22, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants