by emidln · 5y ago · 0 comments
A cycle that went something like:
1. Write the line to a file
2. Compile file with default flags
3. Run binary in gdb causing gdb to dump certain interest info (stack info, variable contents, etc)
4. Read the sections/symbols and merge this data into the gdb data (maybe get it from gdb)
5. Dump this data into your reply and refresh waiting for user input.
You could have a few basic commands in the repl:Modify the compiler args Add/remove/edit a line Attach gdb.
Emacs or vim could easily do this, and I suspect there are people who already do almost exactly this.
You could also just use any editor/ide with debug integration and keep a scratch file around...
We're talking about a repl here, not just a basic shell. You'll need to be able to redefine functions and everything else at runtime so a repl is all you need to run your program. A lisp with a standard repl is running miles around any editor/ide with debugger support, as the workflow with repls, especially ones that can nest on exception and so on, is much faster.