1.\" $NetBSD: core.5,v 1.8 1999/03/17 20:19:44 garbled 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 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. area , 78whose size (in pages) is defined by the 79.Dv UPAGES 80manifest in the 81.Aq Pa sys/param.h 82file. The 83.Fa u. area 84starts with a 85.Fa user 86structure as given in 87.Aq Pa sys/user.h . 88The remainder of the 89.Nm programname.core 90file consists of the data pages followed by 91the stack pages of the process image. 92The amount of data space image in the 93.Nm programname.core 94file is given (in pages) by the 95variable 96.Fa u_dsize 97in the 98.Fa u. area . 99The amount of stack image in the core file is given (in pages) by the 100variable 101.Fa u_ssize 102in the 103.Fa u. area . 104The size of a ``page'' is given by the constant 105.Dv NBPG 106(also from 107.Aq Pa sys/param.h ) . 108.Sh SEE ALSO 109.Xr gdb 1 , 110.Xr sigaction 2 , 111.Xr setrlimit 2 112.Sh HISTORY 113A 114.Nm core 115file format appeared in 116.At v6 . 117