YAPC::NA 2004 The Perl Debugger #18

Watchpoints

W <expression> - Set a watchpoint

  • possibly better described as "Watch Expression"

  • debugger will monitor value of expression

  • if the value changes, the debugger returns control to the user.

           DB<1> W $buggyValue
           DB<2> c
         Watchpoint 0:  $buggyValue changed:
                 old value:  '1982'
                 new value:  '1983'
         main::(port-scanner.pl:6):      for($x=1;$x<2500;$x++) {
  • to delete all watchpoints, specify no parameter

  • Performance penalty - so only watch a few at a time

  • setting a watchpoint:

    • Perl <5.8:.... W <expression>

    • Perl 5.8:..... w <expression>

  • deleting a watchpoint:

    • Perl <5.8:.... W

    • Perl 5.8:..... W <expression>

<< Previous | Index | Next >> Copyright © 2004 Daniel Allen