Open EmmanuelOga opened 3 years ago
I think adding breakpoints to the interpreter or VM would probably be a lot simpler than implementing a debugger for some executable format. In any case, I found some links that I think this will be educational / informative even though most of them talk about debugging compiled Linux ELF/DWARF executables.
https://www.timdbg.com/ (see also https://news.ycombinator.com/item?id=37670938)
https://blog.tartanllama.xyz/writing-a-linux-debugger-setup/
https://eli.thegreenplace.net/2011/01/23/how-debuggers-work-part-1
http://t-a-w.blogspot.com/2007/03/how-to-code-debuggers.html
https://www.codeproject.com/Articles/43682/Writing-a-basic-Windows-debugger
I actually found some of the above links through this article:
a sampling profiler is mostly a really fast, very inflexible, debugger.
Hi,
I suspect implementing a stepper debugger would be easier in some ways when doing it on top of the bytecode VM, and I can think of a few ways for doing it ... although I bet it can get trickier than it seems! (thinking of this explanation of how GDB works).
Stepping through the AST interpreter seems somewhat more involved, and I only found some paper describing a smalltalk AST tree walker debugger using some sort of visitor pattern to grant the ability to pause in any given node.
I was wondering what are your thoughts about adding debugging support to Lox and languages in general. I feel like this is a weak area of many languages tooling.