Skip to content

Commit df44138

Browse files
committed
fix: use correct path for unwind info
1 parent 924ea15 commit df44138

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
@@ -223,7 +223,6 @@ impl PerfRunner {
223223

224224
let bench_proc = procfs::process::Process::new(pid as _)
225225
.expect("Failed to find benchmark process");
226-
let exe_path = bench_proc.exe().expect("Failed to read /proc/{pid}/exe");
227226
let exe_maps = bench_proc.maps().expect("Failed to read /proc/{pid}/maps");
228227

229228
for map in &exe_maps {
@@ -234,23 +233,36 @@ impl PerfRunner {
234233
_ => None,
235234
};
236235

237-
if let Some(path) = path {
236+
if let Some(path) = &path {
238237
symbols_by_pid
239238
.entry(pid)
240239
.or_insert(ProcessSymbols::new(pid))
241-
.add_mapping(pid, &path, base_addr, end_addr);
240+
.add_mapping(pid, path, base_addr, end_addr);
242241
debug!("Added mapping for module {:?}", path);
243-
}
244242

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

0 commit comments

Comments
 (0)