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] debug with modularized runtime(s) #61848

Merged
merged 7 commits into from
Nov 25, 2021

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Nov 19, 2021

Context

After we modularize the runtime, the APIs like MONO or INTERNAL would not be on globalThis anymore.
Also, there would be possibility to instantiate multiple runtimes in the same web page.

I don't think that multiple runtimes on same page nor multiple debuggers running on same page in parallel are very likely scenarios. This PR is just neat way how to allow that possibility in the future, while solving the isolation that ES6 will bring.

Changes

  • New globalThis.getDotnetRuntime method, which takes runtimeId, essentially index of the runtime on the page. It returns the DotNetPublicAPI object of the instance {MONO, BINDING, Module, RuntimeId, RuntimeBuildInfo }.
  • Change the debugger to use the getDotnetRuntime() function when talking to the runtime on the page via CDP.
  • Use getDotnetRuntime() in unit tests, with runtimeId is zero as there is only one runtime in tests.
  • We add optional &runtimeId=0 to the initial URL which opens DebuggerProxy, so that MonoProxy could be created for specific runtime on the page.
  • Moved mono_wasm_add_dbg_command_received, mono_wasm_debugger_log and mono_wasm_trace_logger out of C macro into typescript
  • Introduced RuntimeBuildInfo: { ProductVersion, Configuration } into DotNetPublicAPI

@ghost
Copy link

ghost commented Nov 19, 2021

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

Issue Details

It doesn't work yet

Author: pavelsavara
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Nov 19, 2021
@ghost
Copy link

ghost commented Nov 19, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

It doesn't work yet

Author: pavelsavara
Assignees: -
Labels:

arch-wasm, area-Debugger-mono

Milestone: -

@pavelsavara pavelsavara force-pushed the wasm_debug_multiple_runtimes branch 2 times, most recently from 4b82de2 to f6b1a7a Compare November 23, 2021 14:01
@pavelsavara pavelsavara force-pushed the wasm_debug_multiple_runtimes branch from eab63aa to a780dc9 Compare November 23, 2021 20:36
@pavelsavara pavelsavara requested a review from thaystg November 23, 2021 20:42
@pavelsavara pavelsavara changed the title [DRAFT][wasm] debug multiple runtimes [wasm] debug multiple runtimes Nov 24, 2021
@pavelsavara pavelsavara requested a review from kg November 24, 2021 10:25
@pavelsavara pavelsavara marked this pull request as ready for review November 24, 2021 10:25
@pavelsavara pavelsavara added this to the 7.0.0 milestone Nov 24, 2021
Copy link
Member

@kg kg left a comment

Choose a reason for hiding this comment

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

Looks good, needs debugger expert approval though

src/mono/wasm/runtime/debug.ts Outdated Show resolved Hide resolved
src/mono/wasm/runtime/debug.ts Outdated Show resolved Hide resolved
src/mono/wasm/runtime/export-types.ts Show resolved Hide resolved
src/mono/wasm/runtime/exports.ts Outdated Show resolved Hide resolved
@pavelsavara pavelsavara changed the title [wasm] debug multiple runtimes [wasm] debug with modularized runtime(s) Nov 24, 2021
@pavelsavara pavelsavara requested a review from lewing November 24, 2021 13:46
Copy link
Member

@thaystg thaystg left a comment

Choose a reason for hiding this comment

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

Looks good to me.
Debugger tests passing. Debug a Blazor app also working.

@pavelsavara
Copy link
Member Author

pavelsavara commented Nov 24, 2021

[FAIL] System.Diagnostics.Tests.StopwatchTests.GetTimestamp is #62021

@pavelsavara
Copy link
Member Author

@lewing we would appreciate your feedback on this PR, proxy code in particular. If you have any comments I will fix it in future PRs. Will merge this now.

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.

5 participants