13 delete $ENV{PERLDB_OPTS};
16 if (! -c "/dev/null") {
17 print "1..0 # Skip: no /dev/null\n";
21 my $dev_tty = '/dev/tty';
22 $dev_tty = 'TT:' if ($^O eq 'VMS');
24 print "1..0 # Skip: no $dev_tty\n";
28 print "1..0 # Skip: \$ENV{PERL5DB} is already set to '$ENV{PERL5DB}'\n";
31 $ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
34 my $rc_filename = '.perldb';
37 open my $rc_fh, '>', $rc_filename
42 # overly permissive perms gives "Must not source insecure rcfile"
43 # and hangs at the DB(1> prompt
44 chmod 0644, $rc_filename;
51 open my $in, '<', $filename
52 or die "Cannot open '$filename' for slurping - $!";
62 my $out_fn = 'db.out';
66 return _slurp($out_fn);
70 # Test for Proxy constants
75 &parse_options("NonStop=0 ReadLine=0 TTY=db.out");
87 my $output = runperl(switches => [ '-d' ], stderr => 1, progfile => '../lib/perl5db/t/proxy-constants');
88 is($output, "", "proxy constant subroutines");
91 # [perl #66110] Call a subroutine inside a regex
93 local $ENV{PERLDB_OPTS} = "ReadLine=0 NonStop=1";
94 my $output = runperl(switches => [ '-d' ], stderr => 1, progfile => '../lib/perl5db/t/rt-66110');
95 like($output, qr/\bAll tests successful\.$/, "[perl #66110]");
97 # [ perl #116769] Frame=2
99 local $ENV{PERLDB_OPTS} = "frame=2 nonstop";
100 my $output = runperl( switches => [ '-d' ], prog => 'print qq{success\n}' );
101 is( $?, 0, '[perl #116769] frame=2 does not crash debugger, exit == 0' );
102 is( $output, "success\n" , '[perl #116769] code is run' );
104 # [ perl #116771] autotrace
106 local $ENV{PERLDB_OPTS} = "autotrace nonstop";
107 my $output = runperl( switches => [ '-d' ], prog => 'print qq{success\n}' );
108 is( $?, 0, '[perl #116771] autotrace does not crash debugger, exit == 0' );
109 is( $output, "success\n" , '[perl #116771] code is run' );
111 # [ perl #41461] Frame=2 noTTY
113 local $ENV{PERLDB_OPTS} = "frame=2 noTTY nonstop";
115 my $output = runperl( switches => [ '-d' ], prog => 'print qq{success\n}' );
116 is( $?, 0, '[perl #41461] frame=2 noTTY does not crash debugger, exit == 0' );
117 is( $output, "success\n" , '[perl #41461] code is run' );
125 my $self = bless {}, $class;
136 $self->{_cmds} = shift;
139 return $self->{_cmds};
146 $self->{_prog} = shift;
149 return $self->{_prog};
156 $self->{_output} = shift;
159 return $self->{_output};
168 $self->{_include_t} = shift;
171 return $self->{_include_t};
180 $self->{_stderr_val} = shift;
183 return $self->{_stderr_val};
192 $self->{field} = shift;
195 return $self->{field};
204 $self->{_switches} = shift;
207 return $self->{_switches};
216 $self->{_contents} = shift;
219 return $self->{_contents};
222 # object for prog temporary file
229 $self->{_tempprog} = shift;
232 return $self->{_tempprog};
237 my ($self, $args) = @_;
239 my $cmds = $args->{cmds};
241 if (ref($cmds) ne 'ARRAY') {
242 die "cmds must be an array of commands.";
247 my $prog = $args->{prog};
249 if (ref($prog) eq 'SCALAR') {
251 my $fh = File::Temp->new;
252 $self->_tempprog($fh);
254 $prog = $fh->filename;
256 elsif (ref($prog) ne '' or !defined($prog)) {
257 die "prog should be a path to a program file.";
262 $self->_include_t($args->{include_t} ? 1 : 0);
264 $self->_stderr_val(exists($args->{stderr}) ? $args->{stderr} : 1);
266 if (exists($args->{switches}))
268 $self->_switches($args->{switches});
278 my ($self, $str) = @_;
280 $str =~ s/(["\@\$\\])/\\$1/g;
290 my $rc = qq{&parse_options("NonStop=0 TTY=db.out");\n};
295 q#push (@DB::typeahead,#,
296 (map { $self->_quote($_) . "," } @{$self->_cmds()}),
302 # I guess two objects like that cannot be used at the same time.
310 ($self->_switches ? (@{$self->_switches()}) : ('-d')),
311 ($self->_include_t ? ('-I', '../lib/perl5db/t') : ())
313 (defined($self->_stderr_val())
314 ? (stderr => $self->_stderr_val())
317 progfile => $self->_prog()
320 $self->_output($output);
322 $self->_contents(::_out_contents());
329 return shift->_output();
333 my ($self, $re, $msg) = @_;
335 local $::Level = $::Level + 1;
336 ::like($self->_output(), $re, $msg);
340 my ($self, $re, $msg) = @_;
342 local $::Level = $::Level + 1;
343 ::unlike($self->_output(), $re, $msg);
347 return shift->_contents();
351 my ($self, $re, $msg) = @_;
353 local $::Level = $::Level + 1;
354 ::like($self->_contents(), $re, $msg);
357 sub contents_unlike {
358 my ($self, $re, $msg) = @_;
360 local $::Level = $::Level + 1;
361 ::unlike($self->_contents(), $re, $msg);
366 DebugWrap - wrapper to execute code under the debugger and examine the
371 my $wrapper = DebugWrap->new(
375 # list of commands supplied to the debugger
377 prog => 'filename_of_code_to_debug.pl',
378 # and some optional arguments
382 my $wrapper = DebugWrap->new(
386 # list of commands supplied to the debugger
391 # and some optional arguments
395 # test the output from the program being debugged
396 $wrapper->output_like(qr/.../, "describe the test");
397 $wrapper->output_unlike(qr/.../, "describe the test");
398 my $output = $wrapper->get_output; # for more sophisticated checks
400 # test the output from the debugger
401 $wrapper->contents_like(qr/.../, "describe the test");
402 $wrapper->contents_unlike(qr/.../, "describe the test");
403 my $contents = $wrapper->get_contents; # for more sophisticated checks
407 DebugWrap is a simple class that executes a set of debugger commands
408 against a program under the debugger and provides some simple methods
409 to examine the results.
411 =head2 Creating a DebugWrap object
413 The constructor new() accepts a hash of arguments, with the following
420 An array of commands to execute, one command per element. Required.
424 Either the name of a perl program to test under the debugger, or a
425 reference to a scalar containing the text of the program to test.
430 If this is a true value capture standard error, which is the default.
435 Add F<lib/perl5db/t> to the perl search path, as with C<-I>
439 An arrayref of switches to supply to perl. This should include the
440 C<-d> switch needed to invoke the debugger. If C<switches> is not
441 supplied then C<-d> only is supplied. The C<-I> for C<include_t> is
442 added after these switches.
448 The other methods intended for test usage are:
452 =item $wrapper->get_contents
454 Fetch the debugger output from the debugger run. This does not
455 include the output from the program under test.
457 =item $wrapper->contents_like($re, $test_name)
459 Test that the debugger output matches the given regular expression
460 object (as with qr//).
464 like($wrapper->get_contents, $re, $test_name);
466 =item $wrapper->contents_unlike($re, $test_name)
468 Test that the debugger output does not match the given regular
469 expression object (as with qr//).
473 unlike($wrapper->get_contents, $re, $test_name);
475 =item $wrapper->get_output
477 Fetch the program output from the debugger run. This does not include
478 the output from the debugger itself, it does include the output
479 generated by C<valgrind> or ASAN, assuming you haven't disabled
482 =item $wrapper->output_like($re, $test_name);
484 Test that the program output matches the given regular expression
485 object (as with qr//).
489 like($wrapper->get_output, $re, $test_name);
491 =item $wrapper->output_unlike($re, $test_name);
493 Test that the program output does not match the given regular
494 expression object (as with qr//).
498 unlike($wrapper->get_output, $re, $test_name);
507 local $ENV{PERLDB_OPTS} = "ReadLine=0";
508 my $target = '../lib/perl5db/t/eval-line-bug';
509 my $wrapper = DebugWrap->new(
519 "p \@{'main::_<$target'}",
525 $wrapper->contents_like(
527 'The ${main::_<filename} variable in the debugger was not destroyed',
531 sub _calc_generic_wrapper
535 my $extra_opts = delete($args->{extra_opts});
537 local $ENV{PERLDB_OPTS} = "ReadLine=0" . $extra_opts;
538 return DebugWrap->new(
540 cmds => delete($args->{cmds}),
541 prog => delete($args->{prog}),
547 sub _calc_new_var_wrapper
550 return _calc_generic_wrapper(
557 'x "new_var = <$new_var>\\n"',
565 sub _calc_threads_wrapper
569 return _calc_new_var_wrapper(
571 switches => [ '-dt', ],
579 _calc_new_var_wrapper({ prog => '../lib/perl5db/t/eval-line-bug'})
582 "no strict 'vars' in evaluated lines.",
587 _calc_new_var_wrapper(
589 prog => '../lib/perl5db/t/lvalue-bug',
594 'lvalue subs work in the debugger',
599 _calc_new_var_wrapper(
601 prog => '../lib/perl5db/t/symbol-table-bug',
602 extra_opts => "NonStop=1",
606 qr/Undefined symbols 0/,
607 'there are no undefined values in the symbol table',
613 if ( $Config{usethreads} ) {
614 skip('This perl has threads, skipping non-threaded debugger tests');
617 my $error = 'This Perl not built to support threads';
618 _calc_threads_wrapper(
620 prog => '../lib/perl5db/t/eval-line-bug',
624 'Perl debugger correctly complains that it was not built with threads',
631 if ( $Config{usethreads} ) {
632 _calc_threads_wrapper(
634 prog => '../lib/perl5db/t/symbol-table-bug',
637 qr/Undefined symbols 0/,
638 'there are no undefined values in the symbol table when running with thread support',
642 skip("This perl is not threaded, skipping threaded debugger tests");
648 local $ENV{PERLDB_OPTS};
649 my $wrapper = DebugWrap->new(
656 prog => '../lib/perl5db/t/rt-61222',
660 $wrapper->contents_unlike(qr/INCORRECT/, "[perl #61222]");
663 sub _calc_trace_wrapper
667 return _calc_generic_wrapper(
680 # [perl 104168] level option for tracing
682 my $wrapper = _calc_trace_wrapper({ prog => '../lib/perl5db/t/rt-104168' });
683 $wrapper->contents_like(qr/level 2/, "[perl #104168] - level 2 appears");
684 $wrapper->contents_unlike(qr/baz/, "[perl #104168] - no 'baz'");
688 if (!exists($Config{taint_support}) || $Config{taint_support})
690 my $wrapper = _calc_trace_wrapper(
692 prog => '../lib/perl5db/t/taint',
693 extra_opts => ' NonStop=1',
694 switches => [ '-d', '-T', ],
698 my $output = $wrapper->get_output();
699 chomp $output if $^O eq 'VMS'; # newline guaranteed at EOF
700 is($output, '[$^X][done]', "taint");
703 # Testing that we can set a line in the middle of the file.
705 my $wrapper = DebugWrap->new(
709 'b ../lib/perl5db/t/MyModule.pm:12',
711 q/do { use IO::Handle; STDOUT->autoflush(1); print "Var=$var\n"; }/,
716 prog => '../lib/perl5db/t/filename-line-breakpoint'
720 $wrapper->output_like(qr/
728 "Can set breakpoint in a line in the middle of the file.");
731 # Testing that we can set a breakpoint
733 my $wrapper = DebugWrap->new(
735 prog => '../lib/perl5db/t/breakpoint-bug',
740 q/do { use IO::Handle; STDOUT->autoflush(1); print "X={$x}\n"; }/,
747 $wrapper->output_like(
749 "Can set breakpoint in a line."
753 # Testing that we can disable a breakpoint at a numeric line.
755 my $wrapper = DebugWrap->new(
757 prog => '../lib/perl5db/t/disable-breakpoints-1',
764 q/print "X={$x}\n";/,
771 $wrapper->output_like(qr/X=\{SecondVal\}/ms,
772 "Can set breakpoint in a line.");
775 # Testing that we can re-enable a breakpoint at a numeric line.
777 my $wrapper = DebugWrap->new(
779 prog => '../lib/perl5db/t/disable-breakpoints-2',
788 q/print "X={$x}\n";/,
795 $wrapper->output_like(
797 X=\{SecondValOneHundred\}
799 "Can set breakpoint in a line."
804 # Disable and enable for breakpoints on outer files.
806 my $wrapper = DebugWrap->new(
811 'b ../lib/perl5db/t/EnableModule.pm:14',
812 'disable ../lib/perl5db/t/EnableModule.pm:14',
814 'enable ../lib/perl5db/t/EnableModule.pm:14',
816 q/print "X={$x}\n";/,
820 prog => '../lib/perl5db/t/disable-breakpoints-3',
825 $wrapper->output_like(qr/
826 X=\{SecondValTwoHundred\}
828 "Can set breakpoint in a line.");
831 # Testing that the prompt with the information appears.
833 my $wrapper = DebugWrap->new(
836 prog => '../lib/perl5db/t/disable-breakpoints-1',
840 $wrapper->contents_like(qr/
841 ^main::\([^\)]*\bdisable-breakpoints-1:2\):\n
842 2:\s+my\ \$x\ =\ "One";\n
844 "Prompt should display the first line of code.");
847 # Testing that R (restart) and "B *" work.
849 my $wrapper = DebugWrap->new(
859 q/print "X={$x};dummy={$dummy}\n";/,
862 prog => '../lib/perl5db/t/disable-breakpoints-1',
866 $wrapper->output_like(qr/
867 X=\{FirstVal\};dummy=\{1\}
869 "Restart and delete all breakpoints work properly.");
873 my $wrapper = DebugWrap->new(
878 q/print "X={$x}\n";/,
882 prog => '../lib/perl5db/t/disable-breakpoints-1',
886 $wrapper->output_like(qr/
889 "'c line_num' is working properly.");
893 my $wrapper = DebugWrap->new(
901 q/print "Exp={$exp}\n";/,
904 prog => '../lib/perl5db/t/break-on-dot',
908 $wrapper->output_like(qr/
911 "'b .' is working correctly.");
914 # Testing that the prompt with the information appears inside a subroutine call.
915 # See https://rt.perl.org/rt3/Ticket/Display.html?id=104820
917 my $wrapper = DebugWrap->new(
924 prog => '../lib/perl5db/t/with-subroutine',
928 $wrapper->contents_like(
930 ^main::back\([^\)\n]*\bwith-subroutine:15\):[\ \t]*\n
931 ^15:\s*print\ "hello\ back\\n";
933 "Prompt should display the line of code inside a subroutine.");
936 # Checking that the p command works.
938 my $wrapper = DebugWrap->new(
942 'p "<<<" . (4*6) . ">>>"',
945 prog => '../lib/perl5db/t/with-subroutine',
949 $wrapper->contents_like(
956 my $wrapper = DebugWrap->new(
963 prog => '../lib/perl5db/t/with-subroutine',
967 $wrapper->contents_like(
968 # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
969 qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/ms,
974 # Tests for x with @_
976 my $wrapper = DebugWrap->new(
985 prog => '../lib/perl5db/t/test-passing-at-underscore-to-x-etc',
989 $wrapper->contents_like(
990 # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
991 qr/Arg1.*?Capsula.*GreekHumor.*Socrates/ms,
992 q/x command test with '@_'./,
996 # Tests for mutating @_
998 my $wrapper = DebugWrap->new(
1005 'print "\n\n\n(((" . join(",", @_) . ")))\n\n\n"',
1008 prog => '../lib/perl5db/t/test-passing-at-underscore-to-x-etc',
1012 $wrapper->output_like(
1013 qr/^\(\(\(Capsula,GreekHumor,Socrates\)\)\)$/ms,
1018 # Tests for x with AutoTrace=1.
1020 my $wrapper = DebugWrap->new(
1031 prog => '../lib/perl5db/t/with-subroutine',
1035 $wrapper->contents_like(
1036 # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
1037 qr/^0\s+SCALAR\([^\)]+\)\n\s+-> 'hello world'\n/ms,
1038 "x after AutoTrace=1 command is working."
1042 # Tests for "T" (stack trace).
1044 my $prog_fn = '../lib/perl5db/t/rt-104168';
1045 my $wrapper = DebugWrap->new(
1056 my $re_text = join('',
1059 "%s = %s\\(\\) called from file " .
1060 "'" . quotemeta($prog_fn) . "' line %s\\n",
1061 (map { quotemeta($_) } @$_)
1065 ['.', 'main::baz', 14,],
1066 ['.', 'main::bar', 9,],
1067 ['.', 'main::foo', 6],
1070 $wrapper->contents_like(
1071 # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
1079 my $wrapper = DebugWrap->new(
1086 q/print "X={$x};dummy={$dummy}\n";/,
1089 prog => '../lib/perl5db/t/disable-breakpoints-1'
1093 $wrapper->output_like(qr/
1094 X=\{SecondVal\};dummy=\{1\}
1096 'test for s - single step',
1101 my $wrapper = DebugWrap->new(
1109 q/print "Exp={$exp}\n";/,
1112 prog => '../lib/perl5db/t/break-on-dot'
1116 $wrapper->output_like(qr/
1119 "'b .' is working correctly.");
1123 my $prog_fn = '../lib/perl5db/t/rt-104168';
1124 my $wrapper = DebugWrap->new(
1135 $wrapper->contents_like(
1137 ^main::foo\([^\)\n]*\brt-104168:9\):[\ \t]*\n
1140 'Test for the s command.',
1145 my $wrapper = DebugWrap->new(
1149 's uncalled_subroutine()',
1154 prog => '../lib/perl5db/t/uncalled-subroutine'}
1157 $wrapper->output_like(
1159 'uncalled_subroutine was called after s EXPR()',
1164 my $wrapper = DebugWrap->new(
1168 'n uncalled_subroutine()',
1172 prog => '../lib/perl5db/t/uncalled-subroutine',
1176 $wrapper->output_like(
1178 'uncalled_subroutine was called after n EXPR()',
1183 my $wrapper = DebugWrap->new(
1195 prog => '../lib/perl5db/t/fact',
1199 $wrapper->output_like(
1201 'b subroutine works fine',
1205 # Test for n with lvalue subs
1209 'n', 'print "<$x>\n"',
1210 'n', 'print "<$x>\n"',
1213 prog => '../lib/perl5db/t/lsub-n',
1216 'n steps over lvalue subs',
1219 # Test for 'M' (module list).
1221 my $wrapper = DebugWrap->new(
1228 prog => '../lib/perl5db/t/load-modules'
1232 $wrapper->contents_like(
1233 qr[Scalar/Util\.pm],
1234 'M (module list) works fine',
1239 my $wrapper = DebugWrap->new(
1247 'print "Var=$var\n";',
1250 prog => '../lib/perl5db/t/test-r-statement',
1254 $wrapper->output_like(
1262 'r statement is working properly.',
1267 my $wrapper = DebugWrap->new(
1274 prog => '../lib/perl5db/t/test-l-statement-1',
1278 $wrapper->contents_like(
1280 ^1==>\s+\$x\ =\ 1;\n
1281 2:\s+print\ "1\\n";\n
1284 5:\s+print\ "2\\n";\n
1286 'l statement is working properly (test No. 1).',
1291 my $wrapper = DebugWrap->new(
1303 prog => '../lib/perl5db/t/test-l-statement-1',
1307 my $first_l_out = qr/
1309 2:\s+print\ "1\\n";\n
1312 5:\s+print\ "2\\n";\n
1315 8:\s+print\ "3\\n";\n
1320 my $second_l_out = qr/
1321 11:\s+print\ "4\\n";\n
1324 14:\s+print\ "5\\n";\n
1327 17:\s+print\ "6\\n";\n
1330 20:\s+print\ "7\\n";\n
1332 $wrapper->contents_like(
1335 [^\n]*?DB<\d+>\ \#\ After\ l\ 1\n
1337 [^\n]*?DB<\d+>\ l\s*\n
1339 [^\n]*?DB<\d+>\ \#\ After\ l\ 2\n
1341 [^\n]*?DB<\d+>\ -\s*\n
1343 [^\n]*?DB<\d+>\ \#\ After\ -\n
1345 'l followed by l and then followed by -',
1350 my $wrapper = DebugWrap->new(
1357 prog => '../lib/perl5db/t/test-l-statement-1',
1360 $wrapper->contents_like(
1363 2:\s+print\ "1\\n";\n
1366 5:\s+print\ "2\\n";\n
1375 my $wrapper = DebugWrap->new(
1382 prog => '../lib/perl5db/t/test-l-statement-1',
1386 $wrapper->contents_like(
1389 8:\s+print\ "3\\n";\n
1392 11:\s+print\ "4\\n";\n
1395 14:\s+print\ "5\\n";\n
1404 my $wrapper = DebugWrap->new(
1411 prog => '../lib/perl5db/t/test-l-statement-2',
1415 my $first_l_out = qr/
1417 7:\s+my\ \$n\ =\ shift;\n
1418 8:\s+if\ \(\$n\ >\ 1\)\ \{\n
1419 9:\s+return\ \$n\ \*\ fact\(\$n\ -\ 1\);
1422 $wrapper->contents_like(
1427 'l subroutine_name',
1432 my $wrapper = DebugWrap->new(
1438 # Repeat several times to avoid @typeahead problems.
1445 prog => '../lib/perl5db/t/test-l-statement-2',
1450 ^main::fact\([^\n]*?:7\):\n
1451 ^7:\s+my\ \$n\ =\ shift;\n
1454 $wrapper->contents_like(
1457 auto\(-\d+\)\s+DB<\d+>\s+\.\n
1460 'Test the "." command',
1464 # Testing that the f command works.
1466 my $wrapper = DebugWrap->new(
1470 'f ../lib/perl5db/t/MyModule.pm',
1473 q/do { use IO::Handle; STDOUT->autoflush(1); print "Var=$var\n"; }/,
1478 prog => '../lib/perl5db/t/filename-line-breakpoint'
1482 $wrapper->output_like(qr/
1490 "f command is working.",
1494 # We broke the /pattern/ command because apparently the CORE::eval-s inside
1495 # lib/perl5db.pl cannot handle lexical variable properly. So we now fix this
1500 # 1. Go over the rest of the "eval"s in lib/perl5db.t and see if they cause
1503 my $wrapper = DebugWrap->new(
1510 prog => '../lib/perl5db/t/eval-line-bug',
1514 $wrapper->contents_like(
1515 qr/12: \s* for\ my\ \$q\ \(1\ \.\.\ 10\)\ \{/msx,
1516 "/pat/ command is working and found a match.",
1521 my $wrapper = DebugWrap->new(
1530 prog => '../lib/perl5db/t/eval-line-bug',
1534 $wrapper->contents_like(
1535 qr/12: \s* for\ my\ \$q\ \(1\ \.\.\ 10\)\ \{/msx,
1536 "?pat? command is working and found a match.",
1540 # Test the L command.
1542 my $wrapper = DebugWrap->new(
1551 prog => '../lib/perl5db/t/eval-line-bug',
1555 $wrapper->contents_like(
1557 ^\S*?eval-line-bug:\n
1558 \s*6:\s*my\ \$i\ =\ 5;\n
1559 \s*break\ if\ \(1\)\n
1560 \s*13:\s*\$i\ \+=\ \$q;\n
1561 \s*break\ if\ \(\(\$q\ ==\ 5\)\)\n
1563 "L command is listing breakpoints",
1567 # Test the L command for watch expressions.
1569 my $wrapper = DebugWrap->new(
1577 prog => '../lib/perl5db/t/eval-line-bug',
1581 $wrapper->contents_like(
1583 ^Watch-expressions:\n
1586 "L command is listing watch expressions",
1591 my $wrapper = DebugWrap->new(
1601 prog => '../lib/perl5db/t/eval-line-bug',
1605 $wrapper->contents_like(
1607 ^Watch-expressions:\n
1611 "L command is not listing deleted watch expressions",
1615 # Test the L command.
1617 my $wrapper = DebugWrap->new(
1626 prog => '../lib/perl5db/t/eval-line-bug',
1630 $wrapper->contents_like(
1632 ^\S*?eval-line-bug:\n
1633 \s*6:\s*my\ \$i\ =\ 5;\n
1634 \s*break\ if\ \(1\)\n
1635 \s*13:\s*\$i\ \+=\ \$q;\n
1636 \s*action:\s+print\ \$i\n
1638 "L command is listing actions and breakpoints",
1643 my $wrapper = DebugWrap->new(
1650 prog => '../lib/perl5db/t/rt-104168',
1654 $wrapper->contents_like(
1665 my $wrapper = DebugWrap->new(
1672 prog => '../lib/perl5db/t/rt-104168',
1676 $wrapper->contents_like(
1682 "S command with regex",
1687 my $wrapper = DebugWrap->new(
1694 prog => '../lib/perl5db/t/rt-104168',
1698 $wrapper->contents_unlike(
1702 "S command with negative regex",
1705 $wrapper->contents_like(
1709 "S command with negative regex - what it still matches",
1713 # Test the 'a' command.
1715 my $wrapper = DebugWrap->new(
1719 'a 13 print "\nVar<Q>=$q\n"',
1723 prog => '../lib/perl5db/t/eval-line-bug',
1727 my $nl = $^O eq 'VMS' ? "" : "\\\n";
1728 $wrapper->output_like(qr#
1733 "a command is working",
1737 # Test the 'a' command with no line number.
1739 my $wrapper = DebugWrap->new(
1744 q/a print "Hello " . (3 * 4) . "\n";/,
1748 prog => '../lib/perl5db/t/test-a-statement-1',
1752 $wrapper->output_like(qr#
1753 (?:^Hello\ 12\n.*?){4}
1755 "a command with no line number is working",
1759 # Test the 'A' command
1761 my $wrapper = DebugWrap->new(
1765 'a 13 print "\nVar<Q>=$q\n"',
1770 prog => '../lib/perl5db/t/eval-line-bug',
1774 $wrapper->output_like(
1775 qr#\A\z#msx, # The empty string.
1776 "A command (for removing actions) is working",
1780 # Test the 'A *' command
1782 my $wrapper = DebugWrap->new(
1786 'a 6 print "\nFail!\n"',
1787 'a 13 print "\nVar<Q>=$q\n"',
1792 prog => '../lib/perl5db/t/eval-line-bug',
1796 $wrapper->output_like(
1797 qr#\A\z#msx, # The empty string.
1798 "'A *' command (for removing all actions) is working",
1803 my $wrapper = DebugWrap->new(
1810 'print "\nIDX=<$idx>\n"',
1813 prog => '../lib/perl5db/t/test-w-statement-1',
1818 $wrapper->contents_like(qr#
1820 \s+old\ value:\s+'1'\n
1821 \s+new\ value:\s+'2'\n
1823 'w command - watchpoint changed',
1825 $wrapper->output_like(qr#
1828 "w command - correct output from IDX",
1833 my $wrapper = DebugWrap->new(
1841 'print "\nIDX=<$idx>\n"',
1844 prog => '../lib/perl5db/t/test-w-statement-1',
1848 $wrapper->contents_unlike(qr#
1851 'W command - watchpoint was deleted',
1854 $wrapper->output_like(qr#
1857 "W command - stopped at end.",
1861 # Test the W * command.
1863 my $wrapper = DebugWrap->new(
1872 'print "\nIDX=<$idx>\n"',
1875 prog => '../lib/perl5db/t/test-w-statement-1',
1879 $wrapper->contents_unlike(qr#
1882 '"W *" command - watchpoint was deleted',
1885 $wrapper->output_like(qr#
1888 '"W *" command - stopped at end.',
1892 # Test the 'o' command (without further arguments).
1894 my $wrapper = DebugWrap->new(
1901 prog => '../lib/perl5db/t/test-w-statement-1',
1905 $wrapper->contents_like(qr#
1906 ^\s*warnLevel\ =\ '1'\n
1908 q#"o" command (without arguments) displays warnLevel#,
1911 $wrapper->contents_like(qr#
1912 ^\s*signalLevel\ =\ '1'\n
1914 q#"o" command (without arguments) displays signalLevel#,
1917 $wrapper->contents_like(qr#
1918 ^\s*dieLevel\ =\ '1'\n
1920 q#"o" command (without arguments) displays dieLevel#,
1923 $wrapper->contents_like(qr#
1924 ^\s*hashDepth\ =\ 'N/A'\n
1926 q#"o" command (without arguments) displays hashDepth#,
1930 # Test the 'o' query command.
1932 my $wrapper = DebugWrap->new(
1936 'o hashDepth? signalLevel?',
1939 prog => '../lib/perl5db/t/test-w-statement-1',
1943 $wrapper->contents_unlike(qr#warnLevel#,
1944 q#"o" query command does not display warnLevel#,
1947 $wrapper->contents_like(qr#
1948 ^\s*signalLevel\ =\ '1'\n
1950 q#"o" query command displays signalLevel#,
1953 $wrapper->contents_unlike(qr#dieLevel#,
1954 q#"o" query command does not display dieLevel#,
1957 $wrapper->contents_like(qr#
1958 ^\s*hashDepth\ =\ 'N/A'\n
1960 q#"o" query command displays hashDepth#,
1964 # Test the 'o' set command.
1966 my $wrapper = DebugWrap->new(
1974 prog => '../lib/perl5db/t/test-w-statement-1',
1978 $wrapper->contents_like(qr/
1979 ^\s*(signalLevel\ =\ '0'\n)
1983 q#o set command works#,
1986 $wrapper->contents_like(qr#
1987 ^\s*hashDepth\ =\ 'N/A'\n
1989 q#o set command - hashDepth#,
1993 # Test the '<' and "< ?" commands.
1995 my $wrapper = DebugWrap->new(
1999 q/< print "\nX=<$x>\n"/,
2005 prog => '../lib/perl5db/t/disable-breakpoints-1',
2009 $wrapper->contents_like(qr/
2010 ^pre-perl\ commands:\n
2011 \s*<\ --\ print\ "\\nX=<\$x>\\n"\n
2013 q#Test < and < ? commands - contents.#,
2016 $wrapper->output_like(qr#
2019 q#Test < and < ? commands - output.#,
2023 # Test the '< *' command.
2025 my $wrapper = DebugWrap->new(
2029 q/< print "\nX=<$x>\n"/,
2035 prog => '../lib/perl5db/t/disable-breakpoints-1',
2039 $wrapper->output_unlike(qr/FirstVal/,
2040 q#Test the '< *' command.#,
2044 # Test the '>' and "> ?" commands.
2046 my $wrapper = DebugWrap->new(
2051 q/> print "\nFOO=<$::foo>\n"/,
2057 prog => '../lib/perl5db/t/disable-breakpoints-1',
2061 $wrapper->contents_like(qr/
2062 ^post-perl\ commands:\n
2063 \s*>\ --\ print\ "\\nFOO=<\$::foo>\\n"\n
2065 q#Test > and > ? commands - contents.#,
2068 $wrapper->output_like(qr#
2071 q#Test > and > ? commands - output.#,
2075 # Test the '> *' command.
2077 my $wrapper = DebugWrap->new(
2081 q/> print "\nFOO=<$::foo>\n"/,
2087 prog => '../lib/perl5db/t/disable-breakpoints-1',
2091 $wrapper->output_unlike(qr/FOO=/,
2092 q#Test the '> *' command.#,
2096 # Test the < and > commands together
2098 my $wrapper = DebugWrap->new(
2103 q/< $::lorem += 10;/,
2104 q/> print "\nLOREM=<$::lorem>\n"/,
2111 prog => '../lib/perl5db/t/disable-breakpoints-1',
2115 $wrapper->output_like(qr#
2118 q#Test < and > commands. #,
2122 # Test the { ? and { [command] commands.
2124 my $wrapper = DebugWrap->new(
2135 prog => '../lib/perl5db/t/disable-breakpoints-1',
2139 $wrapper->contents_like(qr#
2140 ^No\ pre-debugger\ actions\.\n
2142 ^pre-debugger\ commands:\n
2145 ^5==>b\s+\$x\ =\ "FirstVal";\n
2149 9:\s+\$x\ =\ "SecondVal";\n
2152 'Test the pre-prompt debugger commands',
2156 # Test the { * command.
2158 my $wrapper = DebugWrap->new(
2166 q/print (("One" x 5), "\n");/,
2169 prog => '../lib/perl5db/t/disable-breakpoints-1',
2173 $wrapper->contents_like(qr#
2174 ^All\ \{\ actions\ cleared\.\n
2176 'Test the { * command',
2179 $wrapper->output_like(qr/OneOneOneOneOne/,
2180 '{ * test - output is OK.',
2184 # Test the ! command.
2186 my $wrapper = DebugWrap->new(
2194 prog => '../lib/perl5db/t/disable-breakpoints-1',
2198 $wrapper->contents_like(qr#
2199 (^3:\s+my\ \$dummy\ =\ 0;\n
2201 5:\s+\$x\ =\ "FirstVal";)\n
2206 'Test the ! command (along with l 3-5)',
2210 # Test the ! -number command.
2212 my $wrapper = DebugWrap->new(
2221 prog => '../lib/perl5db/t/disable-breakpoints-1',
2225 $wrapper->contents_like(qr#
2226 (^3:\s+my\ \$dummy\ =\ 0;\n
2228 5:\s+\$x\ =\ "FirstVal";)\n
2230 ^2==\>\s+my\ \$x\ =\ "One";\n
2235 'Test the ! -n command (along with l)',
2239 # Test the 'source' command.
2241 my $wrapper = DebugWrap->new(
2245 'source ../lib/perl5db/t/source-cmd-test.perldb',
2246 # If we have a 'q' here, then the typeahead will override the
2247 # input, and so it won't be reached - solution:
2248 # put a q inside the .perldb commands.
2249 # ( This may be a bug or a misfeature. )
2251 prog => '../lib/perl5db/t/disable-breakpoints-1',
2255 $wrapper->contents_like(qr#
2256 ^3:\s+my\ \$dummy\ =\ 0;\n
2258 5:\s+\$x\ =\ "FirstVal";\n
2262 9:\s+\$x\ =\ "SecondVal";\n
2265 'Test the source command (along with l)',
2269 # Test the 'source' command being traversed from withing typeahead.
2271 my $wrapper = DebugWrap->new(
2275 'source ../lib/perl5db/t/source-cmd-test-no-q.perldb',
2278 prog => '../lib/perl5db/t/disable-breakpoints-1',
2282 $wrapper->contents_like(qr#
2283 ^3:\s+my\ \$dummy\ =\ 0;\n
2285 5:\s+\$x\ =\ "FirstVal";\n
2289 9:\s+\$x\ =\ "SecondVal";\n
2292 'Test the source command inside a typeahead',
2296 # Test the 'H -number' command.
2298 my $wrapper = DebugWrap->new(
2311 prog => '../lib/perl5db/t/disable-breakpoints-1',
2315 $wrapper->contents_like(qr#
2317 \d+:\s+x\ \(20\+4\)\n
2320 \d+:\s+x\ "Hello\ World"\n
2324 'Test the H -num command',
2328 # Add a test for H (without arguments)
2330 my $wrapper = DebugWrap->new(
2343 prog => '../lib/perl5db/t/disable-breakpoints-1',
2347 $wrapper->contents_like(qr#
2348 ^\d+:\s+x\ \(20\+4\)\n
2351 \d+:\s+x\ "Hello\ World"\n
2355 'Test the H command (without a number.)',
2360 my $wrapper = DebugWrap->new(
2366 '= .hello print "hellox\n"',
2367 '= -goodbye print "goodbyex\n"',
2373 prog => '../lib/perl5db/t/test-l-statement-1',
2377 $wrapper->contents_like(
2379 ^1==>\s+\$x\ =\ 1;\n
2380 2:\s+print\ "1\\n";\n
2383 5:\s+print\ "2\\n";\n
2385 'Test the = (command alias) command.',
2387 $wrapper->output_like(qr/hellox.*goodbyex/xs,
2388 "check . and - can start alias name");
2391 # Test the m statement.
2393 my $wrapper = DebugWrap->new(
2400 prog => '../lib/perl5db/t/disable-breakpoints-1',
2404 $wrapper->contents_like(qr#
2405 ^via\ UNIVERSAL:\ DOES$
2407 "Test m for main - 1",
2410 $wrapper->contents_like(qr#
2411 ^via\ UNIVERSAL:\ can$
2413 "Test m for main - 2",
2417 # Test the m statement.
2419 my $wrapper = DebugWrap->new(
2428 prog => '../lib/perl5db/t/test-m-statement-1',
2432 $wrapper->contents_like(qr#^greet$#ms,
2433 "Test m for obj - 1",
2436 $wrapper->contents_like(qr#^via UNIVERSAL: can$#ms,
2437 "Test m for obj - 1",
2441 # Test the M command.
2443 my $wrapper = DebugWrap->new(
2450 prog => '../lib/perl5db/t/test-m-statement-1',
2454 $wrapper->contents_like(qr#
2455 ^'strict\.pm'\ =>\ '\d+\.\d+\ from
2462 # Test the recallCommand option.
2464 my $wrapper = DebugWrap->new(
2468 'o recallCommand=%',
2474 prog => '../lib/perl5db/t/disable-breakpoints-1',
2478 $wrapper->contents_like(qr#
2479 (^3:\s+my\ \$dummy\ =\ 0;\n
2481 5:\s+\$x\ =\ "FirstVal";)\n
2483 ^2==\>\s+my\ \$x\ =\ "One";\n
2488 'Test the o recallCommand option',
2492 # Test the dieLevel option
2494 my $wrapper = DebugWrap->new(
2502 prog => '../lib/perl5db/t/test-dieLevel-option-1',
2506 $wrapper->output_like(qr#
2507 ^This\ program\ dies\.\ at\ \S+\ line\ 18\N*\.\n
2509 ^\s+main::baz\(\)\ called\ at\ \S+\ line\ 13\n
2510 \s+main::bar\(\)\ called\ at\ \S+\ line\ 7\n
2511 \s+main::foo\(\)\ called\ at\ \S+\ line\ 21\n
2513 'Test the o dieLevel option',
2517 # Test the warnLevel option
2519 my $wrapper = DebugWrap->new(
2527 prog => '../lib/perl5db/t/test-warnLevel-option-1',
2531 $wrapper->contents_like(qr#
2532 ^This\ is\ not\ a\ warning\.\ at\ \S+\ line\ 18\N*\.\n
2534 ^\s+main::baz\(\)\ called\ at\ \S+\ line\ 13\n
2535 \s+main::bar\(\)\ called\ at\ \S+\ line\ 25\n
2536 \s+main::myfunc\(\)\ called\ at\ \S+\ line\ 28\n
2538 'Test the o warnLevel option',
2542 # Test the t command
2544 my $wrapper = DebugWrap->new(
2552 prog => '../lib/perl5db/t/disable-breakpoints-1',
2556 $wrapper->contents_like(qr/
2557 ^main::\([^:]+:15\):\n
2558 15:\s+\$dummy\+\+;\n
2559 main::\([^:]+:17\):\n
2560 17:\s+\$x\ =\ "FourthVal";\n
2562 'Test the t command (without a number.)',
2566 # Test the o AutoTrace command
2568 my $wrapper = DebugWrap->new(
2576 prog => '../lib/perl5db/t/disable-breakpoints-1',
2580 $wrapper->contents_like(qr/
2581 ^main::\([^:]+:15\):\n
2582 15:\s+\$dummy\+\+;\n
2583 main::\([^:]+:17\):\n
2584 17:\s+\$x\ =\ "FourthVal";\n
2586 'Test the o AutoTrace command',
2590 # Test the t command with function calls
2592 my $wrapper = DebugWrap->new(
2603 prog => '../lib/perl5db/t/test-warnLevel-option-1',
2607 $wrapper->contents_like(qr/
2608 ^main::\([^:]+:28\):\n
2610 auto\(-\d+\)\s+DB<1>\s+t\n
2612 auto\(-\d+\)\s+DB<1>\s+b\ 18\n
2613 auto\(-\d+\)\s+DB<2>\s+c\n
2614 main::myfunc\([^:]+:25\):\n
2617 'Test the t command with function calls.',
2621 # Test the o AutoTrace command with function calls
2623 my $wrapper = DebugWrap->new(
2634 prog => '../lib/perl5db/t/test-warnLevel-option-1',
2638 $wrapper->contents_like(qr/
2639 ^main::\([^:]+:28\):\n
2641 auto\(-\d+\)\s+DB<1>\s+o\ AutoTrace\n
2642 \s+AutoTrace\s+=\s+'1'\n
2643 auto\(-\d+\)\s+DB<2>\s+b\ 18\n
2644 auto\(-\d+\)\s+DB<3>\s+c\n
2645 main::myfunc\([^:]+:25\):\n
2648 'Test the o AutoTrace command with function calls.',
2652 # Test the final message.
2654 my $wrapper = DebugWrap->new(
2661 prog => '../lib/perl5db/t/test-warnLevel-option-1',
2665 $wrapper->contents_like(qr/
2666 ^Debugged\ program\ terminated\.
2668 'Test the final "Debugged program terminated" message.',
2672 # Test the o inhibit_exit=0 command
2674 my $wrapper = DebugWrap->new(
2685 prog => '../lib/perl5db/t/test-warnLevel-option-1',
2689 $wrapper->contents_unlike(qr/
2690 ^Debugged\ program\ terminated\.
2692 'Test the o inhibit_exit=0 command.',
2696 # Test the o PrintRet=1 option
2698 my $wrapper = DebugWrap->new(
2711 prog => '../lib/perl5db/t/test-PrintRet-option-1',
2715 $wrapper->contents_like(
2716 qr/scalar context return from main::return_scalar: 20024/,
2717 "Test o PrintRet=1",
2721 # Test the o PrintRet=0 option
2723 my $wrapper = DebugWrap->new(
2736 prog => '../lib/perl5db/t/test-PrintRet-option-1',
2740 $wrapper->contents_unlike(
2742 "Test o PrintRet=0",
2746 # Test the o PrintRet=1 option in list context
2748 my $wrapper = DebugWrap->new(
2761 prog => '../lib/perl5db/t/test-PrintRet-option-1',
2765 $wrapper->contents_like(
2766 qr/list context return from main::return_list:\n0\s*'Foo'\n1\s*'Bar'\n2\s*'Baz'\n/,
2767 "Test o PrintRet=1 in list context",
2771 # Test the o PrintRet=0 option in list context
2773 my $wrapper = DebugWrap->new(
2786 prog => '../lib/perl5db/t/test-PrintRet-option-1',
2790 $wrapper->contents_unlike(
2792 "Test o PrintRet=0 in list context",
2796 # Test the o PrintRet=1 option in void context
2798 my $wrapper = DebugWrap->new(
2811 prog => '../lib/perl5db/t/test-PrintRet-option-1',
2815 $wrapper->contents_like(
2816 qr/void context return from main::return_void/,
2817 "Test o PrintRet=1 in void context",
2821 # Test the o PrintRet=1 option in void context
2823 my $wrapper = DebugWrap->new(
2836 prog => '../lib/perl5db/t/test-PrintRet-option-1',
2840 $wrapper->contents_unlike(
2842 "Test o PrintRet=0 in void context",
2846 # Test the o frame option.
2848 my $wrapper = DebugWrap->new(
2852 # This is to avoid getting the "Debugger program terminated"
2853 # junk that interferes with the normal output.
2861 prog => '../lib/perl5db/t/test-frame-option-1',
2865 $wrapper->contents_like(
2867 in\s*\.=main::my_other_func\(3,\ 1200\)\ from.*?
2868 out\s*\.=main::my_other_func\(3,\ 1200\)\ from
2870 "Test o PrintRet=0 in void context",
2875 my $wrapper = DebugWrap->new(
2879 # This is to avoid getting the "Debugger program terminated"
2880 # junk that interferes with the normal output.
2885 prog => '../lib/perl5db/t/fact',
2889 $wrapper->contents_like(
2891 (?:^main::fact.*return\ \$n\ \*\ fact\(\$n\ -\ 1\);.*)
2897 # Test the w for lexical variables expression.
2899 my $wrapper = DebugWrap->new(
2903 # This is to avoid getting the "Debugger program terminated"
2904 # junk that interferes with the normal output.
2912 prog => '../lib/perl5db/t/break-on-dot',
2916 $wrapper->contents_like(
2918 \s+old\ value:\s+'1'\n
2919 \s+new\ value:\s+'2'\n
2921 "Test w for lexical values.",
2925 # perl 5 RT #121509 regression bug.
2926 # “perl debugger doesn't save starting dir to restart from”
2927 # Thanks to Linda Walsh for reporting it.
2929 use File::Temp qw/tempdir/;
2931 my $temp_dir = tempdir( CLEANUP => 1 );
2933 local $ENV{__PERLDB_TEMP_DIR} = $temp_dir;
2934 my $wrapper = DebugWrap->new(
2938 # This is to avoid getting the "Debugger program terminated"
2939 # junk that interferes with the normal output.
2959 prog => '../lib/perl5db/t/rt-121509-restart-after-chdir',
2963 $wrapper->output_like(
2971 "Test that the debugger chdirs to the initial directory after a restart.",
2974 # Test the perldoc command
2975 # We don't actually run the program, but we need to provide one to the wrapper.
2979 or skip "man errors aren't especially portable", 1;
2981 or skip "man command seems to be missing", 1;
2982 local $ENV{LANG} = "C";
2983 local $ENV{LC_MESSAGES} = "C";
2984 local $ENV{LC_ALL} = "C";
2985 my $wrapper = DebugWrap->new(
2989 'perldoc perlrules',
2992 prog => '../lib/perl5db/t/fact',
2996 $wrapper->output_like(
2997 qr/No (?:manual )?entry for perlrules/,
2998 'perldoc command works fine',
3002 # [perl #71678] debugger bug in evaluation of user actions ('a' command)
3003 # Still evaluated after the script finishes.
3005 my $wrapper = DebugWrap->new(
3009 q#a 9 print " \$arg = $arg\n"#,
3014 prog => '../lib/perl5db/t/test-a-statement-2',
3015 switches => [ '-dw', ],
3020 $wrapper->contents_unlike(qr/
3021 Use\ of\ uninitialized\ value\ \$arg\ in\ concatenation\ [\S ]+\ or\ string\ at
3023 'Test that the a command does not emit warnings on program exit.',
3029 my $wrapper = DebugWrap->new(
3038 prog => '../lib/perl5db/t/test-a-statement-3',
3039 switches => [ '-d' ],
3043 $wrapper->contents_like(
3045 'Test that the a command runs only on the given lines.',
3050 # perl 5 RT #126735 regression bug.
3051 local $ENV{PERLDB_OPTS} = "NonStop=0 RemotePort=non-existent-host.tld:9001";
3052 my $output = runperl( stdin => "q\n", stderr => 1, switches => [ '-d' ], prog => '../lib/perl5db/t/fact' );
3055 qr/^Unable to connect to remote host:/ms,
3056 'Tried to connect.',
3061 'Can quit from the debugger after a wrong RemotePort',
3066 # perl 5 RT #120174 - 'p' command
3067 my $wrapper = DebugWrap->new(
3076 prog => '../lib/perl5db/t/rt-120174',
3080 $wrapper->contents_like(
3082 q/RT 120174: p command can be invoked without space after 'p'/,
3087 # perl 5 RT #120174 - 'x' command on array
3088 my $wrapper = DebugWrap->new(
3097 prog => '../lib/perl5db/t/rt-120174',
3101 $wrapper->contents_like(
3102 qr/0\s+1\n1\s+2\n2\s+3\n3\s+4/ms,
3103 q/RT 120174: x command can be invoked without space after 'x' before array/,
3108 # perl 5 RT #120174 - 'x' command on array ref
3109 my $wrapper = DebugWrap->new(
3118 prog => '../lib/perl5db/t/rt-120174',
3122 $wrapper->contents_like(
3123 qr/\s+0\s+1\n\s+1\s+2\n\s+2\s+3\n\s+3\s+4/ms,
3124 q/RT 120174: x command can be invoked without space after 'x' before array ref/,
3129 # perl 5 RT #120174 - 'x' command on hash ref
3130 my $wrapper = DebugWrap->new(
3139 prog => '../lib/perl5db/t/rt-120174',
3143 $wrapper->contents_like(
3144 qr/\s+'alpha'\s+=>\s+'beta'\n\s+'gamma'\s+=>\s+'delta'/ms,
3145 q/RT 120174: x command can be invoked without space after 'x' before hash ref/,
3151 my $wrapper = DebugWrap->new(
3160 prog => '../lib/perl5db/t/gh-17660',
3164 $wrapper->output_unlike(
3165 qr/Undefined subroutine &mro::get_linear_isa/ms,
3166 q/mro needs to be loaded/,
3168 $wrapper->output_like(
3169 qr/Foo 1.000, Bar 2.000/,
3170 q/check for reasonable result/,
3176 my $wrapper = DebugWrap->new(
3184 prog => '../lib/perl5db/t/gh-17661',
3188 $wrapper->output_like(
3189 qr/C5, C1, C2, C3, C4/,
3190 q/check for reasonable result/,
3195 # gh #17661 related - C<l $var> where $var is lexical
3196 my $wrapper = DebugWrap->new(
3205 prog => '../lib/perl5db/t/gh-17661b',
3209 $wrapper->contents_like(
3211 q/check bar was listed/,
3213 $wrapper->contents_like(
3215 q/check foo was listed/,
3222 or skip "need threads to test debugging threads", 1;
3223 my $wrapper = DebugWrap->new(
3230 prog => '../lib/perl5db/t/rt-124203',
3234 $wrapper->output_like(qr/In the thread/, "[perl #124203] the thread ran");
3236 $wrapper->output_like(qr/Finished/, "[perl #124203] debugger didn't deadlock");
3238 $wrapper = DebugWrap->new(
3245 prog => '../lib/perl5db/t/rt-124203b',
3249 $wrapper->output_like(qr/In the thread/, "[perl #124203] the thread ran (lvalue)");
3251 $wrapper->output_like(qr/Finished One/, "[perl #124203] debugger didn't deadlock (lvalue)");
3255 # https://github.com/Perl/perl5/issues/19198
3256 # this isn't a debugger bug, but a bug in the way perl itself stores cop
3257 # information for lines
3258 my $wrapper = DebugWrap->new(
3262 'b Test::AUTOLOAD', # this would crash on ASAN
3263 'c', # this would fail to stop at the breakpoint
3270 use vars '$AUTOLOAD';
3271 my $sub = $AUTOLOAD;
3292 $wrapper->output_unlike(qr/AddressSanitizer/, "[github #19198] no bad access");
3293 $wrapper->contents_like(qr/^Test::AUTOLOAD\(.*?\):\s+\d+:\s+my \$sub = \$AUTOLOAD;/m,
3294 "[github #19198] check we stopped correctly");
3300 1 while unlink ($rc_filename, $out_fn);