Debugging card dead, sometimes need to kill process restart after the analysis of reasons, this time need to keep the card dead state, generate core files, restart after the analysis.
1, Gcore
Usage:gcore [-o filename] pid
Usage is as follows:
[Root@htdev ~]# gcore 19388
[thread debugging using libthread_db enabled]
[New Thread 0x2b46ed999890 (LWP 19388)]
[New Thread 0x43e62940 (LWP 19399)]
[New Thread 0x43461940 (LWP 19398)]
[New Thread 0x42a60940 (LWP 19397)]
[New Thread 0x4205f940 (LWP 19396)]
[New Thread 0x41018940 (LWP 19390)]
[New Thread 0x41007940 (LWP 19389)]
0x000000364b4d06d9 in Syscall () from/lib64/libc.so.6
Saved corefile core.19388
2, GDB's Generate-core-file command
[Root@htdev ~]# gdb Attach 19388
or [Root@htdev ~]# gdb-q-19388 GNU gdb Fedora (6.8-37.el5) Copyright (C) 2008 Free Software Foundation, Inc. License GPL v3+: GNU GPL version 3 or later
3, modify the build core size
Use Ulimit-a to view the current situation, ulimit-c View only core file size
[Root@htdev ~]# ulimit-a
core file size (blocks,-c) 0
data seg size (Kbytes,-D) Unlimited
Scheduli Ng Priority (-e) 0
file size (blocks,-f) Unlimited
pending signals (-I ) 16383
Max locked Memory (Kbytes, L)
max memory size (Kbytes,-m) unlimited
open files (-N) 1024
pipe Size (bytes, p) 8
POSIX message Queues (bytes,-q) 819200
real-time Priority (-r) 0
Stack size (Kbytes,-s) 10240
CPU time (seconds,-T) unlimited
max User Processes (-u) 16383< C28/>virtual Memory (Kbytes,-V) unlimited
file Locks (-X) Unlimited
[Root@htdev ~]# ulimit-c
0
Using the ulimit-c filesize command, you can limit the size of the core file (the FileSize unit is KByte). If Ulimit-c Unlimited, the size of the core file is unrestricted. If the generated information exceeds this size, it will be cropped, resulting in an incomplete core file. When debugging this core file, GdB prompts for an error.
[Root@htdev ~]# Ulimit-c Unlimited
4, set the core file path
1. Edit the Environment configuration file, let the shell start automatically set Ulimit
2. Change the core file build path
3.sysctl configuration takes effect
vi/etc/profile
Ulimit-c Unlimited >/dev/null 2>&1
vi/etc/sysctl.conf
kernel.core_uses_pid = 1
kernel.core_pattern=/tmp/core-% e-%p
sysctl-p/etc/sysctl.conf