xref: /openbsd-src/share/man/man5/core.5 (revision db3296cf5c1dd9058ceecc3a29fe4aaa0bd26000)
1.\"	$OpenBSD: core.5,v 1.10 2003/06/02 23:30:14 millert Exp $
2.\"	$NetBSD: core.5,v 1.4 1994/11/30 19:31:11 jtc Exp $
3.\"
4.\" Copyright (c) 1980, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)core.5	8.3 (Berkeley) 12/11/93
32.\"
33.Dd December 11, 1993
34.Dt CORE 5
35.Os
36.Sh NAME
37.Nm core
38.Nd memory image file format
39.Sh SYNOPSIS
40.Fd #include <sys/param.h>
41.Sh DESCRIPTION
42A small number of signals which cause abnormal termination of a process
43also cause a record of the process's in-core state to be written
44to disk for later examination by one of the available debuggers (see
45.Xr sigaction 2 ) .
46This memory image is written to a file named
47.Pa programname.core
48in the working directory, provided the terminated process had write
49permission in the directory, and provided the abnormality did not cause
50a system crash.
51(In this event, the decision to save the core file is arbitrary, see
52.Xr savecore 8 . )
53.Pp
54The maximum size of a
55.Pa programname.core
56file is limited by
57.Xr setrlimit 2 .
58Files which would be larger than the limit are not created.
59.Pp
60The
61.Pa programname.core
62file consists of the
63.Fa u .
64area, whose size (in pages) is defined by the
65.Dv UPAGES
66manifest in the
67.Aq Pa sys/param.h
68file.
69The
70.Fa u .
71area starts with a
72.Fa user
73structure as given in
74.Aq Pa sys/user.h .
75The remainder of the
76.Pa programname.core
77file consists of the data pages followed by the stack pages of the
78process image.
79The amount of data space image in the
80.Pa programname.core
81file is given (in pages) by the variable
82.Fa u_dsize
83in the
84.Fa u .
85area.
86The amount of stack image in the core file is given (in pages) by the variable
87.Fa u_ssize
88in the
89.Ar u .
90area.
91The size of a
92.Dq page
93is given by the constant
94.Dv NBPG
95(also from
96.Aq Pa sys/param.h ) .
97.Sh SEE ALSO
98.Xr gdb 1 ,
99.Xr setrlimit 2 ,
100.Xr sigaction 2
101.Sh HISTORY
102A
103.Nm
104file format appeared in
105.At v3 .
106