-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for nargo DAP #51
Conversation
And avoid hard-coding nargo path and also the unnecessary wrapper script.
Usability Observation nr 1 No default launch - when I open debug panel and attempt to run noir program nothing will happen, instead I have to create launch config for any debug to take place. |
Usability Observation nr 2 Program by default stops at first opcode - while this is desired in REPL style debugger I believe it should just execute to the end when there's no breakpoint on the way. |
Usability Observation nr 3 If breakpoint is set in Function and user choses |
Usability Observation nr 4 Step into is stepping over. |
Usability Observation nr 5 No variables are being displayed in Variables Panel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With observatioins shared in comments
Usability Observation nr 5 is in my mind minimum to expose this through vscode.
Looks like there was some formatting changes from prettier which are included in here. I've fixed these issues in master but could you merge master back into this branch to reduce the diff @ggiraldez? |
Good to merge it into this branch now. |
This is a known issue, which shouldn't be hard to fix. But yes, agreed it makes the DX cumbersome. |
That's a good point. What would you expect to be the behavior if there are no breakpoints set? It could get a bit confusing because I guess by default nothing will happen (at least nothing noticeable) when you hit the Run button. |
I guess the problem here is that the debugger is not being able to properly set the breakpoint but you're not getting feedback in the UI. I've encountered this issue as well, but haven't found a good solution yet. |
All stepping commands do the same, which is to continue execution until the source location changes (ie. execute as many opcodes as necessary for the the source location from the debug artifact to change). Depending on compiler optimizations and inlining it may be that it looks like a function call is skipped over. We will try to address this issue by compiling to Brillig only (instead of ACIR/Brillig) when debugging. We expect that to give us a bit more control over stepping and the ability to get proper stacktraces. |
Agreed. This is being worked on. There is some preliminary work in the https://github.com/manastech/noir/tree/dap-with-vars branch, but it depends on merging the debug variables instrumentation code. |
* Gracefully handle debugger loading/init errors * Refactor: extract debugger functionality to own file * Properly handle launch.json if exists * Add a bit more context on preflight check
…figured in a launch file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Seems like this struggles with monorepos plus we should probably hide the witness map in the panel if we're compiling to brillig but we can merge this as is.
Thank you and sorry for this PR being stuck in purgatory! |
Description
ℹ️ This PR should be applied after noir-lang/noir#4185 since it builds on top of the features implemented there.
Adds support in the extension to debug Noir binary packages using the DAP subcommand in
nargo
, implemented by noir-lang/noir#3627.Problem
Part of noir-lang/noir#3015
Summary
This PR adds the configuration necessary in
package.json
of the extension to allow debugging Noir binary packages from inside VS.Code using the Debug Adapter implemented in the above mentioned noir PR.Supports settings breakpoints in Noir source code and opening a Disassembly view while debugging to display the compiled ACIR/Brillig opcodes. All stepping commands will produce the same result, ie. stepping to the next "statement" in the Noir program, ie. there is no concept of stepping into or out of a function yet. If using the commands from the disassembly view, the debugger will step to the next opcode instead.
Additional Context
PR Checklist*
cargo fmt
on default settings.