Outils pour utilisateurs

Outils du site


tuto:linux:core_dump

Ceci est une ancienne révision du document !


Dans /etc/sysctl.conf :

kernel.core_pattern = %e.core
ulimit -c unlimited

Et pour rendre les changement effectifs :

sysctl kernel/core_pattern=%e.core
  • %% Le caractere %
  • %p PID du processus dumpe
  • %u UID reel du processus dumpe
  • %g GID reel du processus dumpe
  • %s Numero du signal ayant provoque le dump
  • %t Heure du dump (secondes depuis le 1er janvier 1970, 00H00)
  • %h Nom d'hote (pareil que 'nodename' renvoye par uname(2))
  • %e Nom du fichier executable

Si vous n'avez pas sysctl :

echo "%e.core" | sudo tee /proc/sys/kernel/core_pattern

On se reconnecte et on teste : <script> zsh: abort (core dumped) ./core snow-sip > gdb vxmld /var/snowshore/log/core

warning: .dynamic section for “/lib/tls/libpthread.so.0” is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for “/lib/tls/librt.so.1” is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for “/usr/lib/libxml2.so.2” is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for “/lib/tls/libc.so.6” is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for “/lib/ld-linux.so.2” is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for “/usr/lib/libz.so.1” is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations warning: .dynamic section for “/lib/tls/libm.so.6” is not at the expected address warning: difference appears to be caused by prelink, adjusting expectations

  379 ScSipTransport.c: No such file or directory.

GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type “show copying” to see the conditions. There is absolutely no warranty for GDB. Type “show warranty” for details. This GDB was configured as “i386-redhat-linux-gnu”…Using host libthread_db library “/lib/tls/libthread_db.so.1”. Core was generated by `sipd -c 500 -l 500'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/tls/libpthread.so.0…done. Loaded symbols for /lib/tls/libpthread.so.0 Reading symbols from /lib/tls/librt.so.1…done. Loaded symbols for /lib/tls/librt.so.1 Reading symbols from /usr/lib/libxml2.so.2…done. Loaded symbols for /usr/lib/libxml2.so.2 Reading symbols from /lib/tls/libc.so.6…done. Loaded symbols for /lib/tls/libc.so.6 Reading symbols from /lib/ld-linux.so.2…done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /usr/lib/libz.so.1…done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /lib/tls/libm.so.6…done. Loaded symbols for /lib/tls/libm.so.6 Reading symbols from /lib/libnss_files.so.2…done. Loaded symbols for /lib/libnss_files.so.2 #0 0x0808f7f5 in ScSipXSResend (pstTimer=0x854f068, pvTimerData=0x86ffb18, bRetriesExhausted=1 '\001') at ScSipTransport.c:379 in ScSipTransport.c </script>

<script> (gdb) where

#0 0x0808f7f5 in ScSipXSResend (pstTimer=0x854f068, pvTimerData=0x86ffb18, bRetriesExhausted=1 '\001') at ScSipTransport.c:379 #1 0x0808e984 in TimerThread () at ScTimer.c:654 #2 0x0053e371 in start_thread () from /lib/tls/libpthread.so.0 #3 0x004879be in query_module () from /lib/tls/libc.so.6 </script>

Autres exemples :

gdb
(gdb) core /home/mon_fichier_core
(gdb) bt (afficher les backtraces)
(gdb) up (monter dans les bt)
(gdb) down (descendre dans les bt)
# gdb mon_fichier_core
(gdb) thread apply all bt

Pour utiliser gdb sur un core dump le binaire doit être compilé avec l'option -g de g++ ou gcc :

gcc -g -o myfile myfile.c

gcore permet de faire un core dump d'un process en cours d'execution.

man core
man gcore
tuto/linux/core_dump.1277411586.txt.gz · Dernière modification : 2010/06/24 20:33 de root