Skip to content

Commit c0f4302

Browse files
committed
chore: annotate inline parameter follow-ups
1 parent cf1d722 commit c0f4302

5 files changed

Lines changed: 25 additions & 2 deletions

File tree

e2e-tests/tests/optimized_inline_call_value_execution.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ use std::path::Path;
66
use std::time::Duration;
77

88
// Keep this on the first executable line after consume_pair() returns.
9+
// This is intentionally a negative regression point: at this PC the inline
10+
// parameters have already fallen out of their own location-list coverage, so
11+
// we only assert that GhostScope does not misreport them as consume_pair's
12+
// argument registers. We do not expect post-call value recovery to work until
13+
// full DW_OP_entry_value + caller-side call-site evaluation is implemented.
914
const INLINE_AFTER_CALL_TRACE_LINE: u32 = 19;
15+
// TODO(positive_test): Add a companion positive test on a pre-call line where
16+
// original_x/original_y are still covered by their own location lists and can
17+
// be asserted with exact values without relying on entry_value support.
1018

1119
async fn spawn_inline_call_value_program(
1220
binary_path: &Path,

ghostscope-dwarf/src/index/block_index.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ impl<'a> BlockIndexBuilder<'a> {
282282
bn.ranges = ranges;
283283
}
284284
if let Some(a) = e.attr(gimli::constants::DW_AT_entry_pc) {
285+
// TODO(dwarf5): Also handle DebugAddrIndex-backed DW_AT_entry_pc.
285286
if let gimli::AttributeValue::Addr(addr) = a.value() {
286287
bn.entry_pc = Some(addr);
287288
}

ghostscope-dwarf/src/objfile/variables.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,15 @@ impl LoadedObjfile {
344344
}
345345
}
346346

347+
// Keep the parser's direct DWARF result for inline parameters as-is.
348+
// We intentionally do not remap optimized inline params from nested
349+
// call_site_parameter DIEs here: those describe the callee's argument
350+
// locations/values, not the inline function's original parameters, and
351+
// using them here caused false aliases like "original_x = RDI".
352+
// TODO(inline_params): If we want to recover optimized inline params in
353+
// these cases, it has to come from a complete DW_OP_entry_value path that
354+
// evaluates caller-side call-site values, not from the inline body's own
355+
// nested call-site subtree.
347356
let mut seen_param_names: std::collections::HashSet<String> =
348357
std::collections::HashSet::new();
349358
let mut filtered: Vec<crate::VariableWithEvaluation> =

ghostscope-dwarf/src/parser/expression_evaluator.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,12 @@ impl ExpressionEvaluator {
202202
debug!("Found DW_OP_stack_value - this is a computed value");
203203
}
204204
match &op {
205-
// Support DW_OP_entry_value minimally for inline parameters:
206-
// If inner expression is a single DW_OP_reg*, treat it as a direct value.
205+
// TODO(entry_value): This is only a minimal fallback.
206+
// For inline parameters, a correct DW_OP_entry_value implementation must
207+
// walk back to the caller and evaluate the matching call_site_parameter's
208+
// DW_AT_call_value / DW_AT_GNU_call_site_value. Merely stripping
209+
// entry_value(reg) to a bare register only preserves the simplest cases
210+
// where the parameter is still equivalent to the entry register.
207211
Operation::EntryValue { expression } => {
208212
let mut inner = *expression;
209213
let mut inner_ops: Vec<Operation<_>> = Vec::new();

ghostscope-dwarf/src/parser/fast_parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ impl<'a> DwarfParser<'a> {
544544
attrs.ranges_attr = Some(value);
545545
}
546546
gimli::constants::DW_AT_entry_pc => {
547+
// TODO(dwarf5): Also handle DebugAddrIndex-backed DW_AT_entry_pc.
547548
if let gimli::AttributeValue::Addr(addr) = value {
548549
attrs.entry_pc = Some(addr);
549550
}

0 commit comments

Comments
 (0)