diff --git a/src/executor/shared/fifo.rs b/src/executor/shared/fifo.rs index 7e71aff4..56d1c525 100644 --- a/src/executor/shared/fifo.rs +++ b/src/executor/shared/fifo.rs @@ -160,7 +160,7 @@ impl RunnerFifo { } Err(_) => continue, }; - debug!("Received command: {cmd:?}"); + trace!("Received command: {cmd:?}"); // Try executor-specific handler first if let Some(response) = handle_cmd(&cmd).await? { diff --git a/src/executor/wall_time/perf/debug_info.rs b/src/executor/wall_time/perf/debug_info.rs index eed6290f..e6dd737e 100644 --- a/src/executor/wall_time/perf/debug_info.rs +++ b/src/executor/wall_time/perf/debug_info.rs @@ -1,6 +1,6 @@ use crate::executor::wall_time::perf::perf_map::ModuleSymbols; use crate::prelude::*; -use addr2line::gimli; +use addr2line::{fallible_iterator::FallibleIterator, gimli}; use object::{Object, ObjectSection}; use runner_shared::debug_info::{DebugInfo, ModuleDebugInfo}; use std::path::Path; @@ -47,13 +47,24 @@ impl ModuleDebugInfoExt for ModuleDebugInfo { .symbols() .iter() .filter_map(|symbol| { - let (file, line) = match ctx.find_location(symbol.addr) { - Ok(Some(location)) => { - let file = location.file.map(|f| f.to_string())?; - (file, location.line) - } - _ => return None, - }; + // Use find_frames() instead of find_location() to handle inlined functions correctly. + // + // If we have foo -> bar -> baz(inlined) -> stdfunc(inlined) + // where the whole body of bar is the inlined baz, which itself is just inlined stdfunc. + // + // Using find_location() on the `bar` symbol address would return the location of + // `stdfunc`, while using find_frames() an iterator that yields the frames in + // order: + // 1. stdfunc (inlined) + // 2. baz (inlined) + // 3. bar + // + // And stops until a non inlined function is reached. + // We can then take the last frame to get the correct location. + let frames = ctx.find_frames(symbol.addr).skip_all_loads().ok()?; + // Take the last frame (outermost/non-inline caller) + let location = frames.last().ok()??.location?; + let (file, line) = (location.file?.to_string(), location.line); min_addr = Some(min_addr.map_or(symbol.addr, |addr: u64| addr.min(symbol.addr))); max_addr = Some(max_addr.map_or(symbol.addr + symbol.size, |addr: u64| { diff --git a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__cpp_debug_info.snap b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__cpp_debug_info.snap index 532203b7..3bdb6ecb 100644 --- a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__cpp_debug_info.snap +++ b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__cpp_debug_info.snap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9af51e449587563ee665bc0c365c1e92b8fdbbd3182d70d026bc9f91890f06d8 -size 148236 +oid sha256:fbb7396ee2eb9570e9a993475db0d8c046f5f956f2d7fc297deceb4241e0566d +size 142666 diff --git a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__golang_debug_info.snap b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__golang_debug_info.snap index 3f10eb99..49244dcb 100644 --- a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__golang_debug_info.snap +++ b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__golang_debug_info.snap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a80d0a7b245514f01b8719ce71a5776e95c395b1986c5c78cfae948abee23a39 +oid sha256:02dd9dfb8e7dd6fee73fd15b8450b106cfa278e7d01e45781d772495eb1c9271 size 490624 diff --git a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__ruff_debug_info.snap b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__ruff_debug_info.snap index 7f0e0a9c..51bd319b 100644 --- a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__ruff_debug_info.snap +++ b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__ruff_debug_info.snap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be6c5d4b5981911d0ccc635cf0b0e1163ff5879e72b7c3076cac04423856fc68 -size 5996146 +oid sha256:b856c5f31e7ded51122d5664c63a588eac36eb53f10e2753ed8bc7289d43ff12 +size 5998818 diff --git a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__rust_divan_debug_info.snap b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__rust_divan_debug_info.snap index a0be6c21..968d365a 100644 --- a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__rust_divan_debug_info.snap +++ b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__rust_divan_debug_info.snap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a775c5e200672234bbf71312cd4db90bfb81cf99907ca0b7c45cc38cb34679f -size 520147 +oid sha256:ce3a55442b52a218942a5c4cf85d282eb91c338363d5bc4e331aac773c03f8f0 +size 519449 diff --git a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__the_algorithms_debug_info.snap b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__the_algorithms_debug_info.snap index f5b84873..0b6d38f5 100644 --- a/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__the_algorithms_debug_info.snap +++ b/src/executor/wall_time/perf/snapshots/codspeed__executor__wall_time__perf__debug_info__tests__the_algorithms_debug_info.snap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e72d1de3d0e4984f132ed2573cf996015da2db162df712bd58abe64fda510005 -size 567622 +oid sha256:5da1f106f389d00f5e9e063c52aa15f4c229e3065acf6bdfb7963844503e78f2 +size 567239