MirOS Manual: core(5)

CORE(5)                      BSD Reference Manual                      CORE(5)


     core - memory image file format


     #include <sys/param.h>
     #include <sys/core.h>


     A small number of signals which cause abnormal termination of a process
     also cause a record of the process's in-core state to be written to disk
     for later examination by one of the available debuggers (see
     sigaction(2)). This memory image is written to a file named
     programname.core in the working directory, provided the terminated pro-
     cess had write permission in the directory, and provided the abnormality
     did not cause a system crash. (In this event, the decision to save the
     core file is arbitrary, see savecore(8).)

     The maximum size of a programname.core file is limited by setrlimit(2).
     Files which would be larger than the limit are not created.

     The programname.core file consists of the u-area, whose size (in pages)
     is defined by the UPAGES manifest in the <machine/param.h> file. The u-
     area starts with a user structure as given in <sys/user.h>. The remainder
     of the programname.core file consists of the data pages followed by the
     stack pages of the process image. The amount of data space image in the
     programname.core file is given (in pages) by the variable u_dsize in the
     u-area. The amount of stack image in the core file is given (in pages) by
     the variable u_ssize in the u-area. The size of a "page" is given by the
     constant PAGE_SIZE, defined in <machine/param.h>. The user structure is
     defined as:

           struct    user {
                struct    pcb u_pcb;

                struct    pstats u_stats;

                 * Remaining fields only for core dump and/or ptrace--
                 * not valid at other times!
                struct    kinfo_proc u_kproc;
                struct    md_coredump u_md;

     md_coredump is defined in the header file <machine/pcb.h>.

     The on-disk core file consists of a header followed by a number of seg-
     ments. Each segment is preceded by a coreseg structure giving the
     segment's type, the virtual address where the bits resided in process ad-
     dress space and the size of the segment.

     The core header specifies the lengths of the core header itself and each
     of the following core segment headers to allow for any machine dependent
     alignment requirements.

           struct coreseg {
                u_int32_t c_midmag;      /* magic, id, flags */
                u_long    c_addr;        /* Virtual address of segment */
                u_long    c_size;        /* Size of this segment */

           struct core {
                u_int32_t c_midmag;      /* magic, id, flags */
                u_int16_t c_hdrsize;   /* Size of this header (machdep algn) */
                u_int16_t c_seghdrsize;  /* Size of a segment header */
                u_int32_t c_nseg;        /* # of core segments */
                char c_name[MAXCOMLEN+1];     /* Copy of p->p_comm */
                u_int32_t c_signo;       /* Killing signal */
                u_long    c_ucode;       /* Hmm ? */
                u_long    c_cpusize;     /* Size of machine dependent segment */
                u_long    c_tsize;       /* Size of traditional text segment */
                u_long    c_dsize;       /* Size of traditional data segment */
                u_long    c_ssize;       /* Size of traditional stack segment */

     The core structure's c_midmag field is an a.out midmag number with a
     COREMAGIC magic number (see a.out(5)) and flags from the following list:

           #define CORE_CPU    1
           #define CORE_DATA   2
           #define CORE_STACK  4


     gdb(1), pmdb(1), setrlimit(2), sigaction(2)


     A core file format appeared in Version 3 AT&T UNIX.

MirOS BSD #10-current         December 11, 1993                              1

Generated on 2016-02-08 23:56:27 by $MirOS: src/scripts/roff2htm,v 1.82 2016/01/02 20:05:08 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002–2016 The MirOS Project, Germany.
This product includes material provided by mirabilos.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.