Skip to content

Commit fdc628c

Browse files
committed
Enable native debugging for wasm modules/components
Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
1 parent 3aed4cc commit fdc628c

File tree

16 files changed

+947
-568
lines changed

16 files changed

+947
-568
lines changed

.vscode/launch.json

Lines changed: 89 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,101 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
// this can be used to debug tests
6-
"version": "0.2.0",
2+
"inputs": [
3+
{
4+
"id": "program",
5+
"type": "promptString",
6+
"default": "x64/debug/wasm_runtime",
7+
"description": "Path to the program to debug",
8+
}
9+
],
710
"configurations": [
811
{
912
"type": "lldb",
1013
"request": "launch",
11-
"name": "Cargo test",
14+
"name": "Debug example 'guest-debugging'",
15+
"cargo": {
16+
"args": [
17+
"build",
18+
"--example=guest-debugging",
19+
"--package=hyperlight-wasm",
20+
"--features=gdb",
21+
],
22+
"filter": {
23+
"name": "guest-debugging",
24+
"kind": "example"
25+
}
26+
},
27+
"env": {
28+
"RUST_DIR_FOR_DEBUGGING_TESTS": "${workspaceFolder}/src/hyperlight_wasm",
29+
},
30+
"args": [],
31+
"cwd": "${workspaceFolder}"
32+
},
33+
{
34+
"type": "lldb",
35+
"request": "launch",
36+
"name": "Debug example 'rust_wasm_examples'",
1237
"cargo": {
13-
"args": [
14-
"test",
15-
"--profile=dev",
16-
"--lib",
17-
"--no-run"
18-
19-
],
20-
"filter": {
21-
"name": "hyperlight_wasm",
22-
"kind": "lib"
23-
}
38+
"args": [
39+
"build",
40+
"--example=rust_wasm_examples",
41+
"--package=hyperlight-wasm",
42+
],
43+
"filter": {
44+
"name": "rust_wasm_examples",
45+
"kind": "example"
46+
}
2447
},
2548
"env": {
26-
"RUST_DIR_FOR_DEBUGGING_TESTS": "${workspaceFolder}/src/hyperlight_wasm"
49+
"RUST_DIR_FOR_DEBUGGING_TESTS": "${workspaceFolder}/src/hyperlight_wasm",
50+
},
51+
"args": [],
52+
"cwd": "${workspaceFolder}"
53+
},
54+
{
55+
"name": "Remote GDB attach",
56+
"type": "cppdbg",
57+
"request": "launch",
58+
"program": "${input:program}",
59+
"args": [],
60+
"stopAtEntry": true,
61+
"hardwareBreakpoints": {
62+
"require": false,
63+
"limit": 4
2764
},
28-
"args": [
29-
"--exact",
30-
"sandbox::loaded_wasm_sandbox::tests::test_call_host_func_with_vecbytes"
65+
"cwd": "${workspaceFolder}",
66+
"environment": [],
67+
"externalConsole": false,
68+
"MIMode": "gdb",
69+
"miDebuggerPath": "/usr/bin/gdb",
70+
"miDebuggerServerAddress": "localhost:8080",
71+
"setupCommands": [
72+
{
73+
"description": "Enable pretty-printing for gdb",
74+
"text": "-enable-pretty-printing",
75+
"ignoreFailures": true
76+
},
77+
{
78+
"description": "Set Disassembly Flavor to Intel",
79+
"text": "-gdb-set disassembly-flavor intel",
80+
"ignoreFailures": true
81+
},
82+
//{
83+
//"description": "Add symbols",
84+
//"text": "symbol-file ${workspaceFolder}/x64/debug/rust_wasm_samples.wasm",
85+
//"ignoreFailures": true
86+
//}
3187
]
32-
}
88+
},
89+
{
90+
"name": "Remote LLDB attach",
91+
"type": "lldb",
92+
"request": "launch",
93+
"targetCreateCommands": [
94+
"target create ${input:program}",
95+
],
96+
"processCreateCommands": [
97+
"gdb-remote localhost:8080"
98+
],
99+
},
33100
]
34101
}

0 commit comments

Comments
 (0)