Skip to content

Commit

Permalink
fix(debugger): Update the debugger to handle the new Brillig debug me…
Browse files Browse the repository at this point in the history
…tadata format (#5706)

# Description

## Problem\*

Resolves #5703 

## Summary\*

After #5696 debug metadata from
Brillig functions was de-duplicated to avoid a blow-up in artifact size.
The debugger uses this debug metadata format to accurately display
information in the REPL and DAP interface. This PR contains the updates
needed for the debugger to handle the new debug metadata format.

The debugger on `inline_never_basic` (the example used in the linked
issue) gives the following again:
<img width="696" alt="Screenshot 2024-08-09 at 2 28 56 PM"
src="https://github.com/user-attachments/assets/c9232c8d-34f7-45fc-94f1-be51b75dd07c">

The output matches what was on master before PR #5696.

## Additional Context


## Documentation\*

Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
vezenovm authored Aug 12, 2024
1 parent 3f79607 commit a31f82e
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 84 deletions.
2 changes: 1 addition & 1 deletion acvm-repo/acvm/src/pwg/brillig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct BrilligSolver<'b, F, B: BlackBoxFunctionSolver<F>> {
/// This id references which Brillig function within the main ACIR program we are solving.
/// This is used for appropriately resolving errors as the ACIR program artifacts
/// set up their Brillig debug metadata by function id.
function_id: BrilligFunctionId,
pub function_id: BrilligFunctionId,
}

impl<'b, B: BlackBoxFunctionSolver<F>, F: AcirField> BrilligSolver<'b, F, B> {
Expand Down
17 changes: 16 additions & 1 deletion compiler/noirc_driver/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(crate) fn filter_relevant_files(
debug_symbols: &[DebugInfo],
file_manager: &FileManager,
) -> BTreeMap<FileId, DebugFile> {
let files_with_debug_symbols: BTreeSet<FileId> = debug_symbols
let mut files_with_debug_symbols: BTreeSet<FileId> = debug_symbols
.iter()
.flat_map(|function_symbols| {
function_symbols
Expand All @@ -28,6 +28,21 @@ pub(crate) fn filter_relevant_files(
})
.collect();

let files_with_brillig_debug_symbols: BTreeSet<FileId> = debug_symbols
.iter()
.flat_map(|function_symbols| {
let brillig_location_maps =
function_symbols.brillig_locations.values().flat_map(|brillig_location_map| {
brillig_location_map
.values()
.flat_map(|call_stack| call_stack.iter().map(|location| location.file))
});
brillig_location_maps
})
.collect();

files_with_debug_symbols.extend(files_with_brillig_debug_symbols);

let mut file_map = BTreeMap::new();

for file_id in files_with_debug_symbols {
Expand Down
Loading

0 comments on commit a31f82e

Please sign in to comment.