Commit 84c83e6
committed
feat: add DWARF debugging support and source mapping infrastructure
- Add new dwarf-rust module for parsing DWARF debugging information from WebAssembly modules
- Implement RustParser to extract source line mapping information from DWARF sections
- Add comprehensive SMAP (Source Map) parsing infrastructure to runtime module
- Enhance compiler to add SMAPs to class files, and they can be used to enhance stack traces.
- Add LineMapping, Smap, SmapParser, and Stratum classes for source map handling
- Integrate DWARF parsing with runtime Instance and InterpreterMachine for better error reporting
- Enhance TrapException with source mapping capabilities for improved debugging
- Add test coverage with approval tests for Rust and TinyGo source mapping scenarios
- Include sample WASM files with embedded DWARF information for testing
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. The DWARF
parsing functionality bridges the gap between compiled WebAssembly bytecode and original source code,
significantly improving the debugging experience.
Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>1 parent 5f99f22 commit 84c83e6
37 files changed
Lines changed: 116052 additions & 15 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
- 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
- tinygo
- wasm/src/main/java/com/dylibso/chicory/wasm
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: 129 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 | + | |
| 160 | + | |
134 | 161 | | |
135 | 162 | | |
136 | 163 | | |
| |||
162 | 189 | | |
163 | 190 | | |
164 | 191 | | |
| 192 | + | |
165 | 193 | | |
166 | 194 | | |
167 | 195 | | |
| |||
172 | 200 | | |
173 | 201 | | |
174 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
175 | 208 | | |
176 | 209 | | |
177 | 210 | | |
| |||
197 | 230 | | |
198 | 231 | | |
199 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
200 | 239 | | |
201 | 240 | | |
202 | 241 | | |
203 | 242 | | |
204 | 243 | | |
205 | | - | |
| 244 | + | |
| 245 | + | |
206 | 246 | | |
207 | 247 | | |
208 | 248 | | |
| |||
286 | 326 | | |
287 | 327 | | |
288 | 328 | | |
| 329 | + | |
289 | 330 | | |
290 | 331 | | |
291 | 332 | | |
292 | 333 | | |
293 | 334 | | |
294 | 335 | | |
| 336 | + | |
295 | 337 | | |
296 | 338 | | |
297 | 339 | | |
| |||
396 | 438 | | |
397 | 439 | | |
398 | 440 | | |
| 441 | + | |
399 | 442 | | |
400 | 443 | | |
401 | 444 | | |
| |||
436 | 479 | | |
437 | 480 | | |
438 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
439 | 501 | | |
440 | 502 | | |
441 | 503 | | |
| |||
471 | 533 | | |
472 | 534 | | |
473 | 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 | + | |
| 564 | + | |
474 | 565 | | |
475 | 566 | | |
476 | 567 | | |
| |||
574 | 665 | | |
575 | 666 | | |
576 | 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 | + | |
| 695 | + | |
577 | 696 | | |
578 | 697 | | |
579 | 698 | | |
| |||
1187 | 1306 | | |
1188 | 1307 | | |
1189 | 1308 | | |
1190 | | - | |
| 1309 | + | |
1191 | 1310 | | |
1192 | 1311 | | |
1193 | 1312 | | |
| |||
1225 | 1344 | | |
1226 | 1345 | | |
1227 | 1346 | | |
| 1347 | + | |
1228 | 1348 | | |
1229 | 1349 | | |
1230 | 1350 | | |
1231 | 1351 | | |
1232 | 1352 | | |
1233 | 1353 | | |
1234 | 1354 | | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
1235 | 1361 | | |
1236 | 1362 | | |
1237 | 1363 | | |
| |||
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: 46 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 | + | |
| 251 | + | |
| 252 | + | |
207 | 253 | | |
Lines changed: 7 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 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
| |||
0 commit comments