Ticket #1416 (closed defect: fixed)
Debug::Client::set_breakpoint ignores some errors
| Reported by: | whumann | Owned by: | bowtie |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Debugger for Perl 5 | Version: | 0.95 |
| Keywords: | Cc: |
Description
Look at the following trace of subs-calls:
->Padre::Wx::Panel::Debugger::on_running_bp_clicked(Padre::Wx::Panel::Debugger, Wx::CommandEvent)
| ->Padre::Wx::Panel::Breakpoints::on_set_breakpoints_clicked(Padre::Wx::Panel::Breakpoints)
| | ->Padre::Wx::Panel::Breakpoints::_setup_db(Padre::Wx::Panel::Breakpoints)
| | ->Padre::Wx::Panel::Breakpoints::_add_bp_db(Padre::Wx::Panel::Breakpoints)
| | ->Padre::Wx::Panel::Breakpoints::on_refresh_click(Padre::Wx::Panel::Breakpoints)
| | | ->Padre::Wx::Panel::Breakpoints::_update_list(Padre::Wx::Panel::Breakpoints)
| < HASH
| ->Debug::Client::set_breakpoint(Debug::Client, /home/user/somedir/mytool, 436)
| | ->Debug::Client::_send(Debug::Client, f /home/user/somedir/mytool)
| | ->Debug::Client::_get(Debug::Client)
| | < No file matching `/home/user/somedir/mytool' is loaded.
DB<23>
| | ->Debug::Client::_send(Debug::Client, b 436)
| | ->Debug::Client::_get(Debug::Client)
| | < DB<24>
| | ->Debug::Client::_prompt(Debug::Client, \' DB<24> ')
| | < 24
| < 1
| ->Debug::Client::__send(Debug::Client, L b)
| | ->Debug::Client::_send(Debug::Client, L b)
| | ->Debug::Client::_get(Debug::Client)
| | < /home/user/somedir/lib/View.pm:
436: $para_ref = {symbol => $symbol, %$para_ref};
break if (1)
After
Debug::Client::_send(Debug::Client, f /home/user/somedir/mytool)
Debug::Client::_get()
returns 'No file matching...'.
It should not proceed after that error, instead the error should be reported to the user. It still does
Debug::Client::_send(Debug::Client, b 436)
But because setting the file failed, the breakpoint ends up in the previously selected file 'View.pm' instead of 'mytool' (as can be seen in the listing at the end of the trace above)
'/home/user/somedir/mytool' is loaded in Padre. The debugger however rejects 'f /home/user/somedir/mytool' and expects 'f mytool' for the main-file of the project. For the libs in '/home/user/somedir/lib' the debugger is fine with e.g. 'f /home/user/somedir/lib/View.pm'.
I'm not sure about the fine points but in some cases the filename needs to be translated for the debugger to understand it.
Attachments
Change History
comment:2 Changed 15 months ago by whumann
See attached testproj.zip (incl. screenshot). Open files in Padre. Go to line 1 of Alefant.pm. Add breakpoint, remove breakpoint (to make sure the debuggers current file is Alefant.pm). Now switch to 'some_fants', go to line 1. Add breakpoint. The Breakpoints panel lists a breakpoint in '/some_fants', line 1, but the 'Debug Output' shows that it's really in Alefant.pm, line 1.
comment:3 Changed 15 months ago by bowtie
whumann
ok I understand,
see http://padre.perlide.org/trac/wiki/Features/Perl5Debugger
the breakpoint (bp) symbol ...
is shown in two places.
1, ... on icon bar ( used for setting bp while editing )
2, ... in the Breakpoint panel same as above plus also shows status while debugging
3 when the debugger is running we use b|B instead of ... to make live changes.
followed test above.
A, if done with ... and then Debugger launched and 'L b'<Raw> you get what is accepted.
B, if done wit b|B and 'L b'<Raw> you get
/home/kevin/workspace/wolfram/testproj/lib/Alefant.pm: 1: my $alefant = 1; break if (1)
whumann nice catch, will look into
comment:4 Changed 15 months ago by bowtie
just for fun, I walked through perl -d
~$ perl -d /home/kevin/workspace/wolfram/testproj/some_fants Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(/home/kevin/workspace/wolfram/testproj/some_fants:11): 11: my @fants = ( 12: 'Alefant', 13: 'Belefant', 14: 'Celefant', 15: ); DB<1> f /home/kevin/workspace/wolfram/testproj/lib/Alefant.pm 1: my $alefant = 1; 2 3: 1; DB<2> b 1 DB<3> L b /home/kevin/workspace/wolfram/testproj/lib/Alefant.pm: 1: my $alefant = 1; break if (1) DB<4> B 1 DB<5> L b DB<6> f /home/kevin/workspace/wolfram/testproj/some_fants 1: use strict; 2: use warnings; 3 4: use FindBin; 5: use lib "$FindBin::RealBin/lib"; 6 7: use Alefant; 8: use Belefant; 9: use Celefant; 10 DB<7> b 1 DB<8> L B DB<9> L b /home/kevin/workspace/wolfram/testproj/some_fants: 1: use strict; break if (1) DB<10> c 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<10>
comment:5 Changed 15 months ago by whumann
That's interesting because I can't 'f' to some_fants using the full path. Using just the filename works though:
DB<3> f lib/Alefant.pm Choosing /home/wolframh/testproj/lib/Alefant.pm matching `lib/Alefant.pm': Already in /home/wolframh/testproj/lib/Alefant.pm. DB<4> f /home/wolframh/testproj/lib/Alefant.pm Already in /home/wolframh/testproj/lib/Alefant.pm. DB<5> f /home/wolframh/testproj/lib/Belefant.pm 1: my $belefant = 1; 2 3: 1; DB<6> b 1 DB<7> L /home/wolframh/testproj/lib/Belefant.pm: 1: my $belefant = 1; break if (1) DB<7> f /home/wolframh/testproj/some_fants No file matching `/home/wolframh/testproj/some_fants' is loaded. DB<8> f some_fants 1: use strict; 2: use warnings; 3 4: use FindBin; 5: use lib "$FindBin::RealBin/lib"; 6 7: use Alefant; 8: use Belefant; 9: use Celefant; 10 DB<9> f Alefant.pm Choosing /home/wolframh/testproj/lib/Alefant.pm matching `Alefant.pm': 1: my $alefant = 1; 2 3: 1;
comment:6 Changed 15 months ago by bowtie
No file matching comes from perl5db.pl, and as such we are not catching it, at present.
But, Te He, found it.
~/workspace/wolfram/testproj$ perl -d some_fants Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(some_fants:11): my @fants = ( main::(some_fants:12): 'Alefant', main::(some_fants:13): 'Belefant', main::(some_fants:14): 'Celefant', main::(some_fants:15): ); DB<1> f /home/kevin/workspace/wolfram/testproj/lib/Alefant.pm 1: my $alefant = 1; 2 3: 1; DB<2> b 1 DB<3> L b /home/kevin/workspace/wolfram/testproj/lib/Alefant.pm: 1: my $alefant = 1; break if (1) DB<4> B 1 DB<5> L b DB<6> f /home/kevin/workspace/wolfram/testproj/some_fants No file matching `/home/kevin/workspace/wolfram/testproj/some_fants' is loaded. DB<7> b 1 DB<8> L b /home/kevin/workspace/wolfram/testproj/lib/Alefant.pm: 1: my $alefant = 1; break if (1) DB<9> q
comment:7 Changed 15 months ago by bowtie
- Owner changed from szabgab to bowtie
- Status changed from new to assigned
comment:8 Changed 15 months ago by bowtie
- Component changed from Debug::Client to Debugger for Perl 5
This is a Debugger issue passing initial file in short format, nothing to do with Debug::Client hence component change
comment:9 Changed 15 months ago by whumann
Full path for the debugger's initial file sounds like the right solution but I still believe that $b in Debug::Client::set_breakpoint() should also be checked for errors. Would have made catching this thing so much easier.
In general it would be nice if an eval() at some higher level would catch anything fatal during debugging so that just the debugging session would be terminated but not the editor.
comment:10 Changed 15 months ago by bowtie
this is just a case of garbage in garbage out
caused by Padre::Document::Perl
line 374
my $shortname = File::Basename::basename($filename);
will look at using
function Padre::Util::run_in_directory_two
comment:11 Changed 15 months ago by bowtie
using this dose not work
function Padre::Util::run_in_directory_two
but a local hack only
my $shortname = $filename;
and test code works as expected, now we just need a better final solution
comment:12 Changed 15 months ago by bowtie
- Status changed from assigned to closed
- Resolution set to fixed
fixed in r18777
now uses full-name

need more info,
1, are you running against a perl project, created with module::starter per-say or equivalent, if so what?
2a, image of Breakpoint panel, with project clicked,
2b, also output of 'L b'<Raw>
3, tree info
─── xt ├── badcode.t ├── changes.t ├── critic.t ├── distmanifest.t ├── hasversion.t ├── meta.t ├── minimumversion.t ├── podcoverage.t └── pod.t