Skip to content
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

perl5db.pl accidental? *warn override #16857

Open
p5pRT opened this issue Mar 1, 2019 · 4 comments
Open

perl5db.pl accidental? *warn override #16857

p5pRT opened this issue Mar 1, 2019 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 1, 2019

Migrated from rt.perl.org#133875 (status was 'open')

Searchable as RT133875$

@p5pRT
Copy link
Author

p5pRT commented Mar 1, 2019

From derhoermi@gmx.net

Hi,

 

  https://perl5.git.perl.org/perl.git/commitdiff/b5679dc0b0f66c67e5dfb402dadb01eedc5529ae

added

 

  *warn = \&_db_warn;

 

which results in unexpected behaviour in remote debugging​:

 

  % PERLDB_OPTS='RemotePort=localhost​:9999' perl -d -e "warn; sleep 100"

 

alongside

 

  % nc -l -p 9999
  Loading DB routines from perl5db.pl version 1.53
  Editor support available.

  Enter h or 'h h' for help, or 'man perldebug' for more help.

  main​::(-e​:1)​:    warn; sleep 100
    DB<1> r
  Warning​: something's wrong at -e line 1.
   at -e line 1.

 

i.e., warnings are printed in the debugger, while `die` messages are printed on STDERR.

 

That's bad for debugger frontends like https://github.com/raix/vscode-perl-debug since

they need to tell debugger and debuggee output apart from one another.

 

regards.

@p5pRT
Copy link
Author

p5pRT commented Mar 2, 2019

From bjoern@hoehrmann.de

On Fri, 01 Mar 2019 14​:02​:46 -0800, derhoermi@​gmx.net wrote​:

Hi,

https://perl5.git.perl.org/perl.git/commitdiff/b5679dc0b0f66c67e5dfb402dadb01eedc5529aeadded

*warn = \&_db_warn;

which results in unexpected behaviour in remote debugging​:

% PERLDB_OPTS='RemotePort=localhost​:9999' perl -d -e "warn; sleep 100"

alongside

% nc -l -p 9999
Loading DB routines from perl5db.pl version 1.53
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.

main​::(-e​:1)​: warn; sleep 100
DB<1> r
Warning​: something's wrong at -e line 1.
at -e line 1.

i.e., warnings are printed in the debugger, while `die` messages
are printed on STDERR. That's bad for debugger frontends like
https://github.com/raix/vscode-perl-debug since they need to tell
debugger and debuggee output apart from one another. regards.

Hmm, it still seems to me that the *warn override is there by accident,
but it seems there is some other cause for this issue. Is there some
sensible way to get the warning into the debuggee's terminal instead of
the debugger socket?

@p5pRT
Copy link
Author

p5pRT commented Mar 2, 2019

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Mar 2, 2019

From bjoern@hoehrmann.de

On Sat, 02 Mar 2019 03​:14​:56 -0800, bjoern wrote​:

Hmm, it still seems to me that the *warn override is there by
accident, but it seems there is some other cause for this issue.
Is there some sensible way to get the warning into the debuggee's
terminal instead of the debugger socket?

So, `perldoc perldebug` says for `warnLevel`

  To disable this default safe mode, set these values to something
  higher than 0. At a level of 1, you get backtraces upon receiving
  any kind of warning (this is often annoying) or exception (this
  is often valuable). Unfortunately, the debugger cannot discern
  fatal exceptions from non-fatal ones. If dieLevel is even 1, then
  your non-fatal exceptions are also traced and unceremoniously
  altered if they came from eval'ed strings or from any kind of eval
  within modules you're attempting to load.

I had taken this to mean `warnLevel` defaults to `0` but it defaults
to `1` at least in Perl 5.28.1 on my system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants