1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man4 / core.4
blob6c0d1e200627db09bf217645660f3b3c22cf5210
1 '\" te
2 .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH CORE 4 "May 13, 2008"
8 .SH NAME
9 core \- process core file
10 .SH DESCRIPTION
11 .sp
12 .LP
13 The operating system writes out a core file for a process when the process is
14 terminated due to receiving certain signals. A core file is a disk copy of the
15 contents of the process address space at the time the process received the
16 signal, along with additional information about the state of the process. This
17 information can be consumed by a debugger. Core files can also be generated by
18 applying the \fBgcore\fR(1) utility to a running process.
19 .sp
20 .LP
21 Typically, core files are produced following abnormal termination of a process
22 resulting from a bug in the corresponding application. Whatever the cause, the
23 core file itself provides invaluable information to the programmer or support
24 engineer to aid in diagnosing the problem. The core file can be inspected using
25 a debugger such as \fBdbx\fR(1) or \fBmdb\fR(1) or by applying one of the
26 \fBproc\fR(1) tools.
27 .sp
28 .LP
29 The operating system attempts to create up to two core files for each
30 abnormally terminating process, using a global core file name pattern and a
31 per-process core file name pattern. These patterns are expanded to determine
32 the pathname of the resulting core files, and can be configured by
33 \fBcoreadm\fR(1M). By default, the global core file pattern is disabled and not
34 used, and the per-process core file pattern is set to \fBcore\fR. Therefore, by
35 default, the operating system attempts to create a core file named \fBcore\fR
36 in the process's current working directory.
37 .sp
38 .LP
39 A process terminates and produces a core file whenever it receives one of the
40 signals whose default disposition is to cause a core dump. The list of signals
41 that result in generating a core file is shown in \fBsignal.h\fR(3HEAD).
42 Therefore, a process might not produce a core file if it has blocked or
43 modified the behavior of the corresponding signal. Additionally, no core dump
44 can be created under the following conditions:
45 .RS +4
46 .TP
47 .ie t \(bu
48 .el o
49 If normal file and directory access permissions prevent the creation or
50 modification of the per-process core file pathname by the current process user
51 and group ID. This test does not apply to the global core file pathname
52 because, regardless of the UID of the process dumping core, the attempt to
53 write the global core file is made as the superuser.
54 .RE
55 .RS +4
56 .TP
57 .ie t \(bu
58 .el o
59 Core files owned by the user \fBnobody\fR will not be produced. For example,
60 core files generated for the superuser on an NFS directory are owned by
61 \fBnobody\fR and are, therefore, not written.
62 .RE
63 .RS +4
64 .TP
65 .ie t \(bu
66 .el o
67 If the core file pattern expands to a pathname that contains intermediate
68 directory components that do not exist. For example, if the global pattern is
69 set to \fB/var/core/%n/core.%p\fR, and no directory \fB/var/core/`uname -n`\fR
70 has been created, no global core files are produced.
71 .RE
72 .RS +4
73 .TP
74 .ie t \(bu
75 .el o
76 If the destination directory is part of a filesystem that is mounted read-only.
77 .RE
78 .RS +4
79 .TP
80 .ie t \(bu
81 .el o
82 If the resource limit \fBRLIMIT_CORE\fR has been set to \fB0\fR for the
83 process, no per-process core file is produced. Refer to \fBsetrlimit\fR(2) and
84 \fBulimit\fR(1) for more information on resource limits.
85 .RE
86 .RS +4
87 .TP
88 .ie t \(bu
89 .el o
90 If the core file name already exists in the destination directory and is not a
91 regular file (that is, is a symlink, block or character special-file, and so
92 forth).
93 .RE
94 .RS +4
95 .TP
96 .ie t \(bu
97 .el o
98 If the kernel cannot open the destination file \fBO_EXCL\fR, which can occur if
99 same file is being created by another process simultaneously.
101 .RS +4
103 .ie t \(bu
104 .el o
105 If the process's effective user ID is different from its real user ID or if its
106 effective group ID is different from its real group ID. Similarly, set-user-ID
107 and set-group-ID programs do not produce core files as this could potentially
108 compromise system security. These processes can be explicitly granted
109 permission to produce core files using \fBcoreadm\fR(1M), at the risk of
110 exposing secure information.
114 The core file contains all the process information pertinent to debugging:
115 contents of hardware registers, process status, and process data. The format of
116 a core file is object file specific.
119 For ELF executable programs (see \fBa.out\fR(4)), the core file generated is
120 also an ELF file, containing ELF program and file headers. The \fBe_type\fR
121 field in the file header has type \fBET_CORE\fR. The program header contains an
122 entry for every segment that was part of the process address space, including
123 shared library segments. The contents of the mappings specified by
124 \fBcoreadm\fR(1M) are also part of the core image. Each program header has its
125 \fBp_memsz\fR field set to the size of the mapping. The program headers that
126 represent mappings whose data is included in the core file have their
127 \fBp_filesz\fR field set the same as \fBp_memsz\fR, otherwise \fBp_filesz\fR is
128 \fBzero\fR.
131 A mapping's data can be excluded due to the core file content settings (see
132 \fBcoreadm\fR(1M)), or due to some failure. If the data is excluded because of
133 a failure, the program header entry will have the \fBPF_SUNW_FAILURE\fR flag
134 set in its \fBp_flags\fR field.
137 The program headers of an \fBELF\fR core file also contain entries for two
138 \fBNOTE\fR segments, each containing several note entries as described below.
139 The note entry header and core file note type (\fBn_type\fR) definitions are
140 contained in <\fBsys/elf.h\fR>. The first \fBNOTE\fR segment exists for binary
141 compatibility with old programs that deal with core files. It contains
142 structures defined in <\fBsys/old_procfs.h\fR>. New programs should recognize
143 and skip this \fBNOTE\fR segment, advancing instead to the new \fBNOTE\fR
144 segment. The old \fBNOTE\fR segment is deleted from core files in a future
145 release.
148 The old \fBNOTE\fR segment contains the following entries. Each has entry name
149 \fB"CORE"\fR and presents the contents of a system structure:
151 .ne 2
153 \fB\fBprpsinfo_t\fR\fR
155 .RS 16n
156 \fBn_type\fR: \fBNT_PRPSINFO\fR. This entry contains information of interest to
157 the \fBps\fR(1) command, such as process status, \fBCPU\fR usage, \fBnice\fR
158 value, controlling terminal, user-ID, process-ID, the name of the executable,
159 and so forth. The \fBprpsinfo_t\fR structure is defined in
160 <\fBsys/old_procfs.h\fR>.
164 .ne 2
166 \fB\fBchar\fR array\fR
168 .RS 16n
169 \fBn_type\fR: \fBNT_PLATFORM\fR. This entry contains a string describing the
170 specific model of the hardware platform on which this core file was created.
171 This information is the same as provided by \fBsysinfo\fR(2) when invoked with
172 the command \fBSI_PLATFORM\fR.
176 .ne 2
178 \fB\fBauxv_t\fR array\fR
180 .RS 16n
181 \fBn_type\fR: \fBNT_AUXV\fR. This entry contains the array of \fBauxv_t\fR
182 structures that was passed by the operating system as startup information to
183 the dynamic linker. Auxiliary vector information is defined in
184 <\fBsys/auxv.h\fR>.
189 Following these entries, for each active (non-zombie) light-weight process
190 (LWP) in the process, the old \fBNOTE\fR segment contains an entry with a
191 \fBprstatus_t\fR structure, plus other optionally-present entries describing
192 the LWP, as follows:
194 .ne 2
196 \fB\fBprstatus_t\fR\fR
198 .RS 16n
199 \fBn_type\fR: \fBNT_PRSTATUS\fR. This structure contains things of interest to
200 a debugger from the operating system, such as the general registers, signal
201 dispositions, state, reason for stopping, process-ID, and so forth. The
202 \fBprstatus_t\fR structure is defined in <\fBsys/old_procfs.h\fR>.
206 .ne 2
208 \fB\fBprfpregset_t\fR\fR
210 .RS 16n
211 \fBn_type\fR: \fBNT_PRFPREG\fR. This entry is present only if the \fBLWP\fR
212 used the floating-point hardware. It contains the floating-point registers. The
213 \fBprfpregset_t\fR structure is defined in <\fBsys/procfs_isa.h\fR>.
217 .ne 2
219 \fB\fBgwindows_t\fR\fR
221 .RS 16n
222 \fBn_type\fR: \fBNT_GWINDOWS\fR. This entry is present only on a SPARC machine
223 and only if the system was unable to flush all of the register windows to the
224 stack. It contains all of the unspilled register windows. The \fBgwindows_t\fR
225 structure is defined in <\fBsys/regset.h\fR>.
229 .ne 2
231 \fB\fBprxregset_t\fR\fR
233 .RS 16n
234 \fBn_type\fR: \fBNT_PRXREG\fR. This entry is present only if the machine has
235 extra register state associated with it. It contains the extra register state.
236 The \fBprxregset_t\fR structure is defined in <\fBsys/procfs_isa.h\fR>.
241 The new \fBNOTE\fR segment contains the following entries. Each has entry name
242 "\fBCORE\fR" and presents the contents of a system structure:
244 .ne 2
246 \fB\fBpsinfo_t\fR\fR
248 .RS 20n
249 \fBn_type\fR: \fBNT_PSINFO\fR. This structure contains information of interest
250 to the \fBps\fR(1) command, such as process status, \fBCPU\fR usage, \fBnice\fR
251 value, controlling terminal, user-ID, process-ID, the name of the executable,
252 and so forth. The \fBpsinfo_t\fR structure is defined in <\fBsys/procfs.h\fR>.
256 .ne 2
258 \fB\fBpstatus_t\fR\fR
260 .RS 20n
261 \fBn_type\fR: \fBNT_PSTATUS\fR. This structure contains things of interest to a
262 debugger from the operating system, such as pending signals, state, process-ID,
263 and so forth. The \fBpstatus_t\fR structure is defined in <\fBsys/procfs.h\fR>.
267 .ne 2
269 \fB\fBchar\fR array\fR
271 .RS 20n
272 \fBn_type\fR: \fBNT_PLATFORM\fR. This entry contains a string describing the
273 specific model of the hardware platform on which this core file was created.
274 This information is the same as provided by \fBsysinfo\fR(2) when invoked with
275 the command \fBSI_PLATFORM\fR.
279 .ne 2
281 \fB\fBauxv_t\fR array\fR
283 .RS 20n
284 \fBn_type\fR: \fBNT_AUXV\fR. This entry contains the array of \fBauxv_t\fR
285 structures that was passed by the operating system as startup information to
286 the dynamic linker. Auxiliary vector information is defined in
287 <\fBsys/auxv.h\fR>.
291 .ne 2
293 \fB\fBstruct utsname\fR\fR
295 .RS 20n
296 \fBn_type\fR: \fBNT_UTSNAME\fR. This structure contains the system information
297 that would have been returned to the process if it had performed a
298 \fBuname\fR(2) system call prior to dumping core. The \fButsname\fR structure
299 is defined in <\fBsys/utsname.h\fR>.
303 .ne 2
305 \fB\fBprcred_t\fR\fR
307 .RS 20n
308 \fBn_type\fR: \fBNT_PRCRED\fR. This structure contains the process credentials,
309 including the real, saved, and effective user and group IDs. The \fBprcred_t\fR
310 structure is defined in <\fBaasys/procfs.h\fR>. Following the structure is an
311 optional array of supplementary group IDs. The total number of supplementary
312 group IDs is given by the \fBpr_ngroups\fR member of the \fBprcred_t\fR
313 structure, and the structure includes space for one supplementary group. If
314 \fBpr_ngroups\fR is greater than 1, there is \fBpr_ngroups - 1\fR \fBgid_t\fR
315 items following the structure; otherwise, there is no additional data.
319 .ne 2
321 \fB\fBchar array\fR\fR
323 .RS 20n
324 \fBn_type\fR: \fBNT_ZONENAME\fR. This entry contains a string which describes
325 the name of the zone in which the process was running. See \fBzones\fR(5). The
326 information is the same as provided by \fBgetzonenamebyid\fR(3C) when invoked
327 with the numerical ID returned by \fBgetzoneid\fR(3C).
331 .ne 2
333 \fB\fBstruct ssd\fR array\fR
335 .RS 20n
336 \fBn_type\fR: \fBNT_LDT\fR. This entry is present only on an 32-bit x86 machine
337 and only if the process has set up a Local Descriptor Table (LDT). It contains
338 an array of structures of type \fBstruct ssd\fR, each of which was typically
339 used to set up the \fB%gs\fR segment register to be used to fetch the address
340 of the current thread information structure in a multithreaded process. The
341 \fBssd\fR structure is defined in <\fBsys/sysi86.h\fR>.
345 .ne 2
347 \fB\fBcore_content_t\fR\fR
349 .RS 20n
350 \fBn_type\fR: \fBNT_CONTENT\fR. This optional entry indicates which parts of
351 the process image are specified to be included in the core file. See
352 \fBcoreadm\fR(1M).
357 Following these entries, for each active and zombie \fBLWP\fR in the process,
358 the new \fBNOTE\fR segment contains an entry with an \fBlwpsinfo_t\fR structure
359 plus, for a non-zombie LWP, an entry with an \fBlwpstatus_t\fR structure, plus
360 other optionally-present entries describing the LWP, as follows. A zombie LWP
361 is a non-detached LWP that has terminated but has not yet been reaped by
362 another LWP in the same process.
364 .ne 2
366 \fB\fBlwpsinfo_t\fR\fR
368 .RS 15n
369 \fBn_type\fR: \fBNT_LWPSINFO\fR. This structure contains information of
370 interest to the \fBps\fR(1) command, such as \fBLWP\fR status, \fBCPU\fR usage,
371 \fBnice\fR value, \fBLWP-ID\fR, and so forth. The \fBlwpsinfo_t\fR structure is
372 defined in <\fBsys/procfs.h\fR>. This is the only entry present for a zombie
373 LWP.
377 .ne 2
379 \fB\fBlwpstatus_t\fR\fR
381 .RS 15n
382 \fBn_type\fR: \fBNT_LWPSTATUS\fR. This structure contains things of interest to
383 a debugger from the operating system, such as the general registers, the
384 floating point registers, state, reason for stopping, \fBLWP-ID\fR, and so
385 forth. The \fBlwpstatus_t\fR structure is defined in <\fBsys/procfs.h>\fR>.
389 .ne 2
391 \fB\fBgwindows_t\fR\fR
393 .RS 15n
394 \fBn_type\fR: \fBNT_GWINDOWS\fR. This entry is present only on a SPARC machine
395 and only if the system was unable to flush all of the register windows to the
396 stack. It contains all of the unspilled register windows. The \fBgwindows_t\fR
397 structure is defined in \fB<sys/regset.h>\fR\&.
401 .ne 2
403 \fB\fBprxregset_t\fR\fR
405 .RS 15n
406 \fBn_type\fR: \fBNT_PRXREG\fR. This entry is present only if the machine has
407 extra register state associated with it. It contains the extra register state.
408 The \fBprxregset_t\fR structure is defined in \fB<sys/procfs_isa.h>\fR\&.
412 .ne 2
414 \fB\fBasrset_t\fR\fR
416 .RS 15n
417 \fBn_type\fR: \fBNT_ASRS\fR. This entry is present only on a SPARC V9 machine
418 and only if the process is a 64-bit process. It contains the ancillary state
419 registers for the \fBLWP.\fR The \fBasrset_t\fR structure is defined in
420 \fB<sys/regset.h>\fR\&.
425 Depending on the \fBcoreadm\fR(1M) settings, the section header of an ELF core
426 file can contain entries for CTF, symbol table, and string table sections. The
427 \fBsh_addr\fR fields are set to the base address of the first mapping of the
428 load object that they came from to. This can be used to match those sections
429 with the corresponding load object.
432 The size of the core file created by a process can be controlled by the user
433 (see \fBgetrlimit\fR(2)).
434 .SH SEE ALSO
437 \fBelfdump\fR(1), \fBgcore\fR(1), \fBmdb\fR(1), \fBproc\fR(1), \fBps\fR(1),
438 \fBcoreadm\fR(1M), \fBgetrlimit\fR(2), \fBsetrlimit\fR(2), \fBsetuid\fR(2),
439 \fBsysinfo\fR(2), \fBuname\fR(2), \fBgetzonenamebyid\fR(3C),
440 \fBgetzoneid\fR(3C), \fBelf\fR(3ELF), \fBsignal.h\fR(3HEAD), \fBa.out\fR(4),
441 \fBproc\fR(4), \fBzones\fR(5)
444 \fIANSI C Programmer's Guide\fR