Skip to content

ui: resolve argument values in call stack display#206

Merged
gnidan merged 1 commit intocall-returnfrom
ui-resolve-arg-values
Apr 2, 2026
Merged

ui: resolve argument values in call stack display#206
gnidan merged 1 commit intocall-returnfrom
ui-resolve-arg-values

Conversation

@gnidan
Copy link
Copy Markdown
Member

@gnidan gnidan commented Apr 2, 2026

Summary

  • Store argument pointers on call stack frames and resolve them against historical machine state at each frame's invoke step
  • Display resolved values in call stack breadcrumbs as "add(a: 3, b: 4)" in both CallStackDisplay (programs-react) and TraceDrawer (web)
  • Cache resolved values by step index to avoid re-resolving unchanged frames when stepping forward
  • Small values (<=9999) show as decimal, larger values as hex

Changes

  • packages/programs-react/src/utils/mockTrace.ts — add argumentPointers to CallFrame, replace extractArgNames with extractArgInfo that returns both names and pointers
  • packages/programs-react/src/components/TraceContext.tsx — add ResolvedCallFrame type, async resolution effect with caching, expose resolvedCallStack on TraceState
  • packages/programs-react/src/components/CallStackDisplay.tsx — use resolved values in breadcrumb display
  • packages/web/src/theme/ProgramExample/TraceDrawer.tsx — add machine state adapter, pointer resolution, and resolved values in call stack display

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-02 12:10 UTC

@gnidan gnidan force-pushed the ui-resolve-arg-values branch from 78e0e7b to ecc5b19 Compare April 2, 2026 11:38
Store argument pointers on call stack frames and resolve
them against historical machine state at each frame's
invoke step. Display as "add(a: 3, b: 4)" in both
CallStackDisplay and TraceDrawer breadcrumbs.

When the compiler emits duplicate invoke contexts (caller
JUMP + callee JUMPDEST), use the callee entry step for
resolution since argument pointers reference stack slots
valid at the JUMPDEST, not the JUMP.

Fix stack peek indexing in both traceStepToMachineState
and traceStepToState: depth 0 should read from the top
of the stack (last array element), not the bottom. The
evm package stores stacks bottom-first.

Values are cached by step index to avoid re-resolving
unchanged frames. Small values (<=9999) display as
decimal, larger values as hex.
@gnidan gnidan force-pushed the ui-resolve-arg-values branch from ecc5b19 to f772814 Compare April 2, 2026 11:58
@gnidan gnidan merged commit c29b841 into call-return Apr 2, 2026
4 checks passed
@gnidan gnidan deleted the ui-resolve-arg-values branch April 2, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant