brummett / devel-chitin Goto Github PK
View Code? Open in Web Editor NEWAbstract base class for Perl debuggers
Abstract base class for Perl debuggers
The serial iterator doesn't know how to match them up
cpantesters is reporting a new failure related to what seems to be a new opcode "pp_anoncode". For example: http://www.cpantesters.org/cpan/report/1be7d8a2-4f3e-11ed-8914-165839a77606
For example, a Location object has param named "filename", but Breakpoints take "file".
There are probably others. Check the constructors/properties for clues
Hello,
Per Perl/perl5#20384, this module is currently broken on development perls.
At issue are two tests: t/20-optree-deparse.t
and t/21-deparse-trace-anon-sub.t
. There is a PR that fixes t/21-deparse-trace-anon-sub.t
, but t/20-optree-deparse.t
, since it makes assumptions about how Perl parses code into ops, may be “legitimate” breakage.
Are you able to investigate this?
this test has a couple of failures from the 0.15 upload. For example: http://www.cpantesters.org/cpan/report/08088a6e-0b98-11e8-af2b-acaf1d79aee4
Statement unlikely to be reached at (eval 587) line 3.
(Maybe you meant system() when you said exec()?)
# Failed test 'next_statement for line 16'
# at t/21-trace-anon-sub.t line 54.
# got: '@trace'
# expected: 'sub {
# $a = shift;
# $b = 2;
# $a + $b
# }->(1)'
# stopped at line 16 callsite 0x81a7ee8c
#
# Failed test 'next_statement for line 13'
# at t/21-trace-anon-sub.t line 54.
# got: '$a + $b'
# expected: '$a = shift'
# stopped at line 13 callsite 0x81a7a7fc
Don't know how to handle anonymous subs yet at t/21-trace-anon-sub.t line 61.
# Failed test 'next_statement for line 1'
# at /home/njh/perl5/perlbrew/perls/perl-5.18.2-thread-multi-ld/lib/site_perl/5.18.2/Test/Builder.pm line 152.
# got: 'test2_set_is_end()'
# expected: '$b = 2'
# stopped at line 1 callsite 0x81c56604
Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at lib/Devel/Chitin/OpTree.pm line 111.
END failed--call queue aborted at t/21-trace-anon-sub.t line 100.
# Looks like your test exited with 22 just after 3.
(in cleanup) Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at lib/Devel/Chitin/OpTree.pm line 111 during global destruction.
t/21-trace-anon-sub.t ..............
Failed 5/5 subtests
A copy of the report from the RT system: https://rt.cpan.org/Public/Bug/Display.html?id=141554
Correction of a bug in the development branch of the Perl 5 core distribution has triggered a failure in one of Devel-Chitin's test files.
The change in Perl 5 is found here:
Perl/perl5@bb5bc9
The "Blead Breaks CPAN" issue ticket covering this case can be found here:
Perl/perl5#19462
A portion of the output from the failing test file can be found here:
Perl/perl5#19462 (comment)
Here is a CPANtesters report documenting this test failure:
http://www.cpantesters.org/cpan/report/9e68c4d0-9512-11ec-9dd8-3807b7968dbf
It sometimes happens that correction of a bug in the Perl 5 core distribution exposes problems in CPAN code that the bug was previously covering up. That may be the case here, but further investigation is needed.
Thank you very much.
Jim Keenan
Found while rewriting some of the tests. Looks like current_location isn't set until after it's called init() on all the registered debuggers. Try moving where it's set to above the call to init()s
5.37.3 and 5.37.4 both have several deparse related failures. Here's the 5.37.4 report: http://www.cpantesters.org/cpan/report/d41228da-2674-11ed-86cf-e3977c1fe49f
The error "Can't locate object method "PV" via package "B::SPECIAL"" comes up several times in the test runs. The offending function is Devel::Chitin::OpTree::pp_padsv(), used to get the name of a variable. It might be related to #83 which defines a new OP for assigning to a variable
5.37.3 and 5.37.4 both have several deparse related failures. Here's the 5.37.4 report: http://www.cpantesters.org/cpan/report/d41228da-2674-11ed-86cf-e3977c1fe49f
One type of failure (Can't locate object method "pp_padsv_store" via package "Devel::Chitin::OpTree::UNOP") is from an item mentioned in the 5.37.3 changelog. There's a new OP named OP_PADSV_STORE that combines a couple of ops sassign+padsv. The PR for it is here: https://github.com/Perl/perl5/pull/19943/files
A couple of test runs for 0.15 failed similarly. For example: http://www.cpantesters.org/cpan/report/08088a6e-0b98-11e8-af2b-acaf1d79aee4
trace-statements:
# Failed test 'next_statement for line 12'
# at t/21-trace-fib.t line 63.
# got: '@trace'
# expected: '$answer = fib(3)'
# stopped at line 12 callsite 0x81378ec0
#
# Failed test 'next_statement for line 14'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: '$n = shift'
# stopped at line 14 callsite 0x813747ec
# Failed test 'next_statement for line 12'
# at t/21-trace-statements.t line 90.
# got: '@trace'
# expected: '$line = 12'
# stopped at line 12 callsite 0x81094080
#
# Failed test 'next_statement for line 15'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: 'return(1) if $n <= 1'
# stopped at line 15 callsite 0x81873868
#
Can't call method "op" on an undefined value at lib/Devel/Chitin.pm line 405.
# Failed test 'next_statement for line 1'
# at /home/njh/perl5/perlbrew/perls/perl-5.18.2-thread-multi-ld/lib/site_perl/5.18.2/Test/Builder.pm line 152.
# got: 'test2_set_is_end()'
# expected: '$i = 0'
# stopped at line 1 callsite 0x81596e94
Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at lib/Devel/Chitin/OpTree.pm line 111.
END failed--call queue aborted at t/21-trace-statements.t line 405.
# Looks like your test exited with 22 just after 2.
(in cleanup) Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at lib/Devel/Chitin/OpTree.pm line 111 during global destruction.
(in cleanup) Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at lib/Devel/Chitin/OpTree.pm line 111 during global destruction.
Child test program exited with status 5632 at t/21-trace-statements.t line 7.
t/21-trace-statements.t ............
Dubious, test returned 22 (wstat 5632, 0x1600)
Failed 51/51 subtests
and trace-fib
# Failed test 'next_statement for line 14'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: '$n = shift'
# stopped at line 14 callsite 0x813747ec
#
# Failed test 'next_statement for line 15'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: 'return(1) if $n <= 1'
# stopped at line 15 callsite 0x81873868
#
# Failed test 'next_statement for line 14'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: '$n = shift'
# stopped at line 14 callsite 0x813747ec
#
# Failed test 'next_statement for line 15'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: 'return(1) if $n <= 1'
# stopped at line 15 callsite 0x81873868
#
# Failed test 'next_statement for line 14'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: '$n = shift'
# stopped at line 14 callsite 0x813747ec
#
# Failed test 'next_statement for line 15'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: 'return(1) if $n <= 1'
# stopped at line 15 callsite 0x81873868
#
# Failed test 'next_statement for line 14'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: '$n = shift'
# stopped at line 14 callsite 0x813747ec
#
# Failed test 'next_statement for line 15'
# at t/21-trace-fib.t line 63.
# got: 'return(fib($n - 1) + fib($n - 2))'
# expected: 'return(1) if $n <= 1'
# stopped at line 15 callsite 0x81873868
#
t/21-trace-fib.t ...................
Failed 11/13 subtests
I'm getting this message at the end of every run using hdb.
Here's a trivial reproduction. Same on 5.10.1 and 5.36.0.
$ perl -d:hdb -e1
Debugger pid 22503 listening on http://127.0.0.1:8080/debugger-gui
Debugged program pid 22503 terminated with exit code 0
Trapped exception getting next statement: Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at /usr/local/share/perl5/Devel/Chitin/OpTree.pm line 115.
(after clicking "Run" button in web page)
Perl blead (5.27.6) has a new opcode to optimize string concats (https://rt.perl.org/Public/Bug/Display.html?id=132385)
There's an RT issue that needs to be tracked as well:
https://rt.cpan.org/Ticket/Display.html?id=123510
Since the inclusion of
[Prereqs / TestRequires ]
experimental = 0
in dist.ini (because of the optree.t test), Devel::Chitin won't install with cpanm, since experimental.pm won't install on 5.8.
Work out some solution. Maybe a patch to experimental to allow it to install, even though it won't do anything. Maybe work out the install process so it won't try installing on 5.8, and ensure it won't be using when testing on 5.8.
Allow calling eval(), and stop the debugger on the first line of the eval-ed source. And allow single-stepping inside
Say the user wants to retry a previously failed function call...
We'll need to modify the optree to insert a GOTO+jump-target right before the currently active line.
http://search.cpan.org/~rurban/B-Generate-1.47/lib/B/Generate.pm
Article about B::Utils and B::Generate. Check out GOTO with a label
http://www.perl.com/pub/2002/05/07/optree.html
It allows you to turn on the debugger during runtime. It has adapters for many other debuggers.
http://search.cpan.org/~jjore/Enbugger-2.013/lib/Enbugger.pod
It's the w/W key in the command-line debugger
You enter an expression and the debugger will stop if its value changes
For example, code in one file changes, and causes different execution in some far-off module. Allow the user to filter out the known change and see what down-stream thing changes.
After fixing #83, a new error appears:
Use of uninitialized value $got in concatenation (.) or string at t/20-optree-deparse.t line 91.
not ok 8 - t/20-optree-deparse/01-assignment/list_index_assignment
# Failed test 't/20-optree-deparse/01-assignment/list_index_assignment'
# at t/20-optree-deparse.t line 91.
# +-----+----+---------------------------+
# | GOT | OP | CHECK |
# +-----+----+---------------------------+
# | \n | eq | (@the_list, $idx);\n |
# | | | $the_list[2] = 'foo';\n |
# | | | $the_list[$idx] = 'bar'\n |
# +-----+----+---------------------------+
Use of uninitialized value $got in split at t/20-optree-deparse.t line 92.
# Showing whitespace:
# >><<
# $@: Can't locate object method "pp_aelemfastlex_store" via package "Devel::Chitin::OpTree::UNOP" at lib/Devel/Chitin/OpTree.pm line 182.
#
# Tree:
UNOP leavesub (KIDS) BARE, SLICE 0x7fc74d362bb0
LISTOP lineseq (KIDS, PARENS) 0x7fc74d364550
COP nextstate (WANT_LIST, WANT_VOID) (eval 76):1 0x7fc74d364820
LISTOP list (KIDS, PARENS, WANT_LIST, WANT_VOID) 0x7fc74d364b68
OpTree padrange (MOD, WANT_LIST, WANT_VOID) 0x7fc74d364c40
OpTree padav (MOD, WANT_LIST, WANT_VOID) @the_list 0x7fc74d364f70
OpTree padsv (MOD, WANT_LIST, WANT_VOID) $idx 0x7fc74d365048
COP nextstate (WANT_LIST, WANT_VOID) (eval 76):2 0x7fc74d365120
UNOP aelemfastlex_store (KIDS, STACKED, WANT_LIST, WANT_VOID) 0x7fc74d365240
SVOP const (WANT_LIST, WANT_SCALAR) 'foo' 0x7fc74d365300
BINOP null (ex-pp_aelem) (KIDS, MOD, REF, SPECIAL, WANT_LIST, WANT_SCALAR) 0x7fc74d365418
OpTree null (ex-pp_aelemfast_lex) (MOD, REF, WANT_LIST, WANT_SCALAR) 0x7fc74d3654d8
OpTree null (ex-pp_const) (WANT_LIST, WANT_SCALAR) 0x7fc74d365820
COP nextstate (WANT_LIST, WANT_VOID) (eval 76):3 0x7fc74d3658f8
BINOP sassign (KIDS, STACKED, WANT_LIST, WANT_SCALAR) 0x7fc74d365a30
SVOP const (WANT_LIST, WANT_SCALAR) 'bar' 0x7fc74d365b20
UNOP null (ex-pp_aelem) (KIDS, MOD, REF, SPECIAL, WANT_LIST, WANT_SCALAR) 0x7fc74d365bc8
UNOP_AUX multideref (KIDS, MOD, WANT_LIST, WANT_SCALAR) 0x7fc74d365ca0
not ok 1 - Subtest: t/20-optree-deparse/01-assignment
# Failed test 'Subtest: t/20-optree-deparse/01-assignment'
# at t/20-optree-deparse.t line 43.
It's related to this Perl PR that defined the new opcode for combined sassign/aelem: Perl/perl5#20063
Eval frames are erroneously reporting the enclosing sub's @_ in stack frame objects. They should have undef in that slot to indicate there are no args
Once upon a time, this repo and Devel::hdb had TravisCI set up to test many Perl versions on each PR. This was very valuable. TravisCI has since gone away and is replaced with Github Actions.
Here are some links to getting it working with Perl modules:
https://github.com/FGasper/perl-github-action-tips
https://perlmaven.com/ci
https://perlmaven.com/os
https://simbabque.github.io/posts/github-workflow-guide-for-modules/
https://github.com/Perl/docker-perl-tester
It should test on the latest point release of each release version (even numbers) as well as the latest
dev release and perl-blead. Also include threaded versions.
_determine_start_of() croaks if the subname of the Location object is an anon sub.
Maybe there's a list of all the code blocks we can search through, though it would be slow. Maybe there's a way to get the B::OP object directly from the callsite and then work backward to the sub's start.
A test was failing in an unexpected way, and died
http://www.cpantesters.org/cpan/report/08088a6e-0b98-11e8-af2b-acaf1d79aee4
Several failures for this test. For example: http://www.cpantesters.org/cpan/report/c3873cfe-0b9d-11e8-af2b-acaf1d79aee4
and http://www.cpantesters.org/cpan/report/391ff954-0b9b-11e8-af2b-acaf1d79aee4
# Failed test 'callsite has a value'
# at t/07-stack.t line 245.
# Failed test 'callsite has a value'
# at t/07-stack.t line 245.
Undefined value assigned to typeglob at lib/Devel/Chitin.pm line 659.
# Looks like you failed 2 tests of 79.
Child test program exited with status 512 at t/07-stack.t line 36.
t/07-stack.t .......................
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/79 subtests
If the coderef returns true, trigger the breakpoint
http://www.cpantesters.org/cpan/report/e8aff7f8-62d9-11ed-a188-a73006b3d53a
at least one change is a new opcode: pp_emptyavhv
It's like step out... It gives control after the return, but before the next statement after the return, and allows the user to change the return value if they want
It's like step out... It gives control after the return, but before the next statement after the return, and allows the user to change the return value if they want
We'll need this to implement brummett/Devel-hdb#21
There was a bug report about a failure that only happens on threaded perls
https://rt.cpan.org/Ticket/Display.html?id=127437
Devel::Cover is the standard here, but it likely requires the debugger API all to itself.
Alternatively, create a code coverage plugin like Devel::hdb::TraceFollow to do simple line-by-line code coverage. It can be made more capable later.
5.37.3 and 5.37.4 both have several deparse related failures. Here's the 5.37.4 report: http://www.cpantesters.org/cpan/report/d41228da-2674-11ed-86cf-e3977c1fe49f
The error "Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL"" happens a few times. It's strange because D::C::O::NULL is a subclass of D::C::O already, and it has an empty implementation for _build()
Consider using Devel::StackTrace instead of our Devel::Chitin::Stack
To allow distinguishing between multiple statements on the same line
Devel::Callsite exposes the op address
Stepping-over a line that executes an lvalue sub dies with the error Can't modify non-lvalue subroutine call of &DB::sub
. This sample program demonstrates the issue:
my $x = 1;
sub x : lvalue {
$x;
}
print "$x\n";
x() = 2; # Dies here!
print "$x\n";
This issue originates from https://rt.cpan.org/Ticket/Display.html?id=127319. The original reporter says the standard perl debugger handles his example, so there should be a clue about handling lvalue subs in perl5db.
Should accept either a subroutine name (qualified or not) or file name + line number. It will create a 'once' breakpoint to fire when it reaches there.
Look into clearing the lowest-order two bits from $^P
Seems to be failing pretty regularly, for example: http://www.cpantesters.org/cpan/report/1ab0a526-c6dc-11e7-abde-b912e8d69c8f
# Failed test 'callsite has a value'
# at t/07-stack.t line 245.
# Failed test 'callsite has a value'
# at t/07-stack.t line 245.
# Looks like you failed 2 tests of 79.
Child test program exited with status 512 at t/07-stack.t line 36
t/07-stack.t .......................
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/79 subtests
It's failed 9 out of 10 times on freebsd and perl 5.10.0 or 5.10.1. Strangely it passed once?!
0.15 had several runs fail the 21* tests. For example: http://www.cpantesters.org/cpan/report/33220972-0b99-11e8-af2b-acaf1d79aee4
Each test fails similarly:
Can't call method "op" on an undefined value at lib/Devel/Chitin.pm line 354.
# Failed test 'next_statement for line 2589'
# at t/21-trace-anon-sub.t line 54.
# got: '$Test->_ending() if defined($Test)'
# expected: '$a = shift'
# stopped at line 2589 callsite 0x813e4e0c
Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at lib/Devel/Chitin/OpTree.pm line 111.
END failed--call queue aborted.
(in cleanup) Can't locate object method "_build" via package "Devel::Chitin::OpTree::NULL" at lib/Devel/Chitin/OpTree.pm line 111 during global destruction.
Child test program exited with status 5632 at t/21-trace-anon-sub.t line 7.
t/21-trace-anon-sub.t ..............
Dubious, test returned 22 (wstat 5632, 0x1600)
Failed 5/5 subtests
This issue (brummett/Devel-hdb#115) in Devel::hdb was caused by a bug in perl caused by setting a breakpoint in a module's top scope after it's run. Internally, Perl frees some memory associated with these lines' OPs since they've already run and can never run again. The same problem can occur in the top-scope of any eval.
The fix for that test was to set the breakpoint to a line within a sub.
Investigate what it would take to reject setting one of these kinds of breakpoints. The first thing that comes to mind is to find that line's COP and determine whether it's within a sub (safe) or in the top-scope (unsafe).
See also my blog post "You've gotta quotemeta!" for background.
C:\...\Devel-Chitin-0.06> prove -b t\07-stack.t t\07-stack.t .. 1/79 # Failed test 'Execution stack frame filename matches: (?^:\(eval \d+\)\[t\07-stack.t:27\]):1' # at t\07-stack.t line 255. # '(eval 9)[t\07-stack.t:27]' # doesn't match '(?^:\(eval \d+\)\[t\07-stack.t:27\])' # Failed test 'Execution stack frame filename matches: (?^:\(eval \d+\)\[t\07-stack.t:27\]):1 iterator' # at t\07-stack.t line 255. # '(eval 9)[t\07-stack.t:27]' # doesn't match '(?^:\(eval \d+\)\[t\07-stack.t:27\])' # Looks like you failed 2 tests of 79. Child test program exited with status 512 at t\07-stack.t line 36. t\07-stack.t .. Dubious, test returned 25 (wstat 6400, 0x1900) Failed 2/79 subtests
Fixed by changing line 64 in t\07-stack.t
to:
filename => qr/\(eval \d+\)\[\Q$filename\E:27\]/,
Also:
C:\...\Devel-Chitin-0.06> prove -b t\15-subroutine-location.t t\15-subroutine-location.t .. 1/25 # Failed test 'Bar::sub_in_eval location filename' # at t\15-subroutine-location.t line 41. # '(eval 9)[t\15-subroutine-location.t:22]' # doesn't match '(?^:^\(eval \d+\)\[t\15-subroutine-location.t:22\]$)' # Looks like you failed 1 test of 25. Child test program exited with status 256 at t\15-subroutine-location.t line 29. t\15-subroutine-location.t .. Dubious, test returned 25 (wstat 6400, 0x1900) Failed 1/25 subtests Test Summary Report ------------------- t\15-subroutine-location.t (Wstat: 6400 Tests: 25 Failed: 1) Failed test: 21 Non-zero exit status: 25 Files=1, Tests=25, 1 wallclock secs ( 0.06 usr + 0.00 sys = 0.06 CPU) Result: FAIL
Fixed by line 99 in t\15-subroutine-location.t
to
filename => qr{^\(eval \d+\)\[\Q$this_file\E:22\]$},
HTH.
This also makes it crash if given the expression $hash{some_key} because it tries to do a hash dereference on the arrayref value
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.