Set an arbitrary breakpoint in the debugger

I am using the interactive perl debugger (mostly perl -d script

)
I have a script that has quite a few imported modules and I need to debug a problem.
What I am doing is launch the debugger and step through the lines, stepping in where needed.
But this is tedious as I have to go through many lines of code and function calls.

Question: Let's say that after going through the lines of code, I end up entering a function of A::B::C::foo()

some module where the problem I am debugging is.
Is there a way to set a breakpoint in this function at the start of a debug session so that I go there right away instead of looping through the code line by line until I get there?
I know that I can add a breakpoint in the same file as my debugger, but how do I add a breakpoint on a line that is outside the debug area at the moment (to some arbitrary file / module that the debugger will eventually have reached)?

Note:
Just to clarify: this doesn't look like what A::B::C::foo()

's in the X script line. Ultimately it gets called after traversing the chain of calls to other functions in many modules

+3


source to share


3 answers


You can set a breakpoint by giving the filename followed by the line number

b YourModule.pm:line_number

      



where the line number is inside the module function you want to split.

+3


source


You can set a breakpoint for a routine with a documented syntax b sub

. In this case, just use



b A::B::C::foo
c

      

+7


source


You can even put a breakpoint in the south that hasn't been loaded / defined yet with a parameter postpone

:

b postpone Name::Of::Sub::Yet::To::Be::Created

      

+2


source







All Articles