in reply to Re^2: 32 Bit Perl causing segmentation fault if data is big
in thread 32 Bit Perl causing segmentation fault if data is big

-$ echo $? 139

139 - 128 = 11, which is SIGSEGV on my system (kill -l will identify). So we know it really was a segfault.

i am not aware of debugging perl core using GDB

Same way as any other program.

$ gdb --args perl -e'dump' GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gp +l.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copy +ing" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... (no debugging symbols found) (gdb) run Starting program: /usr/bin/perl -edump (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] (no debugging symbols found) (no debugging symbols found) [New Thread 0xb7cfd8c0 (LWP 7206)] Program received signal SIGABRT, Aborted. [Switching to Thread 0xb7cfd8c0 (LWP 7206)] 0xb7eea424 in __kernel_vsyscall () (gdb) bt #0 0xb7eea424 in __kernel_vsyscall () #1 0xb7d5b956 in kill () from /lib/i686/cmov/libc.so.6 #2 0x080a9e3b in Perl_my_unexec () #3 0x080ec065 in Perl_pp_goto () #4 0x080b1879 in Perl_runops_standard () #5 0x080ac6a0 in perl_run () #6 0x08063ddd in main () (gdb) q The program is running. Exit anyway? (y or n) y

not yet. but installing a new version in professional env is very difficult as i need to get sign off from lot of people.

You don't need to replace the system Perl. You can install it in a temporary directory somewhere.

Unzip Perl in a clean directory and run the following:

sh Configure -des -Doptimize="-g" -Dprefix=$HOME/tmp_perl make make test make install

-Doptimize="-g" makes it a debug build, which isn't good for production, but good for finding problems inside of Perl itself.

-$ perl -v This is perl, v5.8.0 built for aix

Hum, I hear that 5.8.0 was a pretty bad version. 5.8.1 was better, and so much has been fixed since then.

#!/usr/local/perl-5.6.1/bin/perl

Wait, no, you're not using 5.8.0, you're using something even older!

And the 64-bit version appears to use 5.8.2. That could explain the difference. Or maybe not.

Replies are listed 'Best First'.
Re^4: 32 Bit Perl causing segmentation fault if data is big
by peacelover1976 (Initiate) on Mar 19, 2010 at 00:00 UTC

    Thanks for the info. I tried GDB and please find the result below:

    $ gdb --args perl -e'dump' GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and y +ou are welcome to change it and/or distribute copies of it under certain cond +itions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for det +ails. This GDB was configured as "powerpc-ibm-aix5.3.0.0"... (no debugging symbols found) (gdb) run Starting program: /usr/opt/perl5/bin/perl -edump Program received signal SIGABRT, Aborted. 0xd379c2cc in Perl_my_unexec () from /usr/opt/perl5/lib/5.8.2/aix-thre +ad-multi/CORE/libperl.a(libperl.o) (gdb) bt #0 0xd379c2cc in Perl_my_unexec () from /usr/opt/perl5/lib/5.8.2/aix- +thread-multi/CORE/libperl.a(libperl.o) #1 0xd3810294 in Perl_pp_goto () from /usr/opt/perl5/lib/5.8.2/aix-th +read-multi/CORE/libperl.a(libperl.o) #2 0xd3885ad8 in Perl_runops_standard () from /usr/opt/perl5/lib/5.8. +2/aix-thread-multi/CORE/libperl.a(libperl.o) #3 0xd3797b18 in S_run_body () from /usr/opt/perl5/lib/5.8.2/aix-thre +ad-multi/CORE/libperl.a(libperl.o) #4 0xd379efbc in perl_run () from /usr/opt/perl5/lib/5.8.2/aix-thread +-multi/CORE/libperl.a(libperl.o) #5 0x10000478 in main () (gdb)

    i have no clue on the perl info from GDB (have used zillion times for C, C++ programs). Please help me on this.

    Thanks, Peacelover1976

      That was an example. You should run your own program under gdb, not my demo :)

      But forget that. Try your script with a newer version of Perl first. I intend to not hunt for a bug that's already been fixed. I ran your demo using Perl 5.10.0 on linux and I didn't have any problems.