Skip to content

Fix function debug info#9751

Open
piotmag769 wants to merge 1 commit intomainfrom
pm/fix-debugger-mappings
Open

Fix function debug info#9751
piotmag769 wants to merge 1 commit intomainfrom
pm/fix-debugger-mappings

Conversation

@piotmag769
Copy link
Collaborator

@piotmag769 piotmag769 commented Mar 18, 2026

This sanity check actually broke the debug info for snforge test functions since function_code_span is a call site in their case, not a function body


Note

Low Risk
Low risk: small, localized changes to debug-info extraction logic; main impact is different/expanded variable span reporting, which could affect debugger tooling output but not compilation/runtime behavior.

Overview
Fixes Sierra function debug-info extraction so variable-to-source mappings are no longer discarded when the variable definition span falls outside the extracted function_code_span (e.g., snforge test functions where the span can represent a call site).

extract_variables_mapping now derives variable SourceCodeSpan directly from the variable’s user_location (using position_in_file) and drops the previous maybe_code_location-based sanity check and the need to thread the function’s file/span into the mapping.

Written by Cursor Bugbot for commit 5466d33. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link

This change is Reviewable

@piotmag769 piotmag769 requested a review from orizi March 18, 2026 12:27
@piotmag769 piotmag769 force-pushed the pm/fix-debugger-mappings branch from e479f36 to 1ce7d42 Compare March 18, 2026 12:29
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on piotmag769).


crates/cairo-lang-sierra-generator/src/debug_info/function_debug_info.rs line 143 at r1 (raw file):

                };

                let (_, span, _) = maybe_code_location(db, location)?;

isn't the path required though as part of the data as well?

Code quote:

et (_

@piotmag769 piotmag769 force-pushed the pm/fix-debugger-mappings branch from 1ce7d42 to 5466d33 Compare March 19, 2026 08:44
Copy link
Collaborator Author

@piotmag769 piotmag769 left a comment

Choose a reason for hiding this comment

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

@piotmag769 made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on orizi).


crates/cairo-lang-sierra-generator/src/debug_info/function_debug_info.rs line 143 at r1 (raw file):

Previously, orizi wrote…

isn't the path required though as part of the data as well?

For the function data, yes. But this function extracts only data for a variable. Changed the code to be more clear.

@piotmag769 piotmag769 requested a review from orizi March 19, 2026 08:46
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

@orizi reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on piotmag769).

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.

4 participants