tags:

views:

33

answers:

2

I've got a Perl script, let's call it A.pl where the first two lines look something like this:

 require 'B.pl';
 require 'C.pl';

Where both B.pl and C.pl each have their own cavalcade of requires. I need to set a breakpoint on a specific line of C.pl. In GDB I'd do something like:

b C.pl:830

However that doesn't seem to work at all here. Is it possible? Am I close?

+1  A: 

You can't do it in one step, but you can change to the file you want and then set a breakpoint on a specific line:

DB<1> f C.pl
1    #!perl -w
2    # This is C.pl
3    # ...

DB<2> b 830

DB<3> c
Michael Carman
`f` doesn't appear to work with `require` says the file isn't loaded.
Morinar
You have to load a file before you can set a breakpoint inside it, although you can do `b load <file>` to break on loading a file.
Michael Carman
When I do that, it doesn't ever break at all.
Morinar
A: 

How about using the c command to skip past the requires and then setting a breakpoint. For example

main::(prog:6):    require "A.pl";
  DB<1> l 
6==>    require "A.pl";
7   
8:  bar();
  DB<2> c 8
main::(prog:8): bar();
  DB<3> b bar
  DB<4> c
main::bar(C.pl:2):    print "A\n";
  DB<4> 
Greg Bacon
After I step into the second file then try to set a breakpoint on the line it tells me that that line is not breakable.
Morinar
@Morinar: You can only set breakpoints on lines that are executable. For multi-line statements that usually means the first line of the expression.
Michael Carman
The line I'm trying to set a breakpoint is a single line `if` statement. I can't seem to set a breakpoint on ANY line of that file. Something is wrong here, but I can't seem to figure out what.
Morinar