Skip to content
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

[WASM] Node Debugger #56473

Closed
wants to merge 116 commits into from
Closed

Conversation

Daniel-Genkin
Copy link
Contributor

@Daniel-Genkin Daniel-Genkin commented Jul 28, 2021

Pending PR #54640 to be merged first after which this one will need to be rebased to extract out the debugger specific changes

This PR adds NodeJS debugging support to the WASM debugger as well as loosely laying a template for the upcoming V8 debugging support.

How does it work

This works the exact same was as the pre-exiting browser debugging with a few minor modifications to implementation details such as how the C# files are loaded into the DevTools Sources tab.

How to use

  1. Add the following properties to the project's csproj file:
    <DebugSymbols>true</DebugSymbols>
    <DebugType>embedded</DebugType> 
    <WasmDebugLevel>1</WasmDebugLevel>
  1. Build the mono browser configuration as Debug via build mono+libs -os Browser -configuration Debug /p:ForNode=true
  2. Publish the project to generate the AppBundle folder via dotnet publish /p:TargetArchitecture=wasm /p:TargetOS=Browser src/mono/sample/wasm/console/Wasm.Console.Sample.csproj -c Debug /p:ForNode=true.
  3. start node via node --inspect runtime.js --run Wasm.Console.Sample.dll.
    • Note that you can use --inspect-brk ineatd of --inspect to automatically break on the first line of js.
  4. start chrome via chrome --remote-debugging-port=9222 http://localhost:8000/ .
  5. start BrowserDebugHost via cd src\mono\wasm\debugger\BrowserDebugHost and dotnet run.
  6. go to http://localhost:9222/devtools/inspector.html?ws=127.0.0.1:[PORT THAT BROWSERDEBUGHOST PRINTED]/devtools/node/[EVERYTHING AFTER THE LAST SLASH THAT NODE PRINTED] in the newly opened chrome instance.

Open questions

  • Currently, since we use Runtime.evaluate to call JS from C# and dotnet.js is modularized on node, the evaluated commands are using the globalThis namespace where MONO is not defined. So I needed to add it to globalThis. Is there some way to expose MONO without adding to globalThis?

Also, special thanks to @thaystg for helping me with this PR.

@Daniel-Genkin
Copy link
Contributor Author

The test failures in this PR are caused by the changes brought over from the Node PR. Once they are resolved there, I will merge into here and this PR should (hopefully) be green.

Daniel-Genkin and others added 18 commits August 2, 2021 11:20
Fix how to get assembly metadata.
@ghost
Copy link

ghost commented Sep 7, 2021

Draft Pull Request was automatically closed for inactivity. Please let us know if you'd like to reopen it.

@lewing lewing reopened this Sep 7, 2021
@ghost ghost closed this Oct 9, 2021
@ghost
Copy link

ghost commented Oct 9, 2021

Draft Pull Request was automatically closed for inactivity. Please let us know if you'd like to reopen it.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 8, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants