1.\" Copyright (c) 1980, 1991 Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" from: @(#)core.5 6.3 (Berkeley) 4/29/91 33.\" $Id: core.5,v 1.3 1994/03/19 18:52:30 mycroft Exp $ 34.\" 35.Dd April 29, 1991 36.Dt CORE 5 37.Os BSD 4 38.Sh NAME 39.Nm core 40.Nd memory image file format 41.Sh SYNOPSIS 42.Fd #include <sys/param.h> 43.Sh DESCRIPTION 44A small number of signals which cause abnormal termination of a process 45also cause a record of the process's in-core state to be written 46to disk for later examination by one of the aviailable debuggers. 47(See 48.Xr sigaction 2 . ) 49This memory image is written to a file named 50.Nm program.core 51in the working directory (where ``program'' is the name of the process 52which terminated abnormally, typically the name of an executable file); 53provided the terminated process had write permission in the directory, 54and provided the abnormality did not caused 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 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 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 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 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 adb 1 , 104.Xr dbx 1 , 105.Xr gdb 1 , 106.Xr kgdb 1 , 107.Xr sigaction 2 , 108.Xr setrlimit 2 109.Sh HISTORY 110A 111.Nm 112file format appeared in 113.At v6 . 114