This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
lib/perl5db.pl: don't dump argless args
authorDavid Mitchell <davem@iabyn.com>
Wed, 15 Nov 2017 15:25:08 +0000 (15:25 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 15 Nov 2017 15:42:15 +0000 (15:42 +0000)
commit2358aaf106005285251c99872ee3968fc8d3da7d
treea14184d28d7d1a9753647336d33132b807797d62
parentf81152f898ce3bd4d5d77598604aef0d9e3ec302
lib/perl5db.pl: don't dump argless args

dump_trace() prints a stack backtrace - including caller args - by using
caller() and @DB::args.

However, if a sub is called using the '&foo;' argless mechanism, caller()
doesn't populate @DB::args, so it continues to hold whatever it was set
to previously. This might include SVs which have since been freed or
re-allocated.

So only display args for a particular caller depth if that sub was called
with args.

This was causing smoke failures in lib/perl5db.t when TERM was unset.
It only started failing recently, due I guess to subtle changes in what
SVs were left hanging about in @DB::args from a previous use of caller().

See http://nntp.perl.org/group/perl.perl5.porters/247032
    Subject: Smoke FAIL's for lib/perl5db.t
lib/perl5db.pl