Skip to content

fix: install libc6-dbg during memory and walltime setup - #601

Merged
not-matthias merged 2 commits into
mainfrom
cod-4026-fix-unknown-symbols-in-memory-flamegraphs
Nov 3, 2026
Merged

not-matthias merged 2 commits into
mainfrom
cod-4026-fix-unknown-symbols-in-memory-flamegraphs

Conversation

@not-matthias

@not-matthias not-matthias commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Install libc6-dbg during memory and walltime setup, as the valgrind setup already does.

Ubuntu's libc is stripped and only ships .dynsym, so glibc's static functions (__libc_start_call_main, start_thread, clone3) have no symbol. Their frames are then named after their runtime address, which changes on every run because of ASLR. The same frame never matches across runs, so a differential flamegraph marks everything below it as new or dropped. The runner already warns about the missing debug file after the run, but nothing installed it outside valgrind mode.

The install is best effort and never fails the setup:

  • skipped when the libc debug file is already present, probed by file because the setup cache restores files without updating dpkg
  • skipped on non-apt systems and on macOS
  • skipped with a warning when elevating would need a password prompt (not root, no passwordless sudo)
  • a failed install only logs a warning
  • walltime installs it only when a profiler is configured

The libc debug file probe and the "missing libc debug symbols" warning move out of the valgrind setup into a shared helper, and the warning no longer says "valgrind". The valgrind setup otherwise behaves as before.

Only libc is covered. Other stripped modules (libstdc++, stripped user binaries) still show up as addresses, so the issue stays open. Resolving symbols through debuginfod would cover those, and the install can then go away (FIXME in both setups).

Verified by recording an allocating C program with codspeed exec --mode memory in an ubuntu:24.04 container that had no libc6-dbg. Setup installed the package, and the parsed profile named __libc_start_call_main, clone3 and start_thread instead of addresses. I did not run the walltime path end to end.

Refs COD-4026

@codspeed

codspeed Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 8 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 41 untouched benchmarks
⏩ 6 skipped benchmarks1


Comparing cod-4026-fix-unknown-symbols-in-memory-flamegraphs (de0e196) with main (9fee8be)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@not-matthias
not-matthias force-pushed the cod-4026-fix-unknown-symbols-in-memory-flamegraphs branch from ac2b54f to 37bdaf7 Compare November 2, 2026 14:56
@not-matthias
not-matthias marked this pull request as ready for review November 2, 2026 14:58
@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new defects were found.

Summary

Adds best-effort libc6-dbg installation to memory and wall-time setup and shares the same helper with Valgrind.

  • Profiling setup tries to give libc frames their real names.
  • Shared setup caches keep package names from earlier installs.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Memory, wall-time, or Valgrind setup] --> B{Apt-based host?}
  B -- No --> S[Skip]
  B -- Yes --> C{Matching libc debug file exists?}
  C -- Yes --> S
  C -- No --> D{Can elevate without a prompt?}
  D -- No --> W[Warn and continue]
  D -- Yes --> E[Restore cache or install libc6-dbg]
  E --> F{Succeeded?}
  F -- Yes --> G[Continue setup]
  F -- No --> W
Loading

Reviews (2) · Last reviewed commit: "fix: install libc debug symbols during e..." · Reviewed by Greptile

@GuillaumeLagrange GuillaumeLagrange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

olgtm

Comment thread src/executor/valgrind/setup.rs Resolved
@not-matthias
not-matthias force-pushed the cod-4026-fix-unknown-symbols-in-memory-flamegraphs branch 2 times, most recently from e3a2809 to aadcdc1 Compare November 2, 2026 17:31

@GuillaumeLagrange GuillaumeLagrange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, did you test the cache behavior for both valgrind and other instruments (mostly valgrind is "risky")

@not-matthias

Copy link
Copy Markdown
Member Author

lgtm, did you test the cache behavior for both valgrind and other instruments (mostly valgrind is "risky")

Validated it. And added a small fix to properly cache libc-dbg for valgrind as well: e9b89b7 (this PR)

@not-matthias
not-matthias force-pushed the cod-4026-fix-unknown-symbols-in-memory-flamegraphs branch from e9b89b7 to a985ec4 Compare November 3, 2026 13:12
Share best-effort libc debug symbol installation across memory, walltime, and simulation setup. Keep Valgrind installation independent of optional debug symbols and use file-based checks for restored packages.

Accumulate package metadata across separate cached installations. Keep symbol helpers private and document the shared-cache contract.
The Valgrind package installs libc6-dbg as a dependency, so the shared libc setup sees its symbols already present and skips installation. Include both packages in the cache so fresh offline restores retain the required debug files.
@not-matthias
not-matthias force-pushed the cod-4026-fix-unknown-symbols-in-memory-flamegraphs branch from a985ec4 to de0e196 Compare November 3, 2026 13:30
@not-matthias
not-matthias merged commit c0351b3 into main Nov 3, 2026
119 of 122 checks passed
@not-matthias
not-matthias deleted the cod-4026-fix-unknown-symbols-in-memory-flamegraphs branch November 3, 2026 14:15
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.

2 participants