Skip to content

Show function params in variables#121

Open
integraledelebesgue wants to merge 1 commit intomainfrom
fix/show-function-params
Open

Show function params in variables#121
integraledelebesgue wants to merge 1 commit intomainfrom
fix/show-function-params

Conversation

@integraledelebesgue
Copy link
Copy Markdown
Member

Closes #110

Comment thread src/debugger/context.rs Outdated
Comment thread src/debugger/context.rs Outdated
Comment thread src/debugger/context/variables.rs Outdated
Comment thread src/debugger/context/variables.rs Outdated
Comment thread src/debugger/context/variables.rs Outdated
Comment thread src/debugger/context/variables.rs
Comment thread src/debugger/state/call_stack.rs Outdated

let user_function_id =
ctx.user_function_for_concrete_libfunc(&invocation_statement.libfunc_id)?;
let register_values_on_call = &caller_context.register_values_on_call.clone()?;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observation: notice that when building function_param_var_map you go through args of invoke statements. Therefore, registry values in cell refs you have in the map refer to the values of registries right before execution of sierra statements that consumed it. Despite that, here you use register_values_on_call which was snapshoted before the first non-0-CASM statement, yet it still works.

Why? It is probably because all the mappings to params have fp in it - and fp doesn't change unless the function frame changes. So maybe we don't need the register_values_on_call at all - we can just get current fp and forget?

Comment thread src/debugger/state/call_stack/variables.rs
@integraledelebesgue integraledelebesgue force-pushed the fix/show-function-params branch from 3cc191d to 7953c83 Compare May 5, 2026 15:59
@integraledelebesgue integraledelebesgue force-pushed the fix/show-function-params branch from 7953c83 to af4a300 Compare May 5, 2026 16:20
program: &'a Program,
casm_debug_info: &'a CairoProgramDebugInfo,
) -> impl Iterator<Item = (&'a Function, Range<usize>)> {
let max_statement_idx = StatementIdx(casm_debug_info.sierra_statement_info.len() - 1);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let max_statement_idx = StatementIdx(casm_debug_info.sierra_statement_info.len() - 1);
let max_statement_idx = StatementIdx(program.statements.len() - 1);

Comment thread Cargo.toml
cairo-vm = { version = "3.2.0", features = ["test_utils"] }
dap = { git = "https://github.com/software-mansion-labs/dap-rs", rev = "27542c413184732cd8cb5632c8349d605ed4fe04" }
indexmap = "2.14"
indexmap = "2.13"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can stay with 2.13

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.

Show function params values

2 participants