debugging method and setting of core dump file generated by Linux __linux

Source: Internet
Author: User

Turn from: http://andyniu.iteye.com/blog/1965571

The concept of core dump:

A core dump is the recorded state of the working memory of a computer program at a specific time, generally when The program has terminated abnormally (crashed). In practice, the other key pieces of the program state are usually dumped at the same time, including the processor registers, WHI CH may include the program counter and stack pointer, memory management information, and other processor and operating Sys TEM flags and information. The name comes from the Once-standard memory technology core memory. Core dumps are often used to diagnose or debug errors in computer programs.

On many operating systems, a fatal error in a program automatically triggers a core dump, and by extension the phrase ' to Dump core "has come to mean, at many cases, any fatal error, regardless of whether a record of the program memory is creat Ed.


On the Linux platform, set the method for generating the core dump file:

Linux coredump debugging   1 How do I generate coredump files? Login to Linux server, any location type        echo "ulimit-c 1024" >>/etc/profile exit Linux re-enter Linux type Ulimit- c If shown 1024 then the Coredump has been opened. The 1024 limit generated core file size cannot exceed 1024KB, you can use parameter Unlimited, cancel the limit ulimit-c Unlimited 2). A brief introduction to core files when a program crashes, it typically generates a core file in the specified directory. The core file is just a memory image (plus debugging information), mainly for debugging. 3). Turn on or off the core file generation to block the system from generating core files: Ulimit-c 0 The following command checks to see if the option to generate the core file is open: ulimit-a This command will display all user customizations, where option-a represents "all" 。 You can also modify the system files to adjust the core option in/etc/profile there is usually a phrase to prohibit the production of core files, which is usually reasonable: # No core file by default Ulimit-s-C 0 >/de V/null 2>&1 But sometimes in the development process, in order to debug problems, or need to be in a specific user environment to open the core file generated settings. Add Ulimit-c Unlimited to the user's ~/.bash_profile to allow specific users to generate core files. If Ulimit-c 0 is also prohibited from producing core files, ulimit-c 1024 will limit the size of core files to 1024KB 4. Set core dump file directory and naming rules/proc/sys/kernel/core_uses_pid can control whether or not to add PID as an extension in the filename of the resulting core file, or 0 Proc/sys if the file content is added. /kernel/core_pattern can set the location of the formatted core file to saveor file name, such as the original file content is core-%e can be modified like this: echo "/corefile/core-%e-%p-%t" > Core_pattern will control the resulting core file will be stored in the/corefile directory, the resulting file Named 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 present GID into filename add current GID    %s-insert signal caused the coredump into the filename adds the signal leading to the core generation    %t-insert UNIX time this coredump occurred into FileName Add the Unix time for core file generation    %h-insert hostname where the coredump happened into filename Add host name    %e-insert coredumping executable name into filename add command name 6). A small way to test the production of core files direct input instructions: kill-s SIGSEGV $$how to generate core Dump

Occurs doredump generally is when the process receives a signal, Linux now has more than 60 signals, you can use the Kill-l command all listed.

Sagi@sagi-laptop:~$Kill-L 1)Sighup 2)SIGINT 3)Sigquit 4)Sigill 5)Sigtrap 6)SIGABRT 7)Sigbus 8)SIGFPE 9)SIGKILL 10)SIGUSR1 11)SIGSEGV 12)SIGUSR2 13)Sigpipe 14)SIGALRM 15)Sigterm 16)Sigstkflt 17)SIGCHLD 18)Sigcont 19)SIGSTOP 20)SIGTSTP 21)Sigttin 22)Sigttou 23)Sigurg 24)SIGXCPU 25)Sigxfsz 26)SIGVTALRM 27)Sigprof 28)Sigwinch 29)Sigio 30)SIGPWR 31)Sigsys 34)Sigrtmin 35)Sigrtmin+1 36)Sigrtmin+2 37)Sigrtmin+3 38)Sigrtmin+4 39)Sigrtmin+5 40)Sigrtmin+6 41)Sigrtmin+7 42)Sigrtmin+8 43)Sigrtmin+9 44)SIGRTMIN+10 45)SIGRTMIN+11 46)SIGRTMIN+12 47)SIGRTMIN+13 48)SIGRTMIN+14 49)SIGRTMIN+15 50)SIGRTMAX-14 51)SIGRTMAX-13 52)SIGRTMAX-12 53)SIGRTMAX-11 54)SIGRTMAX-10 55)SIGRTMAX-9 56)SIGRTMAX-8 57)SIGRTMAX-7 58)SIGRTMAX-6 59)SIGRTMAX-5 60)SIGRTMAX-4 61)SIGRTMAX-3 62)SIGRTMAX-2 63)SIGRTMAX-1 64)Sigrtmax

For a specific signal, the application can write the corresponding signal processing function. If not specified, the default processing is taken, and the default processing is the Coredump signal as follows:

3)sigquit   4)Sigill    6)SIGABRT   8)sigfpe    SIGSEGV    7) Sigbus    )sigsys
5 sigtrap)   sigxcpu   Sigxfsz  29

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.