Skip to content

[wasm][debugger] Implement support to symbolOptions from dap. - #79284

Merged
thaystg merged 26 commits into
dotnet:mainfrom
thaystg:thays_support_symbolOptions
Jan 23, 2023
Merged

[wasm][debugger] Implement support to symbolOptions from dap.#79284
thaystg merged 26 commits into
dotnet:mainfrom
thaystg:thays_support_symbolOptions

Conversation

@thaystg

Copy link
Copy Markdown
Member

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

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

@ghostghost added the area-Debugger-mono label Dec 6, 2022
@ghostghost assigned thaystgDec 6, 2022
@ghost

ghost commented Dec 6, 2022

Copy link
Copy Markdown

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
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated

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

if (document.StartsWith(keyTrim, StringComparison.OrdinalIgnoreCase))

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I don't know :)

Comment threadsrc/mono/mono/component/debugger-engine.c Outdated
thaystgand 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>
Comment threadsrc/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj Outdated
[ConditionalTheory(nameof(RunningOnChrome))]
[InlineData(true)]
[InlineData(false)]
public async Task SteppingIntoLibrarySymbolsLoadedFromSymbolServer(bool justMyCode)

Copy link
Copy Markdown
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

Comment threadsrc/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Co-authored-by: Ankit Jain <radical@gmail.com>
@ghostghost 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
Copy Markdown
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
Copy Markdown
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].

Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
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
Copy Markdown
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.

Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated
Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs Outdated
@ghostghost 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.
@ghostghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Jan 18, 2023

@radicalradical left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

/azp run runtime-wasm-non-libtests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@lewinglewing mentioned this pull request Jan 19, 2023
3 tasks
context.IsSteppingThroughMethod = true;
if (event_kind == EventKind.Step)
context.IsSkippingHiddenMethod = true;
if (await SkipMethod(isSkippable: true, shouldBeSkipped: true, StepKind.Out))

Copy link
Copy Markdown
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!

Comment threadsrc/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs Outdated
radicaland 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:mainJan 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>
@thaystgthaystg mentioned this pull request Feb 6, 2023
3 tasks
@ghostghost locked as resolved and limited conversation to collaborators Feb 23, 2023
Sign up for freeto 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.

3 participants

@thaystg@radical@lewing