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