Skip to content

Commit 4d4872e

Browse files
fix: follow frames until we find a non inlined functions in debug info
1 parent 977b877 commit 4d4872e

6 files changed

Lines changed: 17 additions & 17 deletions

src/executor/wall_time/perf/debug_info.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::executor::wall_time::perf::perf_map::ModuleSymbols;
22
use crate::prelude::*;
3-
use addr2line::gimli;
3+
use addr2line::{fallible_iterator::FallibleIterator, gimli};
44
use object::{Object, ObjectSection};
55
use runner_shared::debug_info::{DebugInfo, ModuleDebugInfo};
66
use std::path::Path;
@@ -47,13 +47,13 @@ impl ModuleDebugInfoExt for ModuleDebugInfo {
4747
.symbols()
4848
.iter()
4949
.filter_map(|symbol| {
50-
let (file, line) = match ctx.find_location(symbol.addr) {
51-
Ok(Some(location)) => {
52-
let file = location.file.map(|f| f.to_string())?;
53-
(file, location.line)
54-
}
55-
_ => return None,
56-
};
50+
// Use find_frames() instead of find_location() to handle inlined functions correctly.
51+
// find_location() returns the innermost inlined location, but we want the outermost
52+
// frame which is the actual function definition.
53+
let frames = ctx.find_frames(symbol.addr).skip_all_loads().ok()?;
54+
// Take the last frame (outermost/non-inline caller)
55+
let location = frames.last().ok()??.location?;
56+
let (file, line) = (location.file?.to_string(), location.line);
5757

5858
min_addr = Some(min_addr.map_or(symbol.addr, |addr: u64| addr.min(symbol.addr)));
5959
max_addr = Some(max_addr.map_or(symbol.addr + symbol.size, |addr: u64| {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:9af51e449587563ee665bc0c365c1e92b8fdbbd3182d70d026bc9f91890f06d8
3-
size 148236
2+
oid sha256:fbb7396ee2eb9570e9a993475db0d8c046f5f956f2d7fc297deceb4241e0566d
3+
size 142666
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:a80d0a7b245514f01b8719ce71a5776e95c395b1986c5c78cfae948abee23a39
2+
oid sha256:02dd9dfb8e7dd6fee73fd15b8450b106cfa278e7d01e45781d772495eb1c9271
33
size 490624
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:be6c5d4b5981911d0ccc635cf0b0e1163ff5879e72b7c3076cac04423856fc68
3-
size 5996146
2+
oid sha256:b856c5f31e7ded51122d5664c63a588eac36eb53f10e2753ed8bc7289d43ff12
3+
size 5998818
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:3a775c5e200672234bbf71312cd4db90bfb81cf99907ca0b7c45cc38cb34679f
3-
size 520147
2+
oid sha256:ce3a55442b52a218942a5c4cf85d282eb91c338363d5bc4e331aac773c03f8f0
3+
size 519449
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:e72d1de3d0e4984f132ed2573cf996015da2db162df712bd58abe64fda510005
3-
size 567622
2+
oid sha256:5da1f106f389d00f5e9e063c52aa15f4c229e3065acf6bdfb7963844503e78f2
3+
size 567239

0 commit comments

Comments
 (0)