-
Notifications
You must be signed in to change notification settings - Fork 199
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
Epic: Implement Noir debugger #3094
Comments
Hello everyone. I got ready repl version and not tested but written dap version of debugger. I'm going to open a PR and I'll mention the issue in the PR description. The PR is a good point to improve the codebase and UX. I'm going to work with dap version of debugger after opening the PR. The main features (can be duplicated with the previous message):
The main points to discuss:
How to try repl versionYou can try the repl version of debugger.
To debug program use |
Hello everyone I added support of dap and marked pr #3404 as ready for review. Since the dap is a binary the ts adapter code is very small. But I spent a lot of time to get it working. If you want to try the debugger in your editor follow next steps please:
|
Hi @dmvict! We're working on extending the official Noir VS Code plugin with debugger capabilities here: noir-lang/vscode-noir@master...manastech:vscode-noir:dap-support Embedding a DAP server in Nargo here: master...manastech:noir:dap In parallel, we're working heavily on instrumenting the compiler to make source level variable inspection possible, see here: #3523 There's also work going on https://github.com/manastech/noir/tree/feature/wasm-debugger to expose the same debugger capabilities to JS runtimes via WASM. This is so eventually not only binaries but also contracts are debuggable. Our respective approaches have diverged substantially and at the moment I'm not sure how we can converge into a single solution. We're now starting to integrate the work on variable inspection with the DAP server. Hopefully once we have that down there will be some more clarity, but I wanted to raise this to your attention 🙏 |
Hello @mverzilli Good work. I'll look at the changes later. I believe we will be able to integrate the changes. It's my happy case. |
# Description Implements the DAP protocol to allow a tool such as VS.Code to drive the debugger in a Noir binary project. A separate PR for the [VS.Code Noir extension](https://github.com/noir-lang/vscode-noir) will be submitted later. ## Problem Part of #3015 The beginning of this implementation was heavily inspired by @dmvict [implementation](#3094) of an alternative debugger for Noir programs. ## Summary This PR implements a new `nargo` subcommand `dap`. This starts a DAP server in single session mode through stdin/stdout and waits for a launch request. Using the arguments in the launch request (`projectFolder`, and optionally `package` and `proverName`) it compiles the Noir binary package and starts it in debug mode. Through DAP requests, a tool can then step through the program, set breakpoints and list the generated opcodes using a disassemble request. ## Additional Context ## Documentation Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [X] **[Exceptional Case]** 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. --------- Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Hi @dmvict! The debugger is now shipping with Nargo, as well as the VS Code official extension, you can check the preview docs here: https://noir-lang.org/docs/dev/tooling/debugger I think it would make sense to close this PR, and open new ones building upon the work on master if you want to add new features to the debugger 🙏 |
Problem
This is a tracking issue for the implementation of a alternative debugger for Noir. As the base implementation I get debugger from #3015.
Codebase
The codebase of the debugger is placed in my fork. Visit branch
debugger
to check it.I opened no PR for now. You can get diffs using link. I'll open a PR after discussion and approve.
Features
The debugger have next features:
dap
to provide compatible interfacebrillig
bytecode usingbrillig_vm
as the executordap
andrepl
implementations. The differences between them in implementation ofdap
server. Forrepl
implementation I wrote custom (mock) server that communicates with stdin and maps commands into dap requests.The repo has no proper way to compile brillig bytecode. I modified two crates to get brillig bytecode for noir programs. The changes are quite unstable. I checked compiled bytecode for a few simple noir programs and it seems to be correct.
State of work
General
Dap realization
Repl realization
Any ideas and wants are welcome and can be considered, just comment here!
Happy Case
I think happy case for the debuggers is to combine them into single app. The app will provide single interface for both targets.
We cannot combine apps with no additional work. I guess it would be better to use the scheme:
Of course, the scheme can be reverted and @mverzilli can get my version and combine it into single debugger app.
How I see the CLI interface:
--vm brillig
. Default is acvm.How I see the IDE interface:
"vm": "acvm"
. And I think, we should provide some kind of switch button to choose the target but first implementation would use only config file.Alternatives Considered
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: