Skip to content

Conversation

@thaystg
Copy link
Member

@thaystg thaystg commented Jan 24, 2022

This PR is what I would like to backport to 6.0.

On .net7 my plan is to check if there is dwarf symbols or create something to enable it, the callstack with wasm functions are useful when we want to debug the runtime code.

But I would like to merge this version and backport to make callstack have the same behavior that we had on .net5.

In the first time that we run the Blazor project we get this:
"http://localhost:5174/_framework/dotnet.wasm" in the URL field of the original callstack that came from the browser.
After stop and running again we get this:
"wasm://wasm/00945abe"

That is why the user was complaining about seeing different callstack on first and second execution.

Fixes #63466

@thaystg thaystg requested a review from marek-safar as a code owner January 24, 2022 19:27
@ghost ghost added the area-Debugger-mono label Jan 24, 2022
@ghost ghost assigned thaystg Jan 24, 2022
@ghost
Copy link

ghost commented Jan 24, 2022

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR is what I would like to backport to 6.0.

On .net7 my plan is to check if there is dwarf symbols or create something to enable it, the callstack with wasm functions are useful when we want to debug the runtime code.

But I would like to merge this version and backport to make callstack have the same behavior that we had on .net5.

In the first time that we run the Blazor project we get this:
"http://localhost:5174/_framework/dotnet.wasm" in the URL field of the original callstack that came from the browser.
After stop and running again we get this:
"wasm://wasm/00945abe"

That is why the user was complaining about seeing different informations on first and second execution.

Fixes #63466

Author: thaystg
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

string url = frame["url"]?.Value<string>();
if (!(function_name.StartsWith("wasm-function", StringComparison.Ordinal) ||
url.StartsWith("wasm://wasm/", StringComparison.Ordinal) || function_name == "_mono_wasm_fire_debugger_agent_message"))
url.StartsWith("wasm://wasm/", StringComparison.Ordinal) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the script parsed event has another different condition, should they be the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe convert to a method, so the two places stay in sync? IsAWasmUrl?

@radical
Copy link
Member

radical commented Jan 25, 2022

Will this handle the cases - with, and without debug symbols? Also, it would be useful to have a way to turn these back on.

@thaystg
Copy link
Member Author

thaystg commented Jan 26, 2022

Will this handle the cases - with, and without debug symbols? Also, it would be useful to have a way to turn these back on.

In this PR we are ignoring wasm it doesn't matter if it is with or without symbols. And this is what I want to be the behavior on .net6.

For .net7 I will consider if it's with symbols and also support debugging something like a "mixed" mode, where we can debug the managed code, and using the DWARF extension debug the native code. This was already tested by me and it works :)

@radical
Copy link
Member

radical commented Jan 26, 2022

In this PR we are ignoring wasm it doesn't matter if it is with or without symbols. And this is what I want to be the behavior on .net6.

I meant, does the url follow the same rules (starts with wasm://, or ending with .wasm) in case of building with, or without symbols, but I guess that would be the case of AOT, not here. Ignore my comment :)

Having a way to not filter these frames out would be useful for those working on the runtime.

@thaystg
Copy link
Member Author

thaystg commented Jan 26, 2022

In this PR we are ignoring wasm it doesn't matter if it is with or without symbols. And this is what I want to be the behavior on .net6.

I meant, does the url follow the same rules (starts with wasm://, or ending with .wasm) in case of building with, or without symbols, but I guess that would be the case of AOT, not here. Ignore my comment :)

Having a way to not filter these frames out would be useful for those working on the runtime.

Yes, I'll implement a way to not filter these frames for net7, do you think I should find a solution for it for .net6 also?

@thaystg
Copy link
Member Author

thaystg commented Jan 26, 2022

@lambdageek , As we have already discussed offline we would like to have a way to enable and disable showing the wasm functions on callstack, do you think this is important for .net6?
Or in .net6 I can just hide the wasm functions and for .net7 I implement something that we can enable and disable it and also showing wasm functions based on having dwarf information?

@lambdageek
Copy link
Member

@lambdageek , As we have already discussed offline we would like to have a way to enable and disable showing the wasm functions on callstack, do you think this is important for .net6?

We talked offline. We can't think of a scenario where seeing the mangled wasm function names (which are not the C function symbols) is useful either for end users or for runtime developers. (even if linking native libraries, or using AOT) So it seems ok to disable completely.

switch (url)
{
case var _ when url == "":
case var _ when url.StartsWith("wasm://", StringComparison.Ordinal):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason we're usingurl.StartsWith("wasm://" here and url.StartsWith("wasm://wasm/", in SendCallStack?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@lewing lewing closed this Mar 17, 2022
@lewing lewing reopened this Mar 17, 2022
@lewing lewing merged commit 15db6e0 into dotnet:main Mar 17, 2022
radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Mar 30, 2022
…gging managed code (dotnet#64223)

* Show the callstack as it's shown on net5.

* Addressing @lewing and @radical comments.

* addressing @lewing comment.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wasm][debugger] Show a better stack trace for final user

5 participants