Open p5pRT opened 7 years ago
When I want to debug return values from some subroutine I analize $DB::sub variable at DB::sub. But faced into the problem when the method call is done.
[perldebguts](https://perldoc.perl.org/perldebguts.html) states:
When execution of the program reaches **a subroutine call**\, a call to &DB::sub (args) is made instead\, with $DB::sub holding the name of the called subroutine
But when execution of the next program reaches 11 line:
$cat $test.pl package Test1;
sub t1 {};
package Test2;
push @ISA\, 'Test1';
package main;
Test2->t1; # \<\<\<\<\<\<\< 11 line
The $DB::sub contain `Test1::t1` instead of expected `Test2::t2` when `Test2` do not implement `t1` method And $DB::sub contain `Test2::t1` when `Test2` implement `t1` method
This stops me to setup breakpoint without knowing the hierarchy of debugging object. (Complexity raises with multiple inheritance)
I understand that DOC describes **a subroutine call** but lack of `$DB::method` cause the inconvenience.
Please provide $DB::method variable with value of called method
KES wrote:
When I want to debug return values from some subroutine I analize $DB::sub variable at DB::sub. But faced into the problem when the method call is done.
This mechanism behaves precisely as I would expect: Test1::t1 is in fact the subroutine being called\, and $DB::sub identifies it correctly. If $DB::sub were to say "Test2::t1" instead\, that would break debugging\, because there is no subroutine by that name.
Please provide $DB::method variable with value of called method
At the point the call is made and invokes debugger hooks\, there is no distinction between a method call and a direct subroutine call. If you really want to intercept method calls\, you'll need to catch the op that performs the method lookup. I'm not going to advise you how to do that: you'd only get further out of your depth.
This stops me to setup breakpoint without knowing the hierarchy of debugging object. (Complexity raises with multiple inheritance)
I think that by "debugging object" you mean "the invocant". The ->can method would seem to address this issue.
Please learn Perl before you report any more supposed bugs. Writing a debugger is not the way to learn Perl: it is an especially tricky task that only expert Perl programmers should undertake.
-zefram
The RT System itself - Status changed from 'new' to 'open'
Migrated from rt.perl.org#131674 (status was 'open')
Searchable as RT131674$