Commit 3a43ba5
committed
feat: add DWARF debugging support and source mapping infrastructure
- Add comprehensive SMAP (Source Map) parsing infrastructure to runtime module
- Add new dwarf-rust module for parsing DWARF debugging information from WebAssembly modules to SMAP stratums
- Enhance InterpreterMachine to use parsed SMAP stratums to enhance stack traces.
- Enhance compiler to add SMAPs to class files and use to enhance stack traces.
This enhancement enables developers to get meaningful stack traces with original source line numbers
when debugging WebAssembly modules compiled from high-level languages like Rust and Go.
Where you would get exceptions that looked like.
```
com.dylibso.chicory.runtime.TrapException: Trapped on unreachable instruction
at com.dylibso.chicory.runtime.InterpreterMachine.THROW_UNREACHABLE(InterpreterMachine.java:2212)
at com.dylibso.chicory.runtime.InterpreterMachine.eval(InterpreterMachine.java:182)
at com.dylibso.chicory.runtime.InterpreterMachine.call(InterpreterMachine.java:100)
at com.dylibso.chicory.runtime.InterpreterMachine.CALL(InterpreterMachine.java:1715)
... more of the same …
at com.dylibso.chicory.runtime.InterpreterMachine.eval(InterpreterMachine.java:550)
at com.dylibso.chicory.runtime.InterpreterMachine.call(InterpreterMachine.java:100)
at com.dylibso.chicory.runtime.InterpreterMachine.call(InterpreterMachine.java:65)
at com.dylibso.chicory.runtime.Instance$Exports.lambda$function$0(Instance.java:219)
at com.dylibso.chicory.testing.MachinesTest.lambda$shouldEmitUnderstandableStackTraces$0(MachinesTest.java:300)
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:53)
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:35)
at org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3128)
at com.dylibso.chicory.testing.MachinesTest.shouldEmitUnderstandableStackTraces(MachinesTest.java:300)
```
You now get exceptions that look like:
```
com.dylibso.chicory.runtime.TrapException: Trapped on unreachable instruction
at chicory interpreter 0x006721: func.94(library/std/src/sys/pal/wasm/../unsupported/common.rs:28)
at chicory interpreter 0x005cc6: func.79(library/std/src/panicking.rs:699)
at chicory interpreter 0x005c00: func.78(library/std/src/sys/backtrace.rs:168)
at chicory interpreter 0x00627d: func.86(library/std/src/panicking.rs:697)
at chicory interpreter 0x007e74: func.118(library/core/src/panicking.rs:117)
at chicory interpreter 0x007ec8: func.119(library/core/src/panicking.rs:218)
at chicory interpreter 0x001cf6: func.30(/rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/ub_checks.rs:68)
at chicory interpreter 0x003948: func.54(/rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/ub_checks.rs:75)
at chicory interpreter 0x000d7f: func.11(src/lib.rs:23)
at com.dylibso.chicory.runtime.Instance$Exports.lambda$function$0(Instance.java:219)
at com.dylibso.chicory.testing.MachinesTest.lambda$shouldEmitUnderstandableStackTraces$0(MachinesTest.java:300)
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:53)
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:35)
at org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3128)
at com.dylibso.chicory.testing.MachinesTest.shouldEmitUnderstandableStackTraces(MachinesTest.java:300)
```
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>1 parent 3a2fa87 commit 3a43ba5
47 files changed
Lines changed: 20683 additions & 25 deletions
File tree
- compiler-tests/src/test/resources/com/dylibso/chicory/testing
- compiler/src
- main/java/com/dylibso/chicory/compiler
- internal
- test/resources/com/dylibso/chicory/approvals
- dwarf-rust
- src
- main
- java/com/dylibso/chicory/dwarf/rust
- wasm
- test
- java/com/dylibso/chicory/dwarf/rust
- resources/com/dylibso/chicory/dwarf/rust
- machine-tests
- src/test/java/com/dylibso/chicory/testing
- runtime/src
- main/java/com/dylibso/chicory/runtime
- internal/smap
- test
- java/com/dylibso/chicory/runtime/internal/smap
- resources
- wasm-corpus
- src/main/resources
- compiled
- rust/count_vowels/src
- tinygo
- wasm/src
- main/java/com/dylibso/chicory/wasm
- types
- test/java/com/dylibso/chicory/wasm
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
| |||
55 | 53 | | |
56 | 54 | | |
57 | 55 | | |
58 | | - | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| |||
Lines changed: 128 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| |||
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
124 | 148 | | |
125 | 149 | | |
126 | 150 | | |
127 | 151 | | |
128 | 152 | | |
129 | | - | |
| 153 | + | |
| 154 | + | |
130 | 155 | | |
131 | 156 | | |
132 | 157 | | |
133 | 158 | | |
| 159 | + | |
134 | 160 | | |
135 | 161 | | |
136 | 162 | | |
| |||
162 | 188 | | |
163 | 189 | | |
164 | 190 | | |
| 191 | + | |
165 | 192 | | |
166 | 193 | | |
167 | 194 | | |
| |||
172 | 199 | | |
173 | 200 | | |
174 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
175 | 207 | | |
176 | 208 | | |
177 | 209 | | |
| |||
197 | 229 | | |
198 | 230 | | |
199 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
200 | 238 | | |
201 | 239 | | |
202 | 240 | | |
203 | 241 | | |
204 | 242 | | |
205 | | - | |
| 243 | + | |
| 244 | + | |
206 | 245 | | |
207 | 246 | | |
208 | 247 | | |
| |||
286 | 325 | | |
287 | 326 | | |
288 | 327 | | |
| 328 | + | |
289 | 329 | | |
290 | 330 | | |
291 | 331 | | |
292 | 332 | | |
293 | 333 | | |
294 | 334 | | |
| 335 | + | |
295 | 336 | | |
296 | 337 | | |
297 | 338 | | |
| |||
396 | 437 | | |
397 | 438 | | |
398 | 439 | | |
| 440 | + | |
399 | 441 | | |
400 | 442 | | |
401 | 443 | | |
| |||
436 | 478 | | |
437 | 479 | | |
438 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
439 | 500 | | |
440 | 501 | | |
441 | 502 | | |
| |||
471 | 532 | | |
472 | 533 | | |
473 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
474 | 564 | | |
475 | 565 | | |
476 | 566 | | |
| |||
574 | 664 | | |
575 | 665 | | |
576 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
577 | 695 | | |
578 | 696 | | |
579 | 697 | | |
| |||
1187 | 1305 | | |
1188 | 1306 | | |
1189 | 1307 | | |
1190 | | - | |
| 1308 | + | |
1191 | 1309 | | |
1192 | 1310 | | |
1193 | 1311 | | |
| |||
1225 | 1343 | | |
1226 | 1344 | | |
1227 | 1345 | | |
| 1346 | + | |
1228 | 1347 | | |
1229 | 1348 | | |
1230 | 1349 | | |
1231 | 1350 | | |
1232 | 1351 | | |
1233 | 1352 | | |
1234 | 1353 | | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1235 | 1360 | | |
1236 | 1361 | | |
1237 | 1362 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
207 | 251 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
| |||
0 commit comments