Groups | Search | Server Info | Login | Register
| Newsgroups | perl.debugger |
|---|---|
| Subject | perl5db.pl improvements: apply user's context pragma while DB::eval |
| Message-ID | <2317061459153270@web10m.yandex.ru> (permalink) |
| Date | 2016-03-28 11:21 +0300 |
| From | kes-kes@yandex.ru (KES) |
Hi.
When from debugger we evaluate some expression the user's context pragma is not applyed.
This patch fixes that: https://github.com/KES777/perl/tree/apply_users_context_pragma
Need help with one problem, can not watch variables when the debugging script.pl has 'use strict' in effect.
Variable "$x" is not imported at (eval 10)[./perl5db.pl:740] line 1.
at (eval 10)[./perl5db.pl:740] line 1.
eval 'BEGIN{ ( $^H, ${^WARNING_BITS} ) = @DB::saved[7,8]; }($@, $!, $^E, $,, $/, $\\, $^W) = @DB::saved;package main; $x;
' called at ./perl5db.pl line 740
DB::eval called at ./perl5db.pl line 6051
DB::_add_watch_expr("\$x") called at ./perl5db.pl line 6071
DB::cmd_w("w", "\$x", 6) called at ./perl5db.pl line 4488
DB::cmd_wrapper("w", "\$x", 6) called at ./perl5db.pl line 3999
DB::Obj::_handle_cmd_wrapper_commands(DB::Obj=HASH(0x26593c0)) called at ./perl5db.pl line 2881
DB::DB called at /home/kes/tmp/t3.pl line 6
Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at (eval 10)[./perl5db.pl:740] line 1.
But here the design problem because of next:
An eval '' executed within a subroutine defined in the DB package doesn't see the usual surrounding lexical scope, but rather the scope of the first non-DB piece of code that called it
As we can see from stacktrace the 'first non-DB piece of code' is
DB::Obj::_handle_cmd_wrapper_commands(DB::Obj=HASH(0x26593c0)) called at ./perl5db.pl line 2881
So if we want $x be evaled at user's context the DB::DB *SHOULD NOT* call to DB::Obj namespace.
Back to perl.debugger | Previous | Next | Find similar
perl5db.pl improvements: apply user's context pragma while DB::eval kes-kes@yandex.ru (KES) - 2016-03-28 11:21 +0300
csiph-web