wiki:Features/Perl5Debugger

Version 23 (modified by bowtie, 2 years ago) (diff)

--

<-back

Padre-Plugin-Debug 0.13_07

Debug-Simulator Dialog

  • as we are running via a plugin, we need to simulate where these features will go.
  • tool-tips used extensively throughout

  • two new panel launchers

Q1, check boxes will go in Menu item

  • A, View
  • B, Debug

  • we only need 3 buttons on the tool bar, (shown with border here to emphasise only)
    • launch debugger ( launches Breakpoints & Debugger, enables tool-bar quit and then runs debug against current file )
    • breakpoint toggle adds blue dotdotdot margin marker
    • quit debugger ( initially greyed out )

debug simulator

Breakpoints

  • See Below

Top icons

  • gray cross ( Delete MARKER_NOT_BREAKABLE Current File Only )
  • refresh Ctrl-List
  • Breakpoints ( Toggle ) also updates Ctrl-List and Margin Markers ( the blue dotdotdot co exist with diff markers )

Middle

  • blue Current File
  • gray MARKER_NOT_BREAKABLE ( dotdotdot margin markers are also gray )
  • green project files

Bottom

  • check Project show all files in current project with breakpoints
  • if check projects, show delete all breakpoints in this project only

If you want to Peek inside the DB use Cookbook Recipe 04

debug breakpoints

Debugger

When you "run debug" :)

  • quit(q) is always visible, ( toolbar quit should now be enabled, todo when in trunk )
  • the debugger will load breakpoints against the current file when it is load by the perl debug program, this means you need to step-in to force the breakpoints to be loaded in a subsequent file, if you get it wrong, just quit adjust breakpoints and re run.
    • I have been playing with auto-loading of all initial project breakpoints, but I have been experiencing bleeding of breakpoints across files, so turned this feature off but I want to rectify this :(
  • new icons will only be visible when debug is running
    • step-in(s), step-out(n), step-over(r), run-till(c), glasses(p)
      • glasses, as per previous version, shown in black text ( if you select $_ remember DWISNWIM )
  • when perl debug is running the Debugger Output panel will be opened, initially with the perl debug help screen.
    • note the green SMALLRECT in margin, showing debug position, as previously
      • Tip if you want to delay closing of debugger output, breakpoint the 1; at end of your file :)

why blue, I here you ask?, well others use yellow and red, but we have a wonderful blue Morpho butterfly :) hence blue

debugger

  • Show
    • show local variables is fixed to (y 0) local, as I don't know how to work out what level the debugger is at and how many levels there are, silly me
    • show global variables is doing X !(INC|ENV|SIG) against a current file which is part of a perl project.
      • I have been getting perl debug errors, see POD below, so you might notice it is automaticly disabled when I think it is unsafe, then re-enable.
  • Debugger-Output Options
    • This is the section I am not sure about, as what debug options to provide and which one's if any need user input?

Debugger Output

The output window is only shown when debug is running

  • See below ( only displays current output )
  • red text, I wonder what the inspiration was for this!

Screen Shot

ppd-shot1

  • NB look at the wasted screen real-estate in the bottom right hand corner, I suggest that we should extend the right hand panel down into this space?

POD from Main.pm

=pod

=head1 STATUS

waiting until this Plug-in is working before migrating into Padre ( => 0.93 ) 
don't want to muck trunk.

To view Padre::DB::DebugBreakpoints use P-P-Cookbook::Recipie04 in trunk

We can now add and delete breakpoints via icon in debug simulation and Breakpoint panel.

Load breakpoints for current file, on load of Breakpoint panel.

Get breakpoint panel to only show current file and current project bp's only, 
inspired by vcs options

the debugger loads breakpoints from DB when started, for all files in current project. 
when debugger loads a new file ( current ) the current files BP's are add to the debugger, 
use L to see this.

changed breakpoint margin marker to ... so as to co-exist with diff margin markers,
and avoid information contamination due to colour washout of previous SMALLRECT.
Add Gray for not active with switched by debugger, also added new home made icons for step_....

