feat: Add break <line-number> command#5021
Closed
smanilov wants to merge 1 commit intonoir-lang:masterfrom
Closed
Conversation
Contributor
|
Thank you for your contribution to the Noir language. Please do not force push to this branch after the Noir team have started review of this PR. Doing so will only delay us merging your PR as we will need to start the review process from scratch. Thanks for your understanding. |
41ff300 to
cc9347d
Compare
break <line-number> commandbreak <line-number> command
Author
|
I was debugging some Noir code today and found this still to be useful, so reopening the pull-request. Sorry for the noise. |
cc9347d to
9a6b5eb
Compare
This makes it much easier to find the correct place to add a break point
while debugging a program.
For example, now one can do the following:
```
$ cd test_programs/execution_success/merkle_insert/
$ nargo debug
[merkle_insert] Starting debugger
At opcode 0: BRILLIG CALL func 0: PREDICATE = %EXPR [ 1 ]%
inputs: [Single(Expression { mul_terms: [], linear_combina [...]
> next
At opcode 0.17: Const { destination: MemoryAddress(21), bi [...]
At [...]/test_programs/execution_success/merkle_insert/src/main.nr:12:3
7 ...
8 new_root: pub Field,
9 leaf: Field,
10 index: Field,
11 mimc_input: [Field; 4]
12 -> ) {
13 assert(old_root == std::merkle::compute_merkle_ [...]
14
15 let calculated_root = std::merkle::compute_merk [...]
16 assert(new_root == calculated_root);
17
18 let h = mimc::mimc_bn254(mimc_input);
19 // Regression test for PR noir-lang#891
20 std::println(h);
21 assert(h == 18226366069841799622585958305961373 [...]
22 }
> break 18
Added breakpoint at opcode 0.1274
> continue
(Continuing execution...)
Stopped at breakpoint in opcode 0.1274
At opcode 0.1274: Const { destination: MemoryAddress(36), [...]
At /home/stan/code/repos/noir/test_programs/execution_succ [...]
13 ...
14
15 let calculated_root = std::merkle::compute_merk [...]
16 assert(new_root == calculated_root);
17
18 -> let h = mimc::mimc_bn254(mimc_input);
19 // Regression test for PR noir-lang#891
20 std::println(h);
21 assert(h == 18226366069841799622585958305961373 [...]
22 }
>
```
9a6b5eb to
84af46a
Compare
5 tasks
Author
|
Closing, as this is addressed in #5204. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes it much easier to find the correct place to add a break point while debugging a program.
For example, now one can do the following:
Description
This PR is in the spirit of "submit your feature request as a PR".
Problem*
At the moment, one can only do
break <opcode>and notbreak <line-number>innargo debug.Summary*
This PR adds the necessary functionality and implements the
break <line-number>command.Additional Context
I am exploring the current capabilities of
nargo debugand found it would be very useful to add this command.Documentation*
The new command automatically appears in the help command of
nargo debug.Check one:
PR Checklist*
cargo fmton default settings.