Most of the times I use ocamldebug, I do something like this :
OCaml Debugger version 4.04.1
(ocd) r
Loading program... done.
Time: 4468978
Program end.
Uncaught exception: You_failed_again "you idiot"
(ocd) b
Time: xxxxxx - pc: xxxx - module Foo
xxx careless_step ()
(ocd) backtrace
Backtrace:
#0 Foo /path/foo.ml:46:3
#1 Bar /path/bar.ml:44:2
#2 Baz /path/baz.ml:47:28
#3 Boom /path/boom.ml:51:5
(ocd) break @baz 47
Breakpoint 1 at xxxxxxx: file /path/baz.ml, line 47, characters 4-91
(ocd) reverse
Time: xxxxxx - pc: xxxxx - module Baz
Breakpoint:1
47 <|b|>match culprit arg1 arg2 with
(ocd) p arg1
...
(ocd) p arg2
…
Once I have reached this point, I usually understand whats’s wrong enough to not need the debugger any more and leave it.
My question is, can the steps break @baz 47
and reverse
be combined into one single command ? Also, is there a way to write to just write the backtrace list index rather than copy-paste the whole module name and line number ?
That is, I need a command to chose an item in the backtrace list and go to it directly.