Core file in gdb




















A core dump is a file that stores a snapshot of the program memory at the program crash. A core dump file is generated when the program terminates by the SIGSEG signal because of tried to access the invalid memory address. Core dump file is used by the GDB to analyze why the program crashed.

This example code gives the segmentation fault error and generates the core dump file. Step Set core file size limit Linux provides a utility called ulimit to set core file size and other parameters. If not specified, the file name defaults to core. This file is used by the Linux kernel to decide what types of memory mappings will be dumped or ignored when generating a core dump file. If a bit is set in the bit mask, then the memory mappings of the corresponding types will be dumped; otherwise, they will be ignored.

This configuration is inherited by child processes. By default, this option is on. It should tell you if it has left a core file with the message "core dumped". The command line to start gdb to look at the core file is: gdb program core where "program" is the name of the program you're working on.

Gdb will then load the program's debugging information and examine the core file to determine the cause of the crash. The last line that gdb will print before the " gdb " prompt will be something like: 0 0xefe54 in main at line in main.



0コメント

  • 1000 / 1000