add functionality from trunk so all icons mimic current debug implementation

look at displaying variables yes, but in a nice table (y 0) working

debug-output only visable when debugger running, on start of new debug first displays debugger help

Added butons with color leters to corespond to debugers actions.

=head1 FeedBack

what options should be in Debugger Panel / Debug-Output Options

room for 3 more using coloured letters



=head1 BUGS AND LIMITATIONS 

normal editor modifications do not update the DB,
( due to DB storing absolute values and editor is relative )
will need to look in future at features and background task to do this.

Current thinking would be to compare bp time-stamp to History time-stamp if it had one

=head2 debug options X & V sometimes produce the following

    You can't FIRSTKEY with the %~ hash at /home/kevin/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/dumpvar.pl line 380
        ...propagated at /home/kevin/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/perl5db.pl line 2438.
     at /home/kevin/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/perl5db.pl line 2438
        DB::DB called at sandbox 06 line 29
    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.

=head2 entities in file names

    Printing in line 636 of /home/kevin/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/Debug/Client.pm:
    "/usr/src/Padre/Pad�e-Plugin-Debug/scripts/ExSewi.pm"
    Printing in line 146 of /usr/src/Padre/Padre-Plugin-Debug/lib/Padre/Plugin/Debug/Debugger.pm:
    "/usr/src/Padre/Pad�e-Plugin-Debug/scripts/ExSewi.pm"
    No such file or directory when trying to open '/usr/src/Padre/Pad�e-Plugin-Debug/scripts/ExSewi.pm' at /usr/src/Padre/Padre/lib/Padre/Wx/Main.pm line 4043.


=head1 TODO 

get panels to integrate with Padre, play nice=yes, still not finished

re-look at panel layout

Add methods to Debug::Client in trunk as and where needed

Change focus to Debugger-Output in bottom panel 

=head2 Tests & Notes

feedback required please

=head1 Method 


=cut


Description

Run your code under a debugger with real-time display of results

TBD

  • Debugger supports Stepping, Breakpoints, Watches, Variable evaluation, Stack module #11

Planning for a new version of the debugger:

  • The debugger can be launched by any of the following: Run / Step In / Step Over / Step Out / Run till breakpoint
    • Run would stop at the first statement and it will be grayed out once the debugger is running
    • Once the debugger is running the saved breakpoints of all the files belonging to this thing will be sent over.
      • The question what does 'this thing' mean? Which files belong to the current run?
      • Files that are currently open in the editor? File that belong to the current session? File in the current project?
  • Movement: Step In / Step Over / Step Out / Run till breakpoint
    • They do the corresponding action of the built in debugger
  • Jump to current execution line ???
  • Set a breakpoint (this should save the breakpoint in a config file and if the debugger is currently running then set the breakpoint in the debugger as well)
    • How should a breakpoint remembered? Filename and line number? Filename and sub name?
  • Remove breakpoint
  • List all breakpoints ???
  • Show trace - shows the current trace - it should open a window (maybe in the right-side window of the debugger) and constantly update the trace until the user turns it off.
  • Display value - the selected variable, or the one that is under the cursor will be added to the right side where its value will be show every time the debugger pauses the execution
  • Show Value now - show the value of the currently selected variable
  • Evaluate Expression... opens a window where you can type in arbitrary perl expression for example:
    • print 2 + 3
    • $z = 42
    • print $z
  • Quit debugger ???
  • Set watch - The user should be able to type in an arbitrary expression (if there was something selected then this will be the default) When that expression changes value the debugger will stop The expression should be saved belonging to the main script that is being executed. When the debugger is launched again these watchpoints need to be set again (later we could display them to the user and ask the user if she wants to set them or not)
  • Remove watch - remove an expression from the watch list (and from the saved watches)

Remember in database:

filename - breakpoint - line number - condition main-file - expression to display (e.g. a variable name or a more complex expression) main-file - show stack trace on/off

main-file - a history of expressions evaluated? main-file - a set of watches (conditional, non-location breakpoints)

Tickets

