likbez has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed monks,

Is there any way to replay a set of debugger commands from a debugger history file at the start of the debugger session?

I know expect will work, but may be the same is possible within the debugger too

Thanks in advance for your help.

  • Comment on Replaying debugger commands from history

Replies are listed 'Best First'.
Re: Replaying debugger commands from history
by LanX (Saint) on Nov 20, 2019 at 15:59 UTC
    Sure!

    Have a look at the docs in perldebug#Debugger-Customization concerning

     @DB::typeahead

    like

    sub afterinit { push @DB::typeahead, "b 4", "b 6"; }

    IIRC it should be either settable

    • in .perldb
    • or in the -e'' command line option at startup
    • (update) or even inside your debugged code inside BEGIN

    HTH! :)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      Hi LanX,

      Yes, that solves my problem.

      I can generate this line dynamically from history before entering the debugger to get to some deeply nested call.

      Thanks a lot !!!

      sub afterinit { push @DB::typeahead, "b 4", "b 6"; }
      As I discovered today this trick also works from inside the debugger:
      DB<1> push @DB::typeahead, 'c 7','n','c' auto(-3) DB<2> c 7 main::(escape_from_deeply_nested_calls.pl:7): 7: say "\nProgram ended"; auto(-2) DB<3> n d1e1f1f2f3f4f5f6f7f8f9f10-f11-f9-f8-f7-f6-f5-f4-f3-f2-f1-f0-e1-d1 Program ended main::(escape_from_deeply_nested_calls.pl:8): 8: say "Failure_code is $global_failure"; auto(-1) DB<3> c Failure_code is 14 Debugged program terminated. Use q to quit or R to restart,