1.\" $NetBSD: core.5,v 1.6 1998/06/28 21:36:56 nathanw 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 51in the working directory; 52provided the terminated process had write permission in the directory, 53and 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 . ) 57The file is normally named 58.Nm programname.core , 59but is called 60.Nm core 61if the 62kernel configuration option 63.Cd options SHORTCORENAME 64is defined or the sysctl variable 65.Em kern.shortcorename 66is set to 1. 67.Pp 68The maximum size of a 69.Nm programname.core 70file is limited by 71.Xr setrlimit 2 . 72Files which would be larger than the limit are not created. 73.Pp 74The 75.Nm programname.core 76file consists of the 77.Fa u . 78area, whose size (in pages) is 79defined by the 80.Dv UPAGES 81manifest in the 82.Aq Pa sys/param.h 83file. The 84.Fa u . 85area starts with a 86.Fa user 87structure as given in 88.Aq Pa sys/user.h . 89The remainder of the 90.Nm programname.core 91file consists of the data pages followed by 92the stack pages of the process image. 93The amount of data space image in the 94.Nm programname.core 95file is given (in pages) by the 96variable 97.Fa u_dsize 98in the 99.Fa u . 100area. 101The amount of stack image in the core file is given (in pages) by the 102variable 103.Fa u_ssize 104in the 105.Ar u . 106area. 107The size of a ``page'' is given by the constant 108.Dv NBPG 109(also from 110.Aq Pa sys/param.h ) . 111.Sh SEE ALSO 112.Xr gdb 1 , 113.Xr sigaction 2 , 114.Xr setrlimit 2 115.Sh HISTORY 116A 117.Nm core 118file format appeared in 119.At v6 . 120