Ticket #1415 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Debugger stepping into anonymous subs may crash Padre

Reported by: whumann Owned by: bowtie
Priority: trivial Milestone:
Component: Debugger for Perl 5 Version: 0.95
Keywords: Cc:

Description

I have a bigger program that crashes when I try to use the debugger to step into anonymous subs (or set a breakpoint inside an anon sub). The error message (with shortened, obfuscated filenames) is

Unmatched ) in regex; marked by <-- HERE in 
m/ /home/user/somedir/0x14a96fd0) <-- HERE (somefile $/ 
at .../site_perl/5.10.1/Padre/Wx/Panel/Breakpoints.pm line 328.

A short example does not crash but reveals that probably something goes wrong when parsing the filename reported by the debugger inside anon subs:

sub re_hw {
	return sub {
		say 'hello';
		say 'world';
	}
};
my $hw = re_hw();
&$hw;

The above is in a file named 'debug_anon_sub'. When I debug this file in Padre and step into the anon sub, Padre opens empty files with names like

0x1957c020)(debug_anon_sub

where the hex number varies from run to run.

Change History

comment:1 Changed 2 years ago by bowtie

  • Owner set to bowtie
  • Priority changed from major to minor
  • Status changed from new to assigned
  • Component changed from not classified yet to Debugger for Perl 5

Not a fault with Debug2 as such, dose not crash in trunk 0.95 r18721 as such, but Debug2 is getting lost until it gets a file and line No. it's happy with.

but Debug::Client will need a tweak.

as

sub get_lineinfo

is getting confused as to where it is due to

main::CODE(0x9b434a8)(test.pl:57):			say 'hello';

when it expects

main::(test.pl:66):	say 'END';

will look to add fix in next release of debug-client

nice catch whumann, thanks

please try in Padre 0.95 and confirm that Debug2 just gets lost intermittently

comment:2 Changed 2 years ago by whumann

  1. Is 0.95 stable enough to install over 0.94?
  2. Is there an easy (non-svn, just browser or cpan) way to get it

comment:3 Changed 2 years ago by bowtie

Fix in Debug-Client 0.18_01 in trunk, works against Padre 0.95 r18721 in trunk.

ticket will be closed when Debug-Client 0.19 is published.

comment:4 Changed 2 years ago by bowtie

whumann

see wiki page for Padre trunk from svn

http://padre.perlide.org/trac/wiki/Development

comment:5 Changed 2 years ago by whumann

Your fix using '.*' is way too liberal and fails horribly with debugger output like

 DB<1>
main::(debug_anon_sub:16):      my @fonts  = (
main::(debug_anon_sub:17):              [ 'Helvetica'           => 14 ],
main::(debug_anon_sub:18):              [ 'Luxi Sans'           => 13 ],
main::(debug_anon_sub:19):      );                                    

comment:6 Changed 2 years ago by bowtie

whumann

cool more failures.

I can only fix the errors that are shown by test code provided.

it is always good to start simple and generic.

now If you would like to do some more testing and place results here I will continue to evolve

sub get_lineinfo

It might be a good idea, if you add test code for each, as attachments.

comment:7 Changed 2 years ago by whumann

Sorry, if I wasn't clear enough. Place these lines anywhere in your code and step over them to crash Padre 0.95 with Debug::Client 0.18_01

my @fonts  = (
    [ 'Helvetica'           => 14 ],
    [ 'Luxi Sans'           => 13 ],
);

comment:8 Changed 2 years ago by bowtie

  • Version changed from 0.94 to 0.95

comment:9 Changed 2 years ago by bowtie

whumann

you failed to say that the side affect of Debug::Client 0.18_01,

was that stepping in to a simple array causes Padre to crash, and has nothing to do with anon's

hence this is why I ask for sample code attachements

it avoids ambiguity

comment:10 Changed 2 years ago by bowtie

whumann

Fix in Debug-Client 0.18_02 in trunk

try with

sub re_hw {
    return sub {
        say 'hello';
        my @fonts = (
            [ 'Helvetica' => 14 ],
            [ 'Luxi Sans' => 13 ],
        );
        say @fonts;
        }
}
my $hw = re_hw();
&$hw;

the above was my test code

comment:11 Changed 2 years ago by whumann

Looks much better now. Tried in my "big project" and both stepping into anon subs and stepping into multiline array defs seems to work.
Thanks for the fix!

comment:12 Changed 2 years ago by bowtie

  • Priority changed from minor to trivial

will apply in Debug::Client 0.19 in future, just before Padre 0.96 release.

comment:13 Changed 2 years ago by bowtie

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.