Skip to content

Instantly share code, notes, and snippets.

@bayashi
Last active December 23, 2015 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayashi/6681778 to your computer and use it in GitHub Desktop.
Save bayashi/6681778 to your computer and use it in GitHub Desktop.
$ ./dump-perl-stacktrace -p 17688 -d
perl_code: open my $fh, '>', qq{/tmp/dump_stacktrace.$$.}.time() or die $!; req
uire Carp; print {$fh} Carp::longmess(q{Dump stacktrace}); close $fh;
init
C
R Attaching to process 17688
Reading symbols from /usr/bin/perl...(no debugging symbols found)...done.
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.s
o...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
Reading symbols from /lib/libresolv.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libcrypt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libutil.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libutil.so.1
Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Fcntl/Fcntl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Fcntl/Fcntl.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/IO/IO.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/IO/IO.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Socket/Socket.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Socket/Socket.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/List/MoreUtils/MoreUtils.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/List/MoreUtils/MoreUtils.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/POSIX/POSIX.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/POSIX/POSIX.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Proc/Wait3/Wait3.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Proc/Wait3/Wait3.so
Reading symbols from /lib/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libnss_files.so.2
0xf57fe416 in __kernel_vsyscall ()
(gdb)
C set pagination off
R (gdb)
C call Perl_eval_pv("open my $fh, '>', qq{/tmp/dump_stacktrace.$$.}.time() or die $!; require Carp; print {$fh} Carp::longmess(q{Dump stacktrace}); close $fh; ",0)
R
Program received signal SIGSEGV, Segmentation fault.
0xb77c1a6e in ?? () from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(Perl_eval_pv) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb)
finish
C detach
R LND: Sending signal 11 to Thread 0xb75256c0 (LWP 17688)
Detaching from program: /usr/bin/perl, process 17688
(gdb)
C quit
R
DONE. Please check /tmp/dump_stacktrace.17688.XXXXX
finish
$ perl -V | grep -- -g
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux-thread-multi -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin'
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables',
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib'
$ ./dump-perl-stacktrace -p 22366 -d
perl_code: open my $fh, '>', qq{/tmp/dump_stacktrace.$$.}.time() or die $!; require Carp; print {$fh} Carp::longmess(q{Dump stacktrace}); close $fh;
init
C
R Attaching to process 22366
ptrace: No such process.
(gdb)
C set pagination off
R (gdb)
C call Perl_eval_pv("open my $fh, '>', qq{/tmp/dump_stacktrace.$$.}.time() or die $!; require Carp; print {$fh} Carp::longmess(q{Dump stacktrace}); close $fh; ",0)
R No symbol table is loaded. Use the "file" command.
(gdb)
finish
C detach
R The program is not being run.
(gdb)
C quit
R
Failed to inspect. Is your perl built with debug symbol?
finish
$ ./dump-perl-stacktrace -p 22349 -d
perl_code: open my $fh, '>', qq{/tmp/dump_stacktrace.$$.}.time() or die $!; require Carp; print {$fh} Carp::longmess(q{Dump stacktrace}); close $fh;
init
C
R Attaching to process 22349
Reading symbols from /usr/bin/perl...(no debugging symbols found)...done.
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
Reading symbols from /lib/libresolv.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libcrypt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libutil.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libutil.so.1
Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/List/Util/Util.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/List/Util/Util.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/IO/IO.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/IO/IO.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Data/Dumper/Dumper.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Data/Dumper/Dumper.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/PadWalker/PadWalker.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/PadWalker/PadWalker.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/POSIX/POSIX.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/POSIX/POSIX.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Proc/Wait3/Wait3.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Proc/Wait3/Wait3.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Time/HiRes/HiRes.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Time/HiRes/HiRes.so
Reading symbols from /lib/i686/nosegneg/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/nosegneg/librt.so.1
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Fcntl/Fcntl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Fcntl/Fcntl.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Socket/Socket.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Socket/Socket.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/List/MoreUtils/MoreUtils.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/List/MoreUtils/MoreUtils.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/HTTP/Parser/XS/XS.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/HTTP/Parser/XS/XS.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/PerlIO/scalar/scalar.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/PerlIO/scalar/scalar.so
Reading symbols from /lib/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Cwd/Cwd.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Cwd/Cwd.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Linux/Inotify2/Inotify2.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Linux/Inotify2/Inotify2.so
0xf57fe416 in __kernel_vsyscall ()
(gdb)
C set pagination off
R (gdb)
C call Perl_eval_pv("open my $fh, '>', qq{/tmp/dump_stacktrace.$$.}.time() or die $!; require Carp; print {$fh} Carp::longmess(q{Dump stacktrace}); close $fh; ",0)
R
Program received signal SIGSEGV, Segmentation fault.
0xb764afbd in Perl_newSVpv () from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(Perl_eval_pv) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb)
finish
C detach
R LND: Sending signal 11 to Thread 0xb73a96c0 (LWP 22349)
Detaching from program: /usr/bin/perl, process 22349
(gdb)
C quit
R
DONE. Please check /tmp/dump_stacktrace.22349.XXXXX
finish
[19:10:42] bayashi@linode
~/forked_dev/inspect-perl-proc
master
$ ls /tmp/dump_stacktrace.22349*
ls: /tmp/dump_stacktrace.22349*: No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment