sway
sway copied to clipboard
Debugger-support wishlist
This is meta-issue tracking missing compiler features for DAP support.
To accomodate for a nice debugger experience and to support all DAP features (e.g. VS Code debugger), we should export metadata about compiled bytecode. At least the following features are missing:
Inlining-aware source mapping
When functions are inlined, currently there is no way to figure out where the a chunk of code is from. Because functions containing inlined parts can be inlined into other functions, we must be able to record the whole stack of inlinings.
Variable storage and scope information
It should be possible to export what variables exist in which scopes. For each variable, it should be possible to determine where the value pointed by it is stored (e.g. memory location, register number or optimized away). For variables that don't actually have any associated storage (e.g. unused or optimized by constant propagation), this information should be available as well. Lifetime of the variable should also be available.
This feature is needed so that VS Code debugger can show variable values when hovering over them.
Constant names
Constants (those placed after the code in the resulting binary) should have names associated with them in source mapping.
Related / blocked by https://github.com/FuelLabs/sway/issues/1527.