anza-xyz / move

Move compiler targeting llvm supported backends
https://discord.gg/wFgfjG9J
Apache License 2.0
109 stars 34 forks source link

Support source-level debugging of Move programs #218

Open ksolana opened 1 year ago

ksolana commented 1 year ago

As per: @nvjle

As mentioned above, the move-mv-llvm-compiler would need to generate DI metadata + intrinsics into the LLVM IR. We do not do that today, and it has never been mentioned as a TODO yet.

It does appear that the Move bytecode we receive has some rudimentary location and partial symbol information, so it is certainly possible to generate some DI from that. Then GDB or LLDB would have to be taught a little bit about the language, but being similar to Rust, that probably isn't too difficult (details).

I don't recall, either, seeing any debugger in the Move Project itself. I don't know if/how they do source level debugging. The Move Language does not yet even have a DWARF Language Code in the standard (https://dwarfstd.org/languages.html). The various "official" Move projects (upstream Move, Aptos, Sui) do not seem to have source debugging as a priority-- possibly because the language is still not mature-- or just bigger fish to fry.

ksolana commented 1 year ago

cc: @jcivlin

ksolana commented 1 year ago

llvm tutorial on how to add debugging support: https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.html