Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

[SOLVED] Breakpoints behaviour in some perl versions

by hurricup (Pilgrim)
on May 16, 2016 at 19:44 UTC ( [id://1163165]=perlquestion: print w/replies, xml ) Need Help??

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

It seems that some perl versions ignoring any breakpoints set in START phase (may be even in any before the RUN one).

Working on debugger I've encountered a problem: with perl 5.22 all pre-set breakpoints works fine if they set on DB package loading, but in 5.18.2 - absolutely ignored. The only solution i've found for 5.18.2 is to set them only in RUN phase.

I'm sure that they are valid and respective @{::_<filename} allowed me to set them.

Can anyone enlighten me about this situation? Am I right? And what is the background here.

P.S. Seems that GLOBAL_PHASE is not an issue here. Something else...

Same problem with Centos 7 + 5.16

Answer from here:

%{'_<...'} hashes now set breakpoints on the corresponding @{'_<...'} rather than whichever array @DB::dbline is aliased to. perl #119799

Replies are listed 'Best First'.
Re: Breakpoints and GLOBAL_PHASE ($DB::single)
by tye (Sage) on May 17, 2016 at 02:07 UTC

    I work around not being able to break inside of a module before the module has finished loading by just modifying the module's source code to add $DB::single = 1; before the line I want the debugger to break at.

    You can also use "b load ...". Though, I found that command to be overly picky about how you specify the file name so I patched my perl5db.pl to make it less picky:

    ... sub cmd_b_load { my $file = shift; my @files; $file =~ s!::!/!g; # Added this line ... $signal = 1, print $OUT "'$filename' loaded...\n" # if $break_on_load{$filename}; # Replaced this line with the fol +lowing: if grep $break_on_load{$_}, $filename =~ m{(?:^|[/\\])(?=(.*))}g +; ...

    - tye        

Re: Breakpoints and GLOBAL_PHASE
by ikegami (Patriarch) on May 17, 2016 at 01:57 UTC
    I can set a breakpoint during the global compile phase in 5.18.2.
    $ perlbrew use 5.18.2t $ perl -d -E' BEGIN { say ${^GLOBAL_PHASE}; $DB::single = 1; say "Hi"; } ' Loading DB routines from perl5db.pl version 1.39_10 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. START main::CODE(0x16bda48)(-e:5): say "Hi"; DB<1> r Hi void context return from CODE(0x16bda48) Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<1> q
Re: Breakpoints and GLOBAL_PHASE
by LanX (Saint) on May 16, 2016 at 20:23 UTC

      Since this is a custom debugger written from scratch, it's a tricky task, but i'll do my best

      For now i can say that GLOBAL_PHASE seems not to be an issue here.

      Small explanation of what i'm trying to do:

      1. We have an IDE with some Perl project. Breakpoints set in several files using IDE.
      2. On start of debugging session, IDE sends all breakpoints to the debugger.
      3. On each invocation of DB::sub/DB::postponed debugger checks list of already loaded files and attempts to set queued breakpoins. On success it informs IDE about it.
      4. On each invocation of DB::DB debugger goes to interactive mode and awaits commands from IDE. Breakpoints may be set here in interactive mode.

      Everything works as intended in Strawberry 5.22.2, but in Ubuntu 5.18.2 breakpoints set in step 3 are ignored. But, if file already been loaded, you've step in and you set a breakpoint in interactive mode, they works fine.

      It looks like breakpoint works only if its been set from DB::DB invoked from breakpoint's target file. But sounds too stupid.

        > Since this is a custom debugger written from scratch

        I'm irritated ... you are using perl5db.pl terminology but you wrote a new debugger from scratch?

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1163165]
Approved by stevieb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found