Skip to content

Commit fc3e08b

Browse files
committed
fix: use correct path for unwind info
1 parent d26117e commit fc3e08b

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

  • src/run/runner/wall_time/perf

src/run/runner/wall_time/perf/mod.rs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ impl PerfRunner {
226226

227227
let bench_proc = procfs::process::Process::new(pid as _)
228228
.expect("Failed to find benchmark process");
229-
let exe_path = bench_proc.exe().expect("Failed to read /proc/{pid}/exe");
230229
let exe_maps = bench_proc.maps().expect("Failed to read /proc/{pid}/maps");
231230

232231
for map in &exe_maps {
@@ -237,23 +236,36 @@ impl PerfRunner {
237236
_ => None,
238237
};
239238

240-
if let Some(path) = path {
239+
if let Some(path) = &path {
241240
symbols_by_pid
242241
.entry(pid)
243242
.or_insert(ProcessSymbols::new(pid))
244-
.add_mapping(pid, &path, base_addr, end_addr);
243+
.add_mapping(pid, path, base_addr, end_addr);
245244
debug!("Added mapping for module {:?}", path);
246-
}
247245

248-
if map.perms.contains(MMPermissions::EXECUTE) {
249-
if let Ok(unwind_data) = UnwindData::new(
250-
exe_path.to_string_lossy().as_bytes(),
251-
page_offset,
252-
base_addr,
253-
end_addr - base_addr,
254-
None,
255-
) {
256-
unwind_data_by_pid.entry(pid).or_default().push(unwind_data);
246+
if map.perms.contains(MMPermissions::EXECUTE) {
247+
match UnwindData::new(
248+
path.to_string_lossy().as_bytes(),
249+
page_offset,
250+
base_addr,
251+
end_addr - base_addr,
252+
None,
253+
) {
254+
Ok(unwind_data) => {
255+
unwind_data_by_pid
256+
.entry(pid)
257+
.or_default()
258+
.push(unwind_data);
259+
debug!("Added unwind data for {path:?}");
260+
}
261+
Err(error) => {
262+
debug!(
263+
"Failed to create unwind data for module {}: {}",
264+
path.display(),
265+
error
266+
);
267+
}
268+
}
257269
}
258270
}
259271
}

0 commit comments

Comments
 (0)