Skip to content

feat: discover jitdump files from MMAP2 records#280

Open
DaniPopes wants to merge 7 commits into
CodSpeedHQ:mainfrom
DaniPopes:dani/jit-dump-llvm-orc
Open

feat: discover jitdump files from MMAP2 records#280
DaniPopes wants to merge 7 commits into
CodSpeedHQ:mainfrom
DaniPopes:dani/jit-dump-llvm-orc

Conversation

@DaniPopes

@DaniPopes DaniPopes commented Mar 29, 2026

Copy link
Copy Markdown

Jitdump discovery was hardcoded to /tmp/jit-{pid}.dump, missing dumps from LLVM ORC JIT (e.g. revmc, Julia) which write to ~/.debug/jit/*/jit-{pid}.dump.

Instead of searching hardcoded filesystem paths, extract jitdump file paths from MMAP2 records in the perf data, matching how perf inject --jit discovers them via jit_detect().

The jitdump search was hardcoded to /tmp/jit-{pid}.dump, which
misses jitdumps from LLVM ORC JIT (e.g. revmc, Julia) that write to
{JITDUMPDIR|HOME}/.debug/jit/*/jit-{pid}.dump per JITLoaderPerf.cpp.
Instead of searching hardcoded filesystem paths, extract jitdump file
paths from MMAP2 records in the perf data. This is how perf inject
finds them and works for any jitdump location.
Only match basenames of the form jit-<digits>.dump instead of any
.dump suffix. This matches the validation in perf's jit_detect().
@DaniPopes DaniPopes changed the title feat: search LLVM ORC JIT jitdump paths feat: discover jitdump files from MMAP2 records Mar 29, 2026
Match perf's jit_detect() behavior: the PID embedded in the jitdump
filename must match the MMAP2 record's PID. Also fixes a bug where
rposition returned a usize that was incorrectly used as a byte slice.
@DaniPopes DaniPopes force-pushed the dani/jit-dump-llvm-orc branch from 8f488d7 to 92ff4b6 Compare March 29, 2026 20:31
@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown

Greptile Summary

This PR discovers jitdump files from perf MMAP2 records instead of relying only on fixed paths. The main changes are:

  • Adds MMAP2-based jitdump path detection for jit-<pid>.dump files.
  • Deduplicates discovered jitdump paths per process.
  • Restores the legacy /tmp/jit-{pid}.dump fallback for tracked processes.
  • Threads the discovered path map through perf symbol and unwind harvesting.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
src/executor/wall_time/profiler/perf/jit_dump.rs Adds the shared jitdump path map, per-process deduplication, legacy /tmp fallback, and path-set harvesting.
src/executor/wall_time/profiler/perf/parse_perf_file.rs Collects jitdump paths from MMAP2 records and accepts jit-<digits>.dump basenames.
src/executor/wall_time/profiler/perf/mod.rs Passes discovered jitdump paths through the save pipeline and adds legacy fallback paths before harvesting.
Cargo.toml Adds indexmap as a direct dependency for stable path deduplication.
Cargo.lock Updates the lockfile for the direct indexmap dependency.

Reviews (2): Last reviewed commit: "fix: dedupe jitdump paths" | Re-trigger Greptile

Comment thread src/executor/wall_time/profiler/perf/parse_perf_file.rs Outdated
Comment thread src/executor/wall_time/profiler/perf/mod.rs
Use an IndexSet for discovered jitdump paths so repeated MMAP2 records do not append duplicate symbols or unwind data.

Also keep the legacy /tmp/jit-<pid>.dump fallback for tracked PIDs when perf starts too late to capture the jitdump marker mapping.
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.

1 participant