Contains an image of a 32-bit process at the time of an error.
A core file is created in the current directory when various errors occur. .Errors such as memory-address violations, illegal instructions, bus errors, and user-generated quit signals commonly cause this core dump. The core file that is created contains a memory image of the terminated process. A process with a saved user ID that differs from the real user ID does not produce a memory image. The contents of a core dump are organized sequentially in the core file as follows:
Item | Description |
---|---|
Core header | Defines basic information about the core dump, and contains offsets which locate the remainder of the core dump information. |
ldinfo structures | Defines loader information. |
mstsave structures | Defines kernel thread state information. Since the faulting thread mstsave structure is directly saved in the core header, additional structures are saved here only for multi-threaded programs. |
Default user stack | Contains a copy of the user stack at the time of the core dump. |
Default data area | (Optional) Contains the user data section. |
Memory mapped regions | (Optional) Contains the anonymously mapped regions. |
vm_info structures | (Optional) Contains offset and size information for memory mapped regions. |
The core_dump structure, defined by the core.h file, occurs at the beginning of a core file. The core_dump structure includes the following fields:
Item | Field Name | Description |
---|---|---|
char | c_signo | The number of the signal which caused the error. |
char | c_flag | A bit field which describes the core dump
type. The meanings of the bits are as follows:
|
ushort | c_entries | The number of core dump modules |
struct ld_info * | c_tab | The offset to the beginning of the core table |
caddr_t | c_stack | The offset to the beginning of the user stack |
int | c_size | The size of the user stack |
struct mstsave | c_mst | A copy of the faulting mst |
struct user | c_u | A copy of the user structure |
int | c_nmsts | The number of mstsave structures referenced by the c_msts field |
struct mstsave * | c_msts | The offset to the other threads' mstsave structures |
int | c_datasize | The size of the data region |
caddr_t | c_data | The offset to user data |
int | c_vmregions | The number of anonymously mapped regions |
struct vm_info * | c_vmm | The offset to the start of the vm_info table |
The c_u field contains the user structure (a copy of the actual u_block), which includes the registers as they existed at the time of the fault.
The ld_info structure and then the user-mode stack follow the u_block in the core dump.
By default, the user data, anonymously mapped regions, and vm_info structures are not included in a core dump. This partial core dump includes the current thread stack, the thread mstsave structures, the user structures, and the state of the registers at the time of the fault. A partial core dump contains sufficient information for a stack traceback. The size of a core dump can also be limited by the setrlimit subroutine.
To enable a full core dump, set the SA_FULLDUMP flag in the sigaction subroutine for the signal that is to generate a full core dump. If this flag is set when the core is dumped, the data section, anonymously mapped regions, and vm_info structures are included in the core dump.