Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

how to debug the core dump file created by perl script

SOLVED
Go to Solution
Highlighted
Frequent Advisor

how to debug the core dump file created by perl script

Hi All,

I have a perl script which create a core dump,

root# file core.22
core.22: ELF-32 core file - IA64 from 'test' - received SIGSEGV

So is there any method which i can see the stack where the core happens?

Thanks in advance!
Kevin
1 ACCEPTED SOLUTIONS
Honored Contributor Honored Contributor

Re: how to debug the core dump file created by perl script

#try gdb core file
example ..gdb /opt/bin/script.pl /core

Thanks
Manix
HP-UX been always lovable - Mani Kalra
7 REPLIES
Honored Contributor Honored Contributor

Re: how to debug the core dump file created by perl script

#try gdb core file
example ..gdb /opt/bin/script.pl /core

Thanks
Manix
HP-UX been always lovable - Mani Kalra
Frequent Advisor

Re: how to debug the core dump file created by perl script

Hi Manix,

I have tried that way, but the gdb will report "not in executable format: File format not recognized".

I want to see the stack where the coredump happened.

Kevin
Honored Contributor Honored Contributor

Re: how to debug the core dump file created by perl script

Hello Kevin,

Please try with below options as per man page.
Should work ,do check the permissions.

gdb [-help] [-e executable-name] [-pid] [-c corefile-name]

Thanks
Manix
HP-UX been always lovable - Mani Kalra
Honored Contributor Honored Contributor

Re: how to debug the core dump file created by perl script

When you're examining a core dump produced by a script, the executable should be the script interpreter, i.e. the "perl" binary in your case.

MK
MK
Frequent Advisor

Re: how to debug the core dump file created by perl script

Hi MK,

Ok, i try your way to debug the core.
root # gdb /usr/bin/perl core

warning: core file may not match specified executable file.
Core was generated by `test'.
Program terminated with signal 11, Segmentation fault.
SEGV_MAPERR - Address not mapped to object

warning: Some of the libraries in the core file are different from the libraries on this computer. It might be possible to proceed with your debugging process successfully. However, if you run into problems you must use packcore command or use the versions of the libraries used by the core. The mismatches are:

/usr/lib/hpux32/libnsl.so.1 in the core file is different from
/usr/lib/hpux32/libnsl.so.1 used by gdb

/usr/lib/hpux32/libnss_nis.so.1 in the core file is different from
/usr/lib/hpux32/libnss_nis.so.1 used by gdb


warning: No unwind information found.
Skipping this library /usr/lib/hpux32/libcl.so.1.

#0 0x60000000c03a3260:0 in tree_delete+0x20 () from /usr/lib/hpux32/libc.so.1
(gdb) bt
#0 0x60000000c03a3260:0 in tree_delete+0x20 () from /usr/lib/hpux32/libc.so.1
#1 0x60000000c039fe50:0 in real_realloc+0x1410 ()
from /usr/lib/hpux32/libc.so.1
#2 0x60000000c039ea00:0 in _realloc+0xa0 () from /usr/lib/hpux32/libc.so.1
#3 0x60000000c03ac2f0:0 in realloc+0x230 () from /usr/lib/hpux32/libc.so.1
#4 0x60000000c8bf0c80:0 in Perl_safesysrealloc () at util.c:124
#5 0x60000000c8c55670:0 in Perl_sv_grow () at sv.c:1660
#6 0x60000000c4f7a4b0:0 in PerlIOScalar_write () at scalar.xs:132
#7 0x60000000c8d89e90:0 in Perl_PerlIO_write () at perlio.c:1593
#8 0x60000000c8d34e20:0 in Perl_do_print () at doio.c:1354
#9 0x60000000c8c36d00:0 in Perl_pp_print () at pp_hot.c:625
#10 0x60000000c8c2fc00:0 in Perl_runops_standard () at run.c:38
#11 0x60000000c8b32220:0 in S_run_body () at perl.c:2361
#12 0x60000000c8b319b0:0 in perl_run () at perl.c:2283
#13 0x4001ff0:0 in main () at perlmain.c:99


But it seems that we can not see where the perl script create coredump.

Thanks!
Kevin
Acclaimed Contributor Acclaimed Contributor

Re: how to debug the core dump file created by perl script

Hi Kevin:

I think you want to read the section entitled "Debugging" here:

http://perldoc.perl.org/perlhack.html

Regards!

...JRF...
Acclaimed Contributor Acclaimed Contributor

Re: how to debug the core dump file created by perl script

#0 0x60000000c03a3260:0 in tree_delete+0x20 /usr/lib/hpux32/libc.so.1
#1 0x60000000c039fe50:0 in real_realloc+0x1410
#2 0x60000000c039ea00:0 in _realloc+0xa0
#3 0x60000000c03ac2f0:0 in realloc+0x230
#4 0x60000000c8bf0c80:0 in Perl_safesysrealloc util.c:124
#5 0x60000000c8c55670:0 in Perl_sv_grow sv.c:1660
#6 0x60000000c4f7a4b0:0 in PerlIOScalar_write scalar.xs:132

This indicates that perl has corrupted the heap.