Ticket Resolution Summary Owner Reporter
#1507 Debugger causing Padre crash - MacOSx bowtie ron
#1485 fixed debugger RAW command does not update state properly bowtie SvenDowideit
#1480 debugger hangs bowtie vsespb
#1471 Can I see a call stack? SvenDowideit SvenDowideit
#1470 The debugger fails to find the file being stepped into SvenDowideit SvenDowideit
#1464 Add a Debug Launch dialogue SvenDowideit SvenDowideit
#1442 Perl-Arguments : startup options per file pandelis
#1420 fixed Start Padre with Debugger Panel active ... bowtie dolman
#1417 Debugger hangs with 'Show Local Variables' and very deep data-structures bowtie whumann
#1416 fixed Debug::Client::set_breakpoint ignores some errors bowtie whumann
#1415 fixed Debugger stepping into anonymous subs may crash Padre bowtie whumann
#1412 fixed Evaluate Expression in the debugger bowtie szabgab
#1411 Remove value from display bowtie szabgab
#1410 fixed Display Value should show value immediately bowtie szabgab
#1408 not relevant How to examine/inspect Unicode strings? szabgab
#1403 not relevant Debugger key bindings (n,s) do not function bowtie brewer
#1401 duplicate crash: Can't call method "get_h_var" on an undefined value at …/Padre/Wx/Panel/Debugger.pm line 904. daxim
#1389 fixed Breakpoints visual indicators aren't restored on Padre restart bowtie tome
#1388 fixed Using breakpoints toolbar item on un-named file causes crash bowtie tome
#1387 fixed Bad Query/Potential SQL injection in Padre/Breakpoints.pm bowtie tome
#1357 fixed "Debugger" menu is shown for non-Perl files alias, adamk zenogantner
#1211 not relevant Hot keys for Debug do not work fellipecm
#1086 fixed Debugger -> Display Value should support any Perl expression dandv
#1085 fixed "Debug -> Evaluate expression" doesn't display its output dandv
#1084 Tooltip expression evaluation bowtie dandv
#1083 fixed It should be possible to set breakpoints before starting the debugger szabgab dandv
#1036 not a bug Debugged scripts can't find modules in the current directory dandv
#1035 not a bug Padre hangs while debugged script hangs szabgab dandv
#1034 fixed New tab opened when debugging script with errors szabgab dandv
#1005 not relevant Uninitialized values when starting debugger on a file with errors zenogantner
#931 not relevant debugger: show watch values immediately after adding dam
#930 not relevant debugger: watch non-scalar variables dam
#929 not relevant debugger: add watch under cursor dam
#928 not relevant debugger: ability to remove watch items dam
#882 not relevant debugging for Wx-scripts doesn't work bowtie mtbf40
#833 fixed Syntax error crash padre when trying to debug szabgab vrobin
#812 not relevant Win32::GUI programs require 'external window' option azawawi Floyd-ATC
#333 fixed too much debug information azawawi jquelin
#321 fixed API for adding entries to right click menu pmakholm
#11 fixed Add debugger from within the editor szabgab szabgab

Debug::Client

Ticket Resolution Summary Owner Reporter
#1513 Unable to use debugger in script that uses Lingua::Wordnet Perl module bowtie, szabgab Plecto
#1494 fixed Debug-Client-0.24 tests hang bowtie, szabgab Schwern
#1469 fixed Debug::Client 0.21_12 hangs on Windows bowtie, szabgab chorny
#1427 fixed Debug::Client 0.20 test failures against win32 or not! bowtie bowtie
#1370 fixed Debug::Client, @list context request fails against perl-5.15.6 (3 of n) bowtie bowtie
#1368 fixed Debug::Client tests fail against perl-5.15.6 (2 of n) bowtie bowtie
#1367 fixed Debug::Client tests fail against perl-5.15.6 (1 of n) bowtie bowtie
#832 not relevant GetOptions( spawns unsavedX tab and crash Padre in StepOver Debugging szabgab vrobin
#831 fixed CPAN Install, test failing caused by Term::Readline szabgab vrobin

Test

TODO


__END__

<-back

Attachments