New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DB::goto should be improved #16356
Comments
From @KES777Created by @KES777Hi. goto &t; We can write next debugger script: $ cat Devel/DB.pm BEGIN { $^P |= 0x80 } sub DB{}; 1; Now we can found all places where different subs are called: BUT1! What sub is replaced is unknown XXX without looking into sources BUT2! Even worse we lose caller info when our debugger defines DB::sub subroutine $ cat Devel/DB.pm BEGIN { $^P |= 0x80 } sub DB{}; sub sub { &$DB::sub } # <<< DEFINED 1; $ perl -d:DB t.pl (Ordinary DB::sub is hidden from caller. We even can not use caller inside DB::sub This makes our debugger pretty useless. So what information we can gather? sub goto{ We can see the difference: main-t.pl-10-DB::goto-1 DB-Devel/DB.pm-12-DB::goto-1 I already asked about this [here](https://stackoverflow.com/questions/34595192/how-to-fix-the-dbgoto-frame) Look. Now we modify our debugger and script: $ cat script.pl goto &t; $ cat Devel/DB.pm BEGIN { $^P |= 0x80 } sub goto{ sub DB{ 1; Now the execution order is: What is the difference in compare to ThisSuitIsBlackNot's answer? We make one more call before the goto. Also to differentiate our two calls And when we dump call stack from DB::goto we see: The 23th line of our debugger is call for VOID context. To prove this we can change context: where 20 and 17 lines are for SCALAR and LIST contexts correspondingly What current information is available: DB-Devel/DB.pm-20-DB::goto-1 (Also notice that this info is not consistent and depend on which features Please improve perl internals to work in next manner instead: The benefit will be next info available to caller from DB::goto main-t.pl-7-DB::goto-0 We can see everything in t2 frame (with help of PadWalker, for example) As I can see this is not hard to implement: Just do &DB::goto call before goto black magic PS. Maybe someone will argue that goto should be hidden. Perl Info
|
Migrated from rt.perl.org#132703 (status was 'new')
Searchable as RT132703$
The text was updated successfully, but these errors were encountered: