Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I understand what you are trying to do...identify a bug, modify the code, and continue debugging with the modified code. That would be very nice.

I think I can point out that you could at least change it for this instance and continue debugging. For example, usin g your code:

# ... 107 sub foo { 108 my $x; 109 $x = 43; 110 => die "invalid x!" unless $x == 42; 111 print "Yay!" 112 # ...

At this point you could set the value of $x before the unless expression is evaluated:

DB<6> $x = 43;

Of course, you would have to remember to make the same modification in code...

As an interesting alternative, you could redefine the function on the fly... This wouldn't work in your example because it dies on a fail case. However after a first run through the function, cut the function from an editor and paste it into the debugger with the change you desire. Subsequent runs restarts through the debugger would have the modified version of the function.

For example:

use strict; foo(); foo(); sub foo { my $x; $x = 43; if($x==42){print "DANGER Will Robinson!\n" +}else{print "Yay!\n";}}

Then I run this in the debugger... After the first execution of foo Cut and paste the modified subroutine in to the debugger and execute it. This redefines the foo function.

main::(perldebugexample2.pl:3): foo(); DB<1> n Yay! main::(perldebugexample2.pl:4): foo(); <$x = 42; if($x==42){print "DANGER Will Robinson!\n"}else{print "Yay!\ +n";}} DB<2> n DANGER Will Robinson!

I'm not sure if this is practicle, but it is interesting... :)

Hazah! I'm Employed!


In reply to Re^2: Neat Debugger tricks by osunderdog
in thread Neat Debugger tricks by osunderdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (6)
    As of 2014-07-24 05:46 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (158 votes), past polls