in reply to bug in the debugger? breakpoints in subroutines ignored if attributes present

Instead of "b X::a", do the following:

% perl -d test.pl # ... 206: $global_phase++; DB<1> l X::a Switching to file 'test.pl'. 5: sub a : ATTR(SCALAR) { 6: print "a\n"; 7: } DB<2> b 6 DB<3> c X::a(attribBreak.pl:6): print "a\n"; DB<3>

- tye        

  • Comment on Re: bug in the debugger? breakpoints in subroutines ignored if attributes present (work-around)
  • Download Code

Replies are listed 'Best First'.
Re^2: bug in the debugger? breakpoints in subroutines ignored if attributes present (work-around)
by wu-lee (Beadle) on Apr 23, 2007 at 16:38 UTC
    Indeed that's the obvious solution in this case, but in the real case, the line in question is buried in some class in another file. The reason I want to breakpoint a method is because I can't put a breakpoint there using the line number, at least without stepping through lots of intervening code.

      I don't see how what you describe makes what I suggested any less useful. Instead of putting a breakpoint on a method, list the start of the method and put a breakpoint on the first line inside of the method. I certainly didn't step "though lots of intervening code" so I'm not sure why you think you would need to.

      - tye        

        Ah yes, apologies. I misunderstood what you were suggesting and thought the solution would only work in the example. I didn't realise that the l command could take a subroutine as an argument and subsequently let you breakpoint the result. This'll do nicely.