Skip to content

Commit 3db2ebf

Browse files
thaystgradicalSteveSandersonMS
authored
[debugger] First draft of managed debugger on wasi (#67272)
* first version of debug wasi * remove comment * fixing readme * Fix compilation error * fix compilation error * fix compilation * addressing steve comment * Stepping working * fix debugging aspnetcore app * wrong merge * addressing @viniciusjarina comment * addressing steve comments * work for remote debugging * make it work on windows * Update mini-wasi-debugger.c fix indentation * Update mini-wasi-debugger.c * Update mini-wasi-debugger.c * Trying to fix compilation * Update src/mono/mono/component/mini-wasi-debugger.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/mono/component/mini-wasi-debugger.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/mono/component/mini-wasi-debugger.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/mono/component/debugger-agent.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/mono/component/debugger-agent.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/mono/mini/interp/interp.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/mono/mini/interp/interp.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/wasi/Makefile Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/wasi/mono-wasi-driver/driver.c Co-authored-by: Ankit Jain <radical@gmail.com> * Update src/mono/mono/component/debugger-agent.c Co-authored-by: Ankit Jain <radical@gmail.com> * Addressing @radical comments * fix compilation errors * fixing readme * debugger working again * addressing @BrzVlad comments * Addressing @radical comments * Fix merge * Fix merge * Update diagnostics_server.c * Treat root directory as always existing, even if WASI isn't granting filesystem access. Needed for ASP.NET Core. * Update sample build config * Stop trying to use JS (browser) APIs for crypto, as there is no JS in wasi * Revert unneeded change * Apply suggestions from code review Co-authored-by: Ankit Jain <radical@gmail.com> * Addressing @radical comments * Addressing @radical comments * fixing debugger behavior and addressing @radical comments * Addressing @ SteveSandersonMS comments * Apply suggestions from code review Co-authored-by: Ankit Jain <radical@gmail.com> * Addressing radical comments * [wasi] Provision wasmtime as needed * [wasi] build, and run wasi sample on CI * [wasi] don't install wasmtime by default, but do that for CI * [wasi] Show a useful error if wasmtime is not found * [wasi] provision ninja * Fix path * Fix warnings to make CI green * debug * Move building wasi into a separate yml step, so it gets built after the whole wasm build is complete * fix yml * Enable wasi build on libtests job * Fix yml again Co-authored-by: Ankit Jain <radical@gmail.com> Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com>
1 parent 21dc004 commit 3db2ebf

34 files changed

+594
-97
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
parameters:
2+
archType: ''
3+
buildConfig: ''
4+
condition: always()
5+
creator: ''
6+
extraHelixArguments: ''
7+
helixQueues: ''
8+
interpreter: ''
9+
osGroup: ''
10+
additionalSteps: []
11+
runTests: true
12+
runtimeFlavor: ''
13+
shouldContinueOnError: false
14+
targetRid: ''
15+
testRunNamePrefixSuffix: ''
16+
testScope: 'innerloop' # innerloop | outerloop | all
17+
scenarios: ['normal']
18+
19+
steps:
20+
- ${{ if ne(parameters.additionalSteps, '') }}:
21+
- ${{ each additionalStep in parameters.additionalSteps }}:
22+
- ${{ additionalStep }}
23+
24+
- ${{ if eq(parameters.runTests, true) }}:
25+
- template: /eng/pipelines/libraries/helix.yml
26+
parameters:
27+
runtimeFlavor: ${{ parameters.runtimeFlavor }}
28+
archType: ${{ parameters.archType }}
29+
buildConfig: ${{ parameters.buildConfig }}
30+
helixQueues: ${{ parameters.helixQueues }}
31+
osGroup: ${{ parameters.osGroup }}
32+
targetRid: ${{ parameters.targetRid }}
33+
testRunNamePrefixSuffix: ${{ parameters.testRunNamePrefixSuffix }}
34+
testScope: ${{ parameters.testScope }}
35+
interpreter: ${{ parameters.interpreter }}
36+
condition: ${{ parameters.condition }}
37+
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
38+
extraHelixArguments: ${{ parameters.extraHelixArguments }} /p:BrowserHost=$(_hostedOs)
39+
creator: dotnet-bot
40+
scenarios: ${{ parameters.scenarios }}

eng/pipelines/common/templates/wasm-library-tests.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
parameters:
22
alwaysRun: false
3+
buildAndRunWasi: false
34
extraBuildArgs: ''
45
extraHelixArgs: ''
56
isExtraPlatformsBuild: false
@@ -49,8 +50,16 @@ jobs:
4950
eq(dependencies.evaluate_paths.outputs['SetPathVars_allwasm.containsChange'], true),
5051
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true))
5152
# extra steps, run tests
52-
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
53+
extraStepsTemplate: /eng/pipelines/common/templates/additional-steps-then-helix.yml
5354
extraStepsParameters:
55+
additionalSteps:
56+
- ${{ if eq(parameters.buildAndRunWasi, true) }}:
57+
- script: >-
58+
make -C src/mono/wasi provision-deps all &&
59+
make -C src/mono/wasi/sample/console run
60+
name: build_wasi
61+
displayName: Build Wasi, and run a sample
62+
5463
creator: dotnet-bot
5564
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
5665
extraHelixArguments: /p:BrowserHost=$(_hostedOs) ${{ parameters.runSmokeOnlyArg }} ${{ parameters.extraHelixArgs }}

eng/pipelines/runtime.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ jobs:
360360
parameters:
361361
platforms:
362362
- Browser_wasm
363+
buildAndRunWasi: true
363364
alwaysRun: ${{ variables.isRollingBuild }}
364365
scenarios:
365366
- normal

src/mono/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,14 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
247247
set(INTERNAL_ZLIB 1)
248248
elseif(CMAKE_SYSTEM_NAME STREQUAL "WASI")
249249
set(HOST_WASI 1)
250-
add_definitions(-D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN)
250+
add_definitions(-D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -DHOST_WASI)
251251
add_definitions(-DNO_GLOBALIZATION_SHIM)
252252
add_definitions(-D_THREAD_SAFE)
253+
add_definitions(-DGEN_PINVOKE)
253254
set(DISABLE_SHARED_LIBS 1)
254255
set(INTERNAL_ZLIB 1)
255256
set(DISABLE_EXECUTABLES 1)
256-
set(DISABLE_COMPONENTS 1)
257+
set(STATIC_COMPONENTS 1)
257258

258259
set(WASI_DRIVER_SOURCES
259260
wasi/mono-wasi-driver/driver.c

src/mono/mono/component/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ set(${MONO_DEBUGGER_COMPONENT_NAME}-sources
3131
${MONO_COMPONENT_PATH}/debugger-state-machine.h
3232
${MONO_COMPONENT_PATH}/debugger-state-machine.c
3333
${MONO_COMPONENT_PATH}/mini-wasm-debugger.c
34+
${MONO_COMPONENT_PATH}/mini-wasi-debugger.c
3435
${MONO_COMPONENT_PATH}/debugger-protocol.h
3536
${MONO_COMPONENT_PATH}/debugger-protocol.c
3637
)

0 commit comments

Comments
 (0)