1.\" Copyright (c) 1980, 1991, 1993 2.\" The Regents of the University of California. 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.\" @(#)core.5 8.3 (Berkeley) 12/11/93 33.\" 34.Dd December 11, 1993 35.Dt CORE 5 36.Os BSD 4 37.Sh NAME 38.Nm core 39.Nd memory image file format 40.Sh SYNOPSIS 41.Fd #include <sys/param.h> 42.Sh DESCRIPTION 43A small number of signals which cause abnormal termination of a process 44also cause a record of the process's in-core state to be written 45to disk for later examination by one of the available debuggers. 46(See 47.Xr sigaction 2 . ) 48This memory image is written to a file named 49.Nm programname.core 50in the working directory; 51provided the terminated process had write permission in the directory, 52and provided the abnormality did not cause 53a system crash. 54(In this event, the decision to save the core file is arbitrary, see 55.Xr savecore 8 . ) 56.Pp 57The maximum size of a 58.Nm programname.core 59file is limited by 60.Xr setrlimit 2 . 61Files which would be larger than the limit are not created. 62.Pp 63The 64.Nm programname.core 65file consists of the 66.Fa u . 67area, whose size (in pages) is 68defined by the 69.Dv UPAGES 70manifest in the 71.Aq Pa sys/param.h 72file. The 73.Fa u . 74area starts with a 75.Fa user 76structure as given in 77.Aq Pa sys/user.h . 78The remainder of the 79.Nm programname.core 80file consists of the data pages followed by 81the stack pages of the process image. 82The amount of data space image in the 83.Nm programname.core 84file is given (in pages) by the 85variable 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 91variable 92.Fa u_ssize 93in the 94.Ar u . 95area. 96The size of a ``page'' is given by the constant 97.Dv NBPG 98(also from 99.Aq Pa sys/param.h ) . 100.Sh SEE ALSO 101.Xr adb 1 , 102.Xr dbx 1 , 103.Xr gdb 1 , 104.Xr kgdb 1 , 105.Xr sigaction 2 , 106.Xr setrlimit 2 107.Sh HISTORY 108A 109.Nm core 110file format appeared in 111.At v6 . 112