A Debugger is a REPL is a Debugger
matklad.github.io
matklad.github.io
$ alias breakpoint
alias breakpoint='
while read -p"Debugging(Ctrl-d to exit)> " debugging_line
do
eval "$debugging_line"
done
'
Good breakpoint repl you can insert anywhere in a bash scriptYou can also just execute another ‘bash’ process, of course the environment is a bit different
the debugger is just a REPL started in a peculiar environment that has e.g. some extra restarts registered by the error handler.
Modern debuggers have specialized capabilities way beyond the reach of REPLs.
Reverse debugging and debugging optimized programs come to mind.
What makes modern debuggers special is the insane amount of engineering to make it work.
LLDB is close to a thousand man years of engineering iirc.
That’s what gets me: better languages are able to scrape by with several orders of magnitude less investment, precisely because they are better — but imagine how much more progress we as an industry would have made had we only invested a little more in those more promising ecosystems and a little less in the terrible ones.
Only if you are running on a machine with a full OS.
Embedded debugging is so bad that Microsoft forcing everybody to use DAP (Debug Adapter Protocol) was a step up.
It also doesn't help that compiler writers never met an optimization that they didn't like. It's often really hard to unwind optimized code back to something useful to probe. Sure, you can turn on debug optimizations but then your code runs an order of magnitude slower.
There is still some catching up missing from other programming stacks.
The ultimate redo-eval-loop, with almost zero downtime.
They are Jupyter notebooks on steroids.
Try something like this:
:lua require('dapui').eval()
For running to the current cursor: :lua require('dap').run_to_cursor()
Assign that to keys that you want.It works with gdb's DAP adapter.