Rewrite description of core dump format to reflect reality.
Addresses PR#11145 by me.
This commit is contained in:
parent
273b2d0b3a
commit
0b6e7eef69
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: core.5,v 1.11 1999/10/10 15:17:43 jdolecek Exp $
|
||||
.\" $NetBSD: core.5,v 1.12 2000/10/07 17:45:26 nathanw Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -33,7 +33,7 @@
|
||||
.\"
|
||||
.\" @(#)core.5 8.3 (Berkeley) 12/11/93
|
||||
.\"
|
||||
.Dd December 11, 1993
|
||||
.Dd October 7, 2000
|
||||
.Dt CORE 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -89,34 +89,114 @@ The maximum size of a core file is limited by
|
||||
.Xr setrlimit 2 .
|
||||
Files which would be larger than the limit are not created.
|
||||
.Pp
|
||||
The core file consists of the
|
||||
.Fa u. area ,
|
||||
whose size (in pages) is defined by the
|
||||
.Dv UPAGES
|
||||
manifest in the
|
||||
.Aq Pa sys/param.h
|
||||
file. The
|
||||
.Fa u. area
|
||||
starts with a
|
||||
.Fa user
|
||||
structure as given in
|
||||
.Aq Pa sys/user.h .
|
||||
The remainder of the core file consists of the data pages followed by
|
||||
the stack pages of the process image.
|
||||
The amount of data space image in the core file is given (in pages) by the
|
||||
variable
|
||||
.Fa u_dsize
|
||||
in the
|
||||
.Fa u. area .
|
||||
The amount of stack image in the core file is given (in pages) by the
|
||||
variable
|
||||
.Fa u_ssize
|
||||
in the
|
||||
.Fa u. area .
|
||||
The size of a ``page'' is given by the constant
|
||||
.Dv NBPG
|
||||
(also from
|
||||
.Aq Pa sys/param.h ) .
|
||||
The core file contains of a core header followed by a number of
|
||||
segments. Each segment is preceded by a core segment header.
|
||||
Both the core header and core segment header are defined in
|
||||
.Aq Pa sys/core.h .
|
||||
|
||||
The core header,
|
||||
.Fa struct core ,
|
||||
specifies the lengths of the core header itself and
|
||||
each of the following core segment headers to allow for any machine
|
||||
dependent alignment requirements.
|
||||
.Bd -literal
|
||||
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; /* Signal code */
|
||||
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 */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The fields of
|
||||
.Fa struct core
|
||||
are as follows:
|
||||
.Bl -tag -width XXXc_seghdrsize
|
||||
.It c_midmag
|
||||
Core file machine ID, magic value, and flags.
|
||||
These values may be extracted with the
|
||||
.Fn CORE_GETMID ,
|
||||
.Fn CORE_GETMAGIC ,
|
||||
and
|
||||
.Fn CORE_GETFLAG
|
||||
macros. The machine ID values are listed in
|
||||
.Aq Pa sys/exec_aout.h .
|
||||
For a valid core file, the magic value in the header must be
|
||||
.Dv COREMAGIC .
|
||||
No flags are defined for the core header.
|
||||
.It c_hdrsize
|
||||
Size of this data structure.
|
||||
.It c_seghdrsize
|
||||
Size of a segment header.
|
||||
.It c_nseg
|
||||
Number of segments that follow this header.
|
||||
.It c_name
|
||||
Process name, copied from the p_comm field of
|
||||
.Fa struct proc .
|
||||
.It c_signo
|
||||
Signal that caused the process to dump core.
|
||||
.It c_ucode
|
||||
Code associated with the signal.
|
||||
.It c_cpusize
|
||||
Size of the segment containing CPU-specific information.
|
||||
This segment will have the
|
||||
.Dv CORE_CPU
|
||||
flag set.
|
||||
.It c_tsize
|
||||
Size of the segment containing the program text.
|
||||
.It c_dsize
|
||||
Size of the segment containing the program's traditional data area.
|
||||
.It c_ssize
|
||||
Size of the segment containing the program's traditional stack area.
|
||||
This segment will have the
|
||||
.Dv CORE_STACK
|
||||
flag set.
|
||||
.El
|
||||
The header is followed by
|
||||
.Fa c_nseg
|
||||
segments, each of which is preceded with a segment header,
|
||||
.Fa struct coreseg :
|
||||
.Bd -literal
|
||||
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 */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The fields of
|
||||
.Fa struct coreseg
|
||||
are as follows:
|
||||
.Bl -tag -width XXXc_midmag
|
||||
.It c_midmag
|
||||
Core segment magic value and flags.
|
||||
These values may be extracted with the
|
||||
.Fn CORE_GETMAGIC
|
||||
and
|
||||
.Fn CORE_GETFLAG
|
||||
macros.
|
||||
The magic value in the segment header must be
|
||||
.Dv CORESEGMAGIC .
|
||||
Exactly one of of the flags
|
||||
.Dv CORE_CPU ,
|
||||
.Dv CORE_DATA,
|
||||
or
|
||||
.Dv CORE_STACK
|
||||
will be set to indicate the segment type.
|
||||
.It c_addr
|
||||
Virtual address of the segment in the program image.
|
||||
Meaningless if the segment type is
|
||||
.Dv CORE_CPU .
|
||||
.It c_size
|
||||
Size of the segment, not including this header.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr gdb 1 ,
|
||||
.Xr setrlimit 2 ,
|
||||
@ -128,3 +208,8 @@ A
|
||||
.Nm core
|
||||
file format appeared in
|
||||
.At v6 .
|
||||
.Sh BUGS
|
||||
There is no standard location or name for the
|
||||
CPU-dependant data structure stored in the
|
||||
.Dv CORE_CPU
|
||||
segment.
|
||||
|
Loading…
Reference in New Issue
Block a user