Skip to content

Conversation

@djolertrk
Copy link
Collaborator

Track variable locations at HIR and MASM levels.
Add DebugVar decorator and new debug_info section in the final .masp.

Also, add miden-debugdump tool to dump .debug_info section, so we can explore the custom section from the package.

vm part: 0xMiden/miden-vm#2471

This adds sveral features/fixes for improved debugging:

1. Synthetic source locations: Compiler-generated code (like local
   initialization, ABI transforms) now uses SourceSpan::SYNTHETIC instead
   of UNKNOWN. This differentiates compiler-generated code from truly
   unknown locations and renders as #loc(synthetic) in output.

2. -Z print-masm-source-locations: New flag to print source locations
   as #loc("file":line:col) annotations in MASM output.

3. -Z remap-path-prefix=FROM=TO: Remap source path prefixes for resolving
   paths from DWARF when sources are in different locations (e.g., stdlib).

4. Use current_span to have more real source locations attached --
   currently we used Default locations a lot - for example, each
   operator would start with it.

5. Fix wasm component-level DWARF parsing

Requires miden-vm with SourceSpan::SYNTHETIC debug type.
Represend variables values at HIR level.

Run tests as:

```
$ lit tests/lit/debug
```
Introduce DebugVar decorators.
Prepare and emit Debug Info into masp.

Add SectionId::DEBUG_INFO.
Tool to print .debug_info section.

Run lit test:

$ litcheck lit run --verbose tests/lit/debugdump

In addition, add docs/DebugInfoFormat.md to describe the format
itself.
@djolertrk djolertrk marked this pull request as draft December 15, 2025 07:35
@djolertrk
Copy link
Collaborator Author

Goes on top of #812.

@djolertrk
Copy link
Collaborator Author

cc @greenhat @bitwalker

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