Skip to content

Fix function debug info when file content is missing#9875

Open
s0mnathh wants to merge 1 commit intostarkware-libs:mainfrom
s0mnathh:fix-debug-info-missing-file-content
Open

Fix function debug info when file content is missing#9875
s0mnathh wants to merge 1 commit intostarkware-libs:mainfrom
s0mnathh:fix-debug-info-missing-file-content

Conversation

@s0mnathh
Copy link
Copy Markdown
Contributor

Summary

Avoid panicking during function debug info extraction when the source file content is unavailable. Return None for the affected variable mapping and add a unit test that covers the missing-file path.


Type of change

Please check one:

  • Bug fix (fixes incorrect behavior)
  • New feature
  • Performance improvement
  • Documentation change with concrete technical impact
  • Style, wording, formatting, or typo-only change

Why is this change needed?

Debug info extraction already models missing source locations as Option, but variable name extraction still used db.file_content(...).unwrap(). When file content is unavailable this can panic instead of degrading gracefully.


What was the behavior or documentation before?

If the user-location file content could not be loaded, debug info extraction could panic while trying to build the variable name, even though the surrounding code path otherwise uses optional fallbacks.


What is the behavior or documentation after?

Variable name extraction now returns None when file content is missing, so the mapper skips that entry instead of panicking. The new unit test exercises this behavior with an empty testing database and a missing on-disk file.


Related issue or discussion (if any)


Additional context

This keeps the change aligned with the existing maybe_code_location semantics and limits the fix to the local debug-info extraction path.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
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 s0mnathh).


a discussion (no related file):
There's no actual way this may happen organically - so this just make the code more complicated for no good reason.

please close PR.

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.

3 participants