Skip to content

Conversation

@djolertrk
Copy link
Contributor

This section contains the names of all procedures (both exported and private) in a package, keyed by their MAST root digest. This allows debuggers to resolve human-readable procedure names during execution.

TODO: Generate this section from asembly and compiler.

@djolertrk djolertrk force-pushed the pr/debug-functions-section branch 2 times, most recently from bb9a4e3 to 7fce755 Compare December 15, 2025 20:35
@djolertrk
Copy link
Contributor Author

cc @greenhat @bitwalker

@greenhat greenhat requested a review from bitwalker December 16, 2025 06:17
@djolertrk djolertrk force-pushed the pr/debug-functions-section branch from 7fce755 to 44db8ca Compare December 22, 2025 18:33
@djolertrk
Copy link
Contributor Author

NOTE: The generation of this section depends on @bitwalker's work on assembler.

Copy link
Collaborator

@bitwalker bitwalker left a comment

Choose a reason for hiding this comment

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

Just one question before I finish up my review, see the comment I left on debug_functions.rs

@djolertrk djolertrk force-pushed the pr/debug-functions-section branch from 44db8ca to 2445f3e Compare January 2, 2026 14:42
@djolertrk djolertrk requested a review from bitwalker January 2, 2026 14:42
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd just remove this for now

Copy link
Collaborator

@bitwalker bitwalker left a comment

Choose a reason for hiding this comment

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

Looks good! I'd remove the now-unused sections module, but other than that, I think this is ready to merge once @bobbinth signs off.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left a few comments inline - but these should be straight-forward to address.

Also, let's add a changelog entry for this PR.

Comment on lines 317 to 331
mast_forest.debug_info.clear_procedure_names();
mast_forest.debug_info.extend_procedure_names(procedure_names);
Copy link
Contributor

Choose a reason for hiding this comment

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

I find the need to clear procedure names and then extend them a bit confusing - but I guess we do the same for error codes. Nothing to do in this PR, but maybe it is something we can remedy when we are refactoring MAST serialization (cc @huitseeker).

Comment on lines 668 to 670
assert!(
self.nodes.iter().any(|node| node.digest() == digest),
"attempted to insert procedure name for digest not in forest"
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here we'd want to check only against procedure roots - not all nodes. We could use something like find_procedure_root() method to check if a given digest is a procedure root.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A key detail here is that these procedure names map to both exported and non-exported procedures in the forest, so as long as the forest provides a way to determine if a given node is a procedure root for a non-exported procedure, then 👍.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I believe procedure_roots contains roots of all procedures (exported and not-exported).

@djolertrk djolertrk force-pushed the pr/debug-functions-section branch from c803e63 to 33d384e Compare January 5, 2026 22:18
@djolertrk
Copy link
Contributor Author

Rebased on top of trunk and addressed the comments.

This section contains the names of all procedures (both exported and private)
in a package, keyed by their MAST root digest. This allows debuggers to
resolve human-readable procedure names during execution.
- assert that the digest exists in the forest before inserting
- minor cleanup
@djolertrk djolertrk force-pushed the pr/debug-functions-section branch from 33d384e to afa9840 Compare January 5, 2026 22:21
@djolertrk djolertrk force-pushed the pr/debug-functions-section branch from afa9840 to e8a7db5 Compare January 5, 2026 22:22
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

All looks good! Thank you!

@bobbinth bobbinth merged commit 285d6c8 into 0xMiden:next Jan 5, 2026
13 of 14 checks passed
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