Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > perl.debugger > #3 > unrolled thread
| Started by | kes-kes@yandex.ua (KES) |
|---|---|
| First post | 2015-12-06 21:15 +0200 |
| Last post | 2015-12-09 13:22 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to perl.debugger
Segmentation fault under -d flag kes-kes@yandex.ua (KES) - 2015-12-06 21:15 +0200
Re: Segmentation fault under -d flag shlomif@shlomifish.org (Shlomi Fish) - 2015-12-07 15:59 +0200
Re: Segmentation fault under -d flag kes-kes@yandex.ua (KES) - 2015-12-09 13:07 +0200
Re: Segmentation fault under -d flag kes-kes@yandex.ua (KES) - 2015-12-09 13:22 +0200
| From | kes-kes@yandex.ua (KES) |
|---|---|
| Date | 2015-12-06 21:15 +0200 |
| Subject | Segmentation fault under -d flag |
| Message-ID | <1525651449429326@web1g.yandex.ru> |
Hi.
This code woks fine:
package Devel::KP;
our $VERSION = '0.01';
package # hide the package from the PAUSE indexer
DB;
sub sub {
goto &$DB::sub;
}
use Benchmark qw/ cmpthese /;
sub DB {
}
1;
But if I change DB::sub to look like:
sub sub {
print @_;
goto &$DB::sub;
}
I get segfault
[toc] | [next] | [standalone]
| From | shlomif@shlomifish.org (Shlomi Fish) |
|---|---|
| Date | 2015-12-07 15:59 +0200 |
| Message-ID | <20151207155948.2fd15583@telaviv1.shlomifish.org> |
| In reply to | #3 |
Hi KES,
I was able to reduce the code significantly and it seems to be caused by
Time::HiRes:
https://github.com/shlomif/perl5-Time-HiRes-perl-d-segfault
I was also able to reproduce it on the latest bleadperl. I'm going to report
this bug.
Thanks!
Regards,
Shlomi Fish
On Sun, 06 Dec 2015 21:15:26 +0200
KES <kes-kes@yandex.ua> wrote:
> Hi.
>
> This code woks fine:
> package Devel::KP;
>
> our $VERSION = '0.01';
>
>
> package # hide the package from the PAUSE indexer
> DB;
>
> sub sub {
> goto &$DB::sub;
> }
>
> use Benchmark qw/ cmpthese /;
> sub DB {
> }
>
> 1;
>
>
> But if I change DB::sub to look like:
> sub sub {
> print @_;
> goto &$DB::sub;
> }
>
>
> I get segfault
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Perl Humour - http://perl-begin.org/humour/
To have bugs is human; to fix them — divine.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
[toc] | [prev] | [next] | [standalone]
| From | kes-kes@yandex.ua (KES) |
|---|---|
| Date | 2015-12-09 13:07 +0200 |
| Message-ID | <3256481449659236@web28o.yandex.ru> |
| In reply to | #5 |
Here the another 'segmentation fault'
$cat t.pl
my $x;
$ cat Devel/PkgATCompileTime;
package Devel::PkgAtCompileTime;
use Devel::ImportArgs;
1;
$cat Devel/ImportArgs;
package Devel::ImportArgs;
sub import {
}
package # hide the package from the PAUSE indexer
DB;
use Package::Stash;
my $this = Package::Stash->new( 'DB' );
sub sub {
# I feel this is a crazy thing and I should not do it here. But occasionally I have did it.
my $all = $this->get_all_symbols;
&$DB::sub;
}
sub DB {
}
1;
$ perl -d:PkgAtCompileTime t.pl
Segmentation fault
07.12.2015, 16:05, "Shlomi Fish" <shlomif@shlomifish.org>:
> Hi KES,
>
> I was able to reduce the code significantly and it seems to be caused by
> Time::HiRes:
>
> https://github.com/shlomif/perl5-Time-HiRes-perl-d-segfault
>
> I was also able to reproduce it on the latest bleadperl. I'm going to report
> this bug.
>
> Thanks!
>
> Regards,
>
> Shlomi Fish
>
[toc] | [prev] | [next] | [standalone]
| From | kes-kes@yandex.ua (KES) |
|---|---|
| Date | 2015-12-09 13:22 +0200 |
| Message-ID | <3272991449660122@web4m.yandex.ru> |
| In reply to | #6 |
That is because program run into recursion:
Package::Stash::XS::namespace
Package::Stash::XS::namespace
Package::Stash::XS::namespace
Package::Stash::XS::namespace
Segmentation fault
http://search.cpan.org/~abigail/perl-5.23.5/pod/perlvar.pod#$^P
Actually I should disable first bit:
local $^P = $^P & ~1
my $all = $this->get_all_symbols;
but the $^P does not work at runtime. Because the 'JMP' ops are created at compile time.
but the perl may check first $^P bit at run time. And if it is not set do not pass control to DB::sub/lsub/goto. And in compile time create 'JMP' not to DB::sub but to the
DB::_sub {
&DB::sub if $^P & 1;
}
same code for goto and lsub.
This seems simple to fix.
09.12.2015, 13:07, "KES" <kes-kes@yandex.ua>:
> Here the another 'segmentation fault'
>
> $cat t.pl
> my $x;
>
> $ cat Devel/PkgATCompileTime;
> package Devel::PkgAtCompileTime;
>
> use Devel::ImportArgs;
>
> 1;
>
> $cat Devel/ImportArgs;
> package Devel::ImportArgs;
>
> sub import {
> }
>
> package # hide the package from the PAUSE indexer
> DB;
>
> use Package::Stash;
> my $this = Package::Stash->new( 'DB' );
>
> sub sub {
> # I feel this is a crazy thing and I should not do it here. But occasionally I have did it.
> my $all = $this->get_all_symbols;
> &$DB::sub;
> }
>
> sub DB {
> }
>
> 1;
>
> $ perl -d:PkgAtCompileTime t.pl
> Segmentation fault
>
> 07.12.2015, 16:05, "Shlomi Fish" <shlomif@shlomifish.org>:
>> Hi KES,
>>
>> I was able to reduce the code significantly and it seems to be caused by
>> Time::HiRes:
>>
>> https://github.com/shlomif/perl5-Time-HiRes-perl-d-segfault
>>
>> I was also able to reproduce it on the latest bleadperl. I'm going to report
>> this bug.
>>
>> Thanks!
>>
>> Regards,
>>
>> Shlomi Fish
[toc] | [prev] | [standalone]
Back to top | Article view | perl.debugger
csiph-web