From fc3e08ba7322fa1a1c5fe00cc20a9a98291803a9 Mon Sep 17 00:00:00 2001 From: not-matthias Date: Thu, 12 Jun 2025 18:02:26 +0200 Subject: [PATCH 1/2] fix: use correct path for unwind info --- src/run/runner/wall_time/perf/mod.rs | 38 ++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/run/runner/wall_time/perf/mod.rs b/src/run/runner/wall_time/perf/mod.rs index cff9b2ac..86fcf5cd 100644 --- a/src/run/runner/wall_time/perf/mod.rs +++ b/src/run/runner/wall_time/perf/mod.rs @@ -226,7 +226,6 @@ impl PerfRunner { let bench_proc = procfs::process::Process::new(pid as _) .expect("Failed to find benchmark process"); - let exe_path = bench_proc.exe().expect("Failed to read /proc/{pid}/exe"); let exe_maps = bench_proc.maps().expect("Failed to read /proc/{pid}/maps"); for map in &exe_maps { @@ -237,23 +236,36 @@ impl PerfRunner { _ => None, }; - if let Some(path) = path { + if let Some(path) = &path { symbols_by_pid .entry(pid) .or_insert(ProcessSymbols::new(pid)) - .add_mapping(pid, &path, base_addr, end_addr); + .add_mapping(pid, path, base_addr, end_addr); debug!("Added mapping for module {:?}", path); - } - if map.perms.contains(MMPermissions::EXECUTE) { - if let Ok(unwind_data) = UnwindData::new( - exe_path.to_string_lossy().as_bytes(), - page_offset, - base_addr, - end_addr - base_addr, - None, - ) { - unwind_data_by_pid.entry(pid).or_default().push(unwind_data); + if map.perms.contains(MMPermissions::EXECUTE) { + match UnwindData::new( + path.to_string_lossy().as_bytes(), + page_offset, + base_addr, + end_addr - base_addr, + None, + ) { + Ok(unwind_data) => { + unwind_data_by_pid + .entry(pid) + .or_default() + .push(unwind_data); + debug!("Added unwind data for {path:?}"); + } + Err(error) => { + debug!( + "Failed to create unwind data for module {}: {}", + path.display(), + error + ); + } + } } } } From 5aa4152eefd1050709c45ec57920a5001b107360 Mon Sep 17 00:00:00 2001 From: not-matthias Date: Fri, 13 Jun 2025 10:09:18 +0200 Subject: [PATCH 2/2] chore: add debug logs for proc maps --- src/run/runner/wall_time/perf/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/run/runner/wall_time/perf/mod.rs b/src/run/runner/wall_time/perf/mod.rs index 86fcf5cd..8f8c2493 100644 --- a/src/run/runner/wall_time/perf/mod.rs +++ b/src/run/runner/wall_time/perf/mod.rs @@ -256,7 +256,7 @@ impl PerfRunner { .entry(pid) .or_default() .push(unwind_data); - debug!("Added unwind data for {path:?}"); + debug!("Added unwind data for {path:?} ({base_addr:x} - {end_addr:x})"); } Err(error) => { debug!( @@ -267,6 +267,8 @@ impl PerfRunner { } } } + } else if map.perms.contains(MMPermissions::EXECUTE) { + debug!("Found executable mapping without path: {base_addr:x} - {end_addr:x}"); } } }