-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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][debugging] Adding instructions for native debugging #69873
Conversation
…ntime into thays_enable_native_debugging
Tagging subscribers to this area: @thaystg |
@@ -247,12 +247,10 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, JObject par | |||
switch (url) | |||
{ | |||
case var _ when url == "": | |||
case var _ when url.StartsWith("wasm://", StringComparison.Ordinal): | |||
case var _ when url.EndsWith(".wasm", StringComparison.Ordinal): |
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.
Does this have any negative interaction with the code that filters unmanaged frames out of the callstack?
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.
As far as I know no. I will check it again.
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.
src/mono/wasm/debugger/debugger.md
Outdated
It's possible to debug native code and managed code using BrowserDebugProxy. | ||
|
||
Steps: | ||
- Install C/C++ DevTools Support (DWARF) extension on chrome. |
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.
Is there a link that can be provided for this? How does one find this tool.
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.
src/mono/wasm/debugger/debugger.md
Outdated
- You will see c# files and c files available to add breakpoint. | ||
|
||
Hint: | ||
- If you are running a Blazor app that has .c file(s) and you added <WasmNativeBuild>true</WasmNativeBuild> in the .csproj file, also add ``<_WasmDevel>true</_WasmDevel>`` to disable optimizations and have a better native debugging experience. |
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.
A suggestion here. I think this value should be set to true
automatically if the user is building in Debug
.
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.
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.
For context - right now we use -O1
for Debug
by default. And _WasmDevel
would make it -O0
. @Thays Am I correct in thinking that it won't change the compile times by too much, but it would be very helpful for native debugging, which is not common? We could set it if the user has any native code being linked in.
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.
Yes! It would be very helpful for native debugging.
So we could check, if build is debug and WasmNativeBuild is true then we set _WasmDevel to true?
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.
I added this in the PR.
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
- Run chrome using this startup parameter: --remote-debugging-port=9222 | ||
- Go to your Blazor App Page | ||
- Press Ctrl-Alt-D (windows) it will open the debugger page | ||
- It will show something like this in the Address Bar: ``http://localhost:9222/devtools/inspector.html?ws=127.0.0.1:9300/devtools/page/97FCDA5A332CA3B72031790B26A264EF`` |
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.
Is this manual process needed for native debugging specifically?
And does this work with dotnet run --debug
for a template browser app too?
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.
Yes, without launching using chrome://inspect the extension doesn't work.
Yes. Debugging the runtime while running artifacts\bin\dotnet-workload\dotnet run -f net7.0 -r browser-wasm -v n -c Debug --project src/libraries/System.Collections.Concurrent/tests/System.Collections.Concurrent.Tests.csproj --debug --host browser -p:DebuggerSupport=true
Co-authored-by: Larry Ewing <lewing@microsoft.com>
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.
Looks good.
src/mono/wasm/debugger/debugger.md
Outdated
|
||
Steps: | ||
- Install C/C++ DevTools Support (DWARF) extension on chrome. | ||
- Enable DWARF support: Open DevTools, click on the Engine, click on experiments and enable WebAssembly Debugging: Enable DWARF support. |
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.
…ntime into thays_enable_native_debugging
src/mono/wasm/debugger/debugger.md
Outdated
|
||
Hint: | ||
- If you are running a Blazor app that has .c file(s) and you added <WasmBuildNative>true</WasmBuildNative> in the .csproj file, also add ``<_WasmDevel>true</_WasmDevel>`` to disable optimizations and have a better native debugging experience. |
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.
this can be dropped now, correct?
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.
Yes!
Co-authored-by: Ankit Jain <radical@gmail.com>
Fix #69599