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][debugger] Implement support to symbolOptions from dap. #79284

Merged
merged 26 commits into from
Jan 23, 2023

Conversation

thaystg
Copy link
Member

@thaystg thaystg commented Dec 6, 2022

Receive the symbolOptions settings from VS and use it do load debug information.

related to: microsoft/vscode-js-debug#1467

@ghost
Copy link

ghost commented Dec 6, 2022

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

Issue Details

Receive the symbolOptions settings from VS and use it do load debug information.

related to: microsoft/vscode-js-debug#1467

Author: thaystg
Assignees: thaystg
Labels:

area-Debugger-mono

Milestone: -

@thaystg thaystg marked this pull request as ready for review December 20, 2022 13:31
src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs Outdated Show resolved Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs Outdated Show resolved Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved

string keyTrim = key.TrimEnd('*');

if (document.StartsWith(keyTrim, StringComparison.OrdinalIgnoreCase))
Copy link
Member

Choose a reason for hiding this comment

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

Curious - does this need to be culture sensitive? And case?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know :)

thaystg and others added 4 commits January 6, 2023 15:34
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
[ConditionalTheory(nameof(RunningOnChrome))]
[InlineData(true)]
[InlineData(false)]
public async Task SteppingIntoLibrarySymbolsLoadedFromSymbolServer(bool justMyCode)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe also:

  • a test that first hits the bp, and steps with no symbol server set. Then in the same test, sets the symbol server, and steps again
  • A separate test that (a) sets a symbol server; (b) steps; (c) adds another symbol server; (d) steps again
  • A separate test that (a) adds multiple symbol servers; (b) steps; (c) removes one of the symbol servers; (d) steps again

Co-authored-by: Ankit Jain <radical@gmail.com>
@ghost ghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Jan 17, 2023
{
List<AssemblyInfo> ret = new List<AssemblyInfo> ();
if (symbolStore == null)
return ret;
Copy link
Member

Choose a reason for hiding this comment

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

return Enumerable.Empty<AssemblyInfo> instead. It will save on the unnecessary allocation which will have a non-zero sized backing array.

{
if (string.IsNullOrEmpty(urlServer))
continue;
symbolStore = new HttpSymbolStore(_tracer, symbolStore, new Uri($"{urlServer}/"), null);
Copy link
Member

Choose a reason for hiding this comment

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

This should handle exceptions, and continue to try the remaining urls.

And a corresponding test with [ goodUrl1, badUrl, goodUrl2].

src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved
Comment on lines 1169 to 1184
internal void UpdatePdbInformationFromSymbolServer(Stream streamToReadFrom)
{
var pdbStream = new MemoryStream();
streamToReadFrom.Position = 0;
streamToReadFrom.CopyTo(pdbStream);
pdbStream.Position = 0;
pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader();
if (pdbMetadataReader == null)
return;
ProcessSourceLink();
foreach (var method in this.Methods)
{
method.Value.pdbMetadataReader = pdbMetadataReader;
method.Value.UpdatePdbInformation(method.Value.methodDefHandle);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This can be merged with LoadPDBFromSymbolServer.

src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated Show resolved Hide resolved
@ghost ghost added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jan 17, 2023
Changing when the symbols from symbol server is loaded because it takes a long time to load, as there are a lot of assemblies loaded not found on symbol servers.
@ghost ghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Jan 18, 2023
Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

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

Other than the suggested tests, LGTM! Thank you for patiently working with the feedback! And for pursuing the whole process to make this happen!!

Removing timeout change as @radical has split it into 2 files
Fixing test behavior, when justMyCode is disabled but the symbols are not loaded from symbol server.
@thaystg
Copy link
Member Author

thaystg commented Jan 19, 2023

/azp run runtime-wasm-non-libtests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

else if (event_kind != EventKind.UserBreak)
context.IsSteppingThroughMethod = true;
if (event_kind == EventKind.Step)
context.IsSkippingHiddenMethod = true;
if (await SkipMethod(isSkippable: true, shouldBeSkipped: true, StepKind.Out))
Copy link
Member

Choose a reason for hiding this comment

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

👍 for the named params!

radical and others added 4 commits January 20, 2023 22:57
- Don't call `UpdateSymbolStore` from `DebugStore..ctor` because that
gets called multiple times in `LoadStore`, but only once instance gets
used.
- Use an isolated symbol cache path per test
# Conflicts:
#	src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
@thaystg thaystg merged commit 4c992b1 into dotnet:main Jan 23, 2023
mdh1418 pushed a commit to mdh1418/runtime that referenced this pull request Jan 24, 2023
…#79284)

* Draft to implement support to symbolOptions from dap.

* removing debugger.launch

* Adding tests and fix compilation error

* Adding test case.

* Fix test cases, and implement support to PDBChecksum used on nuget.org to get symbols.

* merge

* Fixing tests.

* Tests are timing out.

* Apply suggestions from code review

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>

* adressing @radical comments.

* Addressing @radical comment.

* Addressing @radical comments.

* Apply suggestions from code review

Co-authored-by: Ankit Jain <radical@gmail.com>

* Addressing @radical comments.

* Addressing @radical comments
Changing when the symbols from symbol server is loaded because it takes a long time to load, as there are a lot of assemblies loaded not found on symbol servers.

* use MicrosoftCodeAnalysisCSharpVersion for scripting package.

* Adding more tests as asked by @radical
Removing timeout change as @radical has split it into 2 files
Fixing test behavior, when justMyCode is disabled but the symbols are not loaded from symbol server.

* [wasm] some cleanup

- Don't call `UpdateSymbolStore` from `DebugStore..ctor` because that
gets called multiple times in `LoadStore`, but only once instance gets
used.
- Use an isolated symbol cache path per test

* remove debug spew

* Addressing radical comment.

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
@ghost ghost locked as resolved and limited conversation to collaborators Feb 23, 2023
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.

None yet

3 participants