Strace-f-o strace.txt/data1/WAF/sbin/nginx-C/data1/WAF/CONF/nginx. conf
If you want the system to generate a core file when an error occurs due to signal interruption, you need to set it in shell as follows:
# Set the core size to unlimited
Ulimit-C Unlimited
# Set the file size to unlimited
Ulimit Unlimited
GDB/data1/WAF/sbin/nginx core.21169
Compile nginx Program-G: generate the debugging symbol information used by the debugging tool (if the compiled program wants to debug, add-g),-o,-O2,-O3: optimizing the compilation connection is faster to execute-O optimization <-O2 optimization <-O3 optimization (if not added, the default value is-O) this is not required for optimization only when your program is determined to be correct and can be released.
Set core dump file directories and naming rules
/Proc/sys/kernel/core_uses_pid can be used to control whether the PID is added as an extension to the file name of the generated core file. If it is added, the file content is 1; otherwise, it is 0.
/Proc/sys/kernel/core_pattern you can set the location or file name of the formatted core file. For example, the original file content is core-% E.
You can modify it as follows:
Echo "/corefile/Core-% E-% P-% t">/proc/sys/kernel/core_pattern
The generated core file is stored in the/corefile directory, and the generated file name is core-command name-PID-timestamp.
The following is a list of parameters:
% P-insert PID into filename add PID
% U-insert current uid into filename add current uid
% G-insert current GID into filename add current GID
% S-insert signal that caused the coredump into the filename added to generate core Signal
% T-insert UNIX time that the coredump occurred into filename UNIX time when the core file is generated
% H-insert hostname where the coredump happened into filename Add the Host Name
% E-insert coredumping executable name into filename add command name
Test to generate a core file: Kill-s SIGSEGV $