PageRenderTime 24ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/usr/src/man/man4/core.4

https://bitbucket.org/illumos/illumos-gate/
Forth | 474 lines | 451 code | 23 blank | 0 comment | 31 complexity | 15a3cdbf3cc9a24cb4407cdb5846227d MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, AGPL-1.0, AGPL-3.0, BSD-3-Clause, GPL-3.0, LGPL-2.1, BSD-2-Clause, MPL-2.0-no-copyleft-exception, GPL-2.0, 0BSD
  1. '\" te
  2. .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
  3. .\" Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
  4. .\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
  5. .\" Copyright 1989 AT&T
  6. .\" 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.
  7. .\" 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.
  8. .\" 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]
  9. .TH CORE 4 "Mar 31, 2013"
  10. .SH NAME
  11. core \- process core file
  12. .SH DESCRIPTION
  13. .sp
  14. .LP
  15. The operating system writes out a core file for a process when the process is
  16. terminated due to receiving certain signals. A core file is a disk copy of the
  17. contents of the process address space at the time the process received the
  18. signal, along with additional information about the state of the process. This
  19. information can be consumed by a debugger. Core files can also be generated by
  20. applying the \fBgcore\fR(1) utility to a running process.
  21. .sp
  22. .LP
  23. Typically, core files are produced following abnormal termination of a process
  24. resulting from a bug in the corresponding application. Whatever the cause, the
  25. core file itself provides invaluable information to the programmer or support
  26. engineer to aid in diagnosing the problem. The core file can be inspected using
  27. a debugger such as \fBdbx\fR(1) or \fBmdb\fR(1) or by applying one of the
  28. \fBproc\fR(1) tools.
  29. .sp
  30. .LP
  31. The operating system attempts to create up to two core files for each
  32. abnormally terminating process, using a global core file name pattern and a
  33. per-process core file name pattern. These patterns are expanded to determine
  34. the pathname of the resulting core files, and can be configured by
  35. \fBcoreadm\fR(1M). By default, the global core file pattern is disabled and not
  36. used, and the per-process core file pattern is set to \fBcore\fR. Therefore, by
  37. default, the operating system attempts to create a core file named \fBcore\fR
  38. in the process's current working directory.
  39. .sp
  40. .LP
  41. A process terminates and produces a core file whenever it receives one of the
  42. signals whose default disposition is to cause a core dump. The list of signals
  43. that result in generating a core file is shown in \fBsignal.h\fR(3HEAD).
  44. Therefore, a process might not produce a core file if it has blocked or
  45. modified the behavior of the corresponding signal. Additionally, no core dump
  46. can be created under the following conditions:
  47. .RS +4
  48. .TP
  49. .ie t \(bu
  50. .el o
  51. If normal file and directory access permissions prevent the creation or
  52. modification of the per-process core file pathname by the current process user
  53. and group ID. This test does not apply to the global core file pathname
  54. because, regardless of the UID of the process dumping core, the attempt to
  55. write the global core file is made as the superuser.
  56. .RE
  57. .RS +4
  58. .TP
  59. .ie t \(bu
  60. .el o
  61. Core files owned by the user \fBnobody\fR will not be produced. For example,
  62. core files generated for the superuser on an NFS directory are owned by
  63. \fBnobody\fR and are, therefore, not written.
  64. .RE
  65. .RS +4
  66. .TP
  67. .ie t \(bu
  68. .el o
  69. If the core file pattern expands to a pathname that contains intermediate
  70. directory components that do not exist. For example, if the global pattern is
  71. set to \fB/var/core/%n/core.%p\fR, and no directory \fB/var/core/`uname -n`\fR
  72. has been created, no global core files are produced.
  73. .RE
  74. .RS +4
  75. .TP
  76. .ie t \(bu
  77. .el o
  78. If the destination directory is part of a filesystem that is mounted read-only.
  79. .RE
  80. .RS +4
  81. .TP
  82. .ie t \(bu
  83. .el o
  84. If the resource limit \fBRLIMIT_CORE\fR has been set to \fB0\fR for the
  85. process, no per-process core file is produced. Refer to \fBsetrlimit\fR(2) and
  86. \fBulimit\fR(1) for more information on resource limits.
  87. .RE
  88. .RS +4
  89. .TP
  90. .ie t \(bu
  91. .el o
  92. If the core file name already exists in the destination directory and is not a
  93. regular file (that is, is a symlink, block or character special-file, and so
  94. forth).
  95. .RE
  96. .RS +4
  97. .TP
  98. .ie t \(bu
  99. .el o
  100. If the kernel cannot open the destination file \fBO_EXCL\fR, which can occur if
  101. same file is being created by another process simultaneously.
  102. .RE
  103. .RS +4
  104. .TP
  105. .ie t \(bu
  106. .el o
  107. If the process's effective user ID is different from its real user ID or if its
  108. effective group ID is different from its real group ID. Similarly, set-user-ID
  109. and set-group-ID programs do not produce core files as this could potentially
  110. compromise system security. These processes can be explicitly granted
  111. permission to produce core files using \fBcoreadm\fR(1M), at the risk of
  112. exposing secure information.
  113. .RE
  114. .sp
  115. .LP
  116. The core file contains all the process information pertinent to debugging:
  117. contents of hardware registers, process status, and process data. The format of
  118. a core file is object file specific.
  119. .sp
  120. .LP
  121. For ELF executable programs (see \fBa.out\fR(4)), the core file generated is
  122. also an ELF file, containing ELF program and file headers. The \fBe_type\fR
  123. field in the file header has type \fBET_CORE\fR. The program header contains an
  124. entry for every segment that was part of the process address space, including
  125. shared library segments. The contents of the mappings specified by
  126. \fBcoreadm\fR(1M) are also part of the core image. Each program header has its
  127. \fBp_memsz\fR field set to the size of the mapping. The program headers that
  128. represent mappings whose data is included in the core file have their
  129. \fBp_filesz\fR field set the same as \fBp_memsz\fR, otherwise \fBp_filesz\fR is
  130. \fBzero\fR.
  131. .sp
  132. .LP
  133. A mapping's data can be excluded due to the core file content settings (see
  134. \fBcoreadm\fR(1M)), due to a failure, or due to a signal received after
  135. core dump initiation but before its completion. If the data is excluded
  136. because of a failure, the program header entry will have the
  137. \fBPF_SUNW_FAILURE\fR flag
  138. set in its \fBp_flags\fR field; if the data is excluded because of a signal,
  139. the segment's \fBp_flags\fR field will have the \fBPF_SUNW_KILLED\fR
  140. flag set.
  141. .sp
  142. .LP
  143. The program headers of an \fBELF\fR core file also contain entries for two
  144. \fBNOTE\fR segments, each containing several note entries as described below.
  145. The note entry header and core file note type (\fBn_type\fR) definitions are
  146. contained in <\fBsys/elf.h\fR>. The first \fBNOTE\fR segment exists for binary
  147. compatibility with old programs that deal with core files. It contains
  148. structures defined in <\fBsys/old_procfs.h\fR>. New programs should recognize
  149. and skip this \fBNOTE\fR segment, advancing instead to the new \fBNOTE\fR
  150. segment. The old \fBNOTE\fR segment is deleted from core files in a future
  151. release.
  152. .sp
  153. .LP
  154. The old \fBNOTE\fR segment contains the following entries. Each has entry name
  155. \fB"CORE"\fR and presents the contents of a system structure:
  156. .sp
  157. .ne 2
  158. .na
  159. \fB\fBprpsinfo_t\fR\fR
  160. .ad
  161. .RS 16n
  162. \fBn_type\fR: \fBNT_PRPSINFO\fR. This entry contains information of interest to
  163. the \fBps\fR(1) command, such as process status, \fBCPU\fR usage, \fBnice\fR
  164. value, controlling terminal, user-ID, process-ID, the name of the executable,
  165. and so forth. The \fBprpsinfo_t\fR structure is defined in
  166. <\fBsys/old_procfs.h\fR>.
  167. .RE
  168. .sp
  169. .ne 2
  170. .na
  171. \fB\fBchar\fR array\fR
  172. .ad
  173. .RS 16n
  174. \fBn_type\fR: \fBNT_PLATFORM\fR. This entry contains a string describing the
  175. specific model of the hardware platform on which this core file was created.
  176. This information is the same as provided by \fBsysinfo\fR(2) when invoked with
  177. the command \fBSI_PLATFORM\fR.
  178. .RE
  179. .sp
  180. .ne 2
  181. .na
  182. \fB\fBauxv_t\fR array\fR
  183. .ad
  184. .RS 16n
  185. \fBn_type\fR: \fBNT_AUXV\fR. This entry contains the array of \fBauxv_t\fR
  186. structures that was passed by the operating system as startup information to
  187. the dynamic linker. Auxiliary vector information is defined in
  188. <\fBsys/auxv.h\fR>.
  189. .RE
  190. .sp
  191. .LP
  192. Following these entries, for each active (non-zombie) light-weight process
  193. (LWP) in the process, the old \fBNOTE\fR segment contains an entry with a
  194. \fBprstatus_t\fR structure, plus other optionally-present entries describing
  195. the LWP, as follows:
  196. .sp
  197. .ne 2
  198. .na
  199. \fB\fBprstatus_t\fR\fR
  200. .ad
  201. .RS 16n
  202. \fBn_type\fR: \fBNT_PRSTATUS\fR. This structure contains things of interest to
  203. a debugger from the operating system, such as the general registers, signal
  204. dispositions, state, reason for stopping, process-ID, and so forth. The
  205. \fBprstatus_t\fR structure is defined in <\fBsys/old_procfs.h\fR>.
  206. .RE
  207. .sp
  208. .ne 2
  209. .na
  210. \fB\fBprfpregset_t\fR\fR
  211. .ad
  212. .RS 16n
  213. \fBn_type\fR: \fBNT_PRFPREG\fR. This entry is present only if the \fBLWP\fR
  214. used the floating-point hardware. It contains the floating-point registers. The
  215. \fBprfpregset_t\fR structure is defined in <\fBsys/procfs_isa.h\fR>.
  216. .RE
  217. .sp
  218. .ne 2
  219. .na
  220. \fB\fBgwindows_t\fR\fR
  221. .ad
  222. .RS 16n
  223. \fBn_type\fR: \fBNT_GWINDOWS\fR. This entry is present only on a SPARC machine
  224. and only if the system was unable to flush all of the register windows to the
  225. stack. It contains all of the unspilled register windows. The \fBgwindows_t\fR
  226. structure is defined in <\fBsys/regset.h\fR>.
  227. .RE
  228. .sp
  229. .ne 2
  230. .na
  231. \fB\fBprxregset_t\fR\fR
  232. .ad
  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>.
  237. .RE
  238. .sp
  239. .LP
  240. The new \fBNOTE\fR segment contains the following entries. Each has entry name
  241. "\fBCORE\fR" and presents the contents of a system structure:
  242. .sp
  243. .ne 2
  244. .na
  245. \fB\fBpsinfo_t\fR\fR
  246. .ad
  247. .RS 20n
  248. \fBn_type\fR: \fBNT_PSINFO\fR. This structure contains information of interest
  249. to the \fBps\fR(1) command, such as process status, \fBCPU\fR usage, \fBnice\fR
  250. value, controlling terminal, user-ID, process-ID, the name of the executable,
  251. and so forth. The \fBpsinfo_t\fR structure is defined in <\fBsys/procfs.h\fR>.
  252. .RE
  253. .sp
  254. .ne 2
  255. .na
  256. \fB\fBpstatus_t\fR\fR
  257. .ad
  258. .RS 20n
  259. \fBn_type\fR: \fBNT_PSTATUS\fR. This structure contains things of interest to a
  260. debugger from the operating system, such as pending signals, state, process-ID,
  261. and so forth. The \fBpstatus_t\fR structure is defined in <\fBsys/procfs.h\fR>.
  262. .RE
  263. .sp
  264. .ne 2
  265. .na
  266. \fB\fBchar\fR array\fR
  267. .ad
  268. .RS 20n
  269. \fBn_type\fR: \fBNT_PLATFORM\fR. This entry contains a string describing the
  270. specific model of the hardware platform on which this core file was created.
  271. This information is the same as provided by \fBsysinfo\fR(2) when invoked with
  272. the command \fBSI_PLATFORM\fR.
  273. .RE
  274. .sp
  275. .ne 2
  276. .na
  277. \fB\fBauxv_t\fR array\fR
  278. .ad
  279. .RS 20n
  280. \fBn_type\fR: \fBNT_AUXV\fR. This entry contains the array of \fBauxv_t\fR
  281. structures that was passed by the operating system as startup information to
  282. the dynamic linker. Auxiliary vector information is defined in
  283. <\fBsys/auxv.h\fR>.
  284. .RE
  285. .sp
  286. .ne 2
  287. .na
  288. \fB\fBstruct utsname\fR\fR
  289. .ad
  290. .RS 20n
  291. \fBn_type\fR: \fBNT_UTSNAME\fR. This structure contains the system information
  292. that would have been returned to the process if it had performed a
  293. \fBuname\fR(2) system call prior to dumping core. The \fButsname\fR structure
  294. is defined in <\fBsys/utsname.h\fR>.
  295. .RE
  296. .sp
  297. .ne 2
  298. .na
  299. \fB\fBprcred_t\fR\fR
  300. .ad
  301. .RS 20n
  302. \fBn_type\fR: \fBNT_PRCRED\fR. This structure contains the process credentials,
  303. including the real, saved, and effective user and group IDs. The \fBprcred_t\fR
  304. structure is defined in <\fBsys/procfs.h\fR>. Following the structure is an
  305. optional array of supplementary group IDs. The total number of supplementary
  306. group IDs is given by the \fBpr_ngroups\fR member of the \fBprcred_t\fR
  307. structure, and the structure includes space for one supplementary group. If
  308. \fBpr_ngroups\fR is greater than 1, there is \fBpr_ngroups - 1\fR \fBgid_t\fR
  309. items following the structure; otherwise, there is no additional data.
  310. .RE
  311. .sp
  312. .ne 2
  313. .na
  314. \fB\fBchar array\fR\fR
  315. .ad
  316. .RS 20n
  317. \fBn_type\fR: \fBNT_ZONENAME\fR. This entry contains a string which describes
  318. the name of the zone in which the process was running. See \fBzones\fR(5). The
  319. information is the same as provided by \fBgetzonenamebyid\fR(3C) when invoked
  320. with the numerical ID returned by \fBgetzoneid\fR(3C).
  321. .RE
  322. .sp
  323. .ne 2
  324. .na
  325. \fB\fBprfdinfo_t\fR\fR
  326. .ad
  327. .RS 20n
  328. \fBn_type\fR: \fBNT_FDINFO\fR. This structure contains information about
  329. any open file descriptors, including the path, flags, and
  330. \fBstat\fR(2) information. The \fBprfdinfo_t\fR structure is defined in
  331. <\fBsys/procfs.h\fR>.
  332. .RE
  333. .sp
  334. .ne 2
  335. .na
  336. \fB\fBstruct ssd\fR array\fR
  337. .ad
  338. .RS 20n
  339. \fBn_type\fR: \fBNT_LDT\fR. This entry is present only on an 32-bit x86 machine
  340. and only if the process has set up a Local Descriptor Table (LDT). It contains
  341. an array of structures of type \fBstruct ssd\fR, each of which was typically
  342. used to set up the \fB%gs\fR segment register to be used to fetch the address
  343. of the current thread information structure in a multithreaded process. The
  344. \fBssd\fR structure is defined in <\fBsys/sysi86.h\fR>.
  345. .RE
  346. .sp
  347. .ne 2
  348. .na
  349. \fB\fBcore_content_t\fR\fR
  350. .ad
  351. .RS 20n
  352. \fBn_type\fR: \fBNT_CONTENT\fR. This optional entry indicates which parts of
  353. the process image are specified to be included in the core file. See
  354. \fBcoreadm\fR(1M).
  355. .RE
  356. .sp
  357. .LP
  358. Following these entries, for each active and zombie \fBLWP\fR in the process,
  359. the new \fBNOTE\fR segment contains an entry with an \fBlwpsinfo_t\fR structure
  360. plus, for a non-zombie LWP, an entry with an \fBlwpstatus_t\fR structure, plus
  361. other optionally-present entries describing the LWP, as follows. A zombie LWP
  362. is a non-detached LWP that has terminated but has not yet been reaped by
  363. another LWP in the same process.
  364. .sp
  365. .ne 2
  366. .na
  367. \fB\fBlwpsinfo_t\fR\fR
  368. .ad
  369. .RS 15n
  370. \fBn_type\fR: \fBNT_LWPSINFO\fR. This structure contains information of
  371. interest to the \fBps\fR(1) command, such as \fBLWP\fR status, \fBCPU\fR usage,
  372. \fBnice\fR value, \fBLWP-ID\fR, and so forth. The \fBlwpsinfo_t\fR structure is
  373. defined in <\fBsys/procfs.h\fR>. This is the only entry present for a zombie
  374. LWP.
  375. .RE
  376. .sp
  377. .ne 2
  378. .na
  379. \fB\fBlwpstatus_t\fR\fR
  380. .ad
  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>.
  386. .RE
  387. .sp
  388. .ne 2
  389. .na
  390. \fB\fBgwindows_t\fR\fR
  391. .ad
  392. .RS 15n
  393. \fBn_type\fR: \fBNT_GWINDOWS\fR. This entry is present only on a SPARC machine
  394. and only if the system was unable to flush all of the register windows to the
  395. stack. It contains all of the unspilled register windows. The \fBgwindows_t\fR
  396. structure is defined in \fB<sys/regset.h>\fR\&.
  397. .RE
  398. .sp
  399. .ne 2
  400. .na
  401. \fB\fBprxregset_t\fR\fR
  402. .ad
  403. .RS 15n
  404. \fBn_type\fR: \fBNT_PRXREG\fR. This entry is present only if the machine has
  405. extra register state associated with it. It contains the extra register state.
  406. The \fBprxregset_t\fR structure is defined in \fB<sys/procfs_isa.h>\fR\&.
  407. .RE
  408. .sp
  409. .ne 2
  410. .na
  411. \fB\fBasrset_t\fR\fR
  412. .ad
  413. .RS 15n
  414. \fBn_type\fR: \fBNT_ASRS\fR. This entry is present only on a SPARC V9 machine
  415. and only if the process is a 64-bit process. It contains the ancillary state
  416. registers for the \fBLWP.\fR The \fBasrset_t\fR structure is defined in
  417. \fB<sys/regset.h>\fR\&.
  418. .RE
  419. .sp
  420. .ne 2
  421. .na
  422. \fB\fBpsinfo_t\fR\fR
  423. .ad
  424. .RS 15n
  425. \fBn_type\fR: \fBNT_SPYMASTER\fR. This entry is present only for an agent
  426. LWP and contains the \fBpsinfo_t\fR of the process that created the agent
  427. LWP. See the \fBproc\fR(4) description of the \fBspymaster\fR entry for
  428. more details.
  429. .RE
  430. .sp
  431. .LP
  432. Depending on the \fBcoreadm\fR(1M) settings, the section header of an ELF core
  433. file can contain entries for CTF, symbol table, and string table sections. The
  434. \fBsh_addr\fR fields are set to the base address of the first mapping of the
  435. load object that they came from to. This can be used to match those sections
  436. with the corresponding load object.
  437. .sp
  438. .LP
  439. The size of the core file created by a process can be controlled by the user
  440. (see \fBgetrlimit\fR(2)).
  441. .SH SEE ALSO
  442. .sp
  443. .LP
  444. \fBelfdump\fR(1), \fBgcore\fR(1), \fBmdb\fR(1), \fBproc\fR(1), \fBps\fR(1),
  445. \fBcoreadm\fR(1M), \fBgetrlimit\fR(2), \fBsetrlimit\fR(2), \fBsetuid\fR(2),
  446. \fBsysinfo\fR(2), \fBuname\fR(2), \fBgetzonenamebyid\fR(3C),
  447. \fBgetzoneid\fR(3C), \fBelf\fR(3ELF), \fBsignal.h\fR(3HEAD), \fBa.out\fR(4),
  448. \fBproc\fR(4), \fBzones\fR(5)
  449. .sp
  450. .LP
  451. \fIANSI C Programmer's Guide\fR