Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set a breakpoint in the Perl debugger without modifying the source?

Tags:

debugging

perl

I'm stepping through someone else's code to find what's breaking mine under a certain, untestable (don't ask me why the test framework gives different results from live use, that's what I'm trying to figure out) circumstance. Each time I'm getting a little further into the code before I crash, is there any way I can set the breakpoint without modifying the source code? so I don't have to next, step, next, next, next, each time? or modify the source each time. Also take into consideration that I have to step through multiple files, as these programs make extensive use of libraries, and the bug itself appears to be within one of those libraries. So e.g. I know I need to continue executing until I hit line number of file. Also the libraries are loading libraries, I was at least 3-5 libraries deep the last I checked.

note: I'm new to debuggers in general

like image 468
xenoterracide Avatar asked Jan 21 '23 17:01

xenoterracide


1 Answers

It sounds like you want the b command in the interactive Perl debugger, which can be used to set future breakpoints. Or maybe the c command, which works like GDB's until if given an argument.

You can also automatically set certain breakpoints every time you start the debugger with afterinit in .perldb. Or use the R command which restarts the debugger (and the program being debugged) while keeping breakpoints and other information.

like image 133
ephemient Avatar answered Jan 23 '23 08:01

ephemient