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