xref: /freebsd/usr.bin/gcore/gcore.1 (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
19b50d902SRodney W. Grimes.\" Copyright (c) 1983, 1990, 1992, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
69b50d902SRodney W. Grimes.\" are met:
79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
89b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
119b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
139b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
149b50d902SRodney W. Grimes.\"    without specific prior written permission.
159b50d902SRodney W. Grimes.\"
169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269b50d902SRodney W. Grimes.\" SUCH DAMAGE.
279b50d902SRodney W. Grimes.\"
2873e8f06aSKonstantin Belousov.Dd April 24, 2021
299b50d902SRodney W. Grimes.Dt GCORE 1
3062500372SRuslan Ermilov.Os
319b50d902SRodney W. Grimes.Sh NAME
329b50d902SRodney W. Grimes.Nm gcore
339b50d902SRodney W. Grimes.Nd get core images of running process
349b50d902SRodney W. Grimes.Sh SYNOPSIS
35a5bf6586SPhilippe Charnier.Nm
361d73ef97SAttilio Rao.Op Fl f
3773e8f06aSKonstantin Belousov.Op Fl k
389b50d902SRodney W. Grimes.Op Fl c Ar core
393898680cSPhilippe Charnier.Op Ar executable
4049ee7af6SDag-Erling Smørgrav.Ar pid
419b50d902SRodney W. Grimes.Sh DESCRIPTION
423898680cSPhilippe CharnierThe
433898680cSPhilippe Charnier.Nm
443898680cSPhilippe Charnierutility creates a core image of the specified process,
459b50d902SRodney W. Grimessuitable for use with
46*3c405c7eSJens Schweikhardt.Xr gdb 1 Pq Pa ports/devel/gdb .
479b50d902SRodney W. GrimesBy default, the core is written to the file
489b50d902SRodney W. Grimes.Dq Pa core.<pid> .
4949ee7af6SDag-Erling SmørgravThe process identifier,
509b50d902SRodney W. Grimes.Ar pid ,
5187faa07bSSheldon Hearnmust be given on the command line.
529b50d902SRodney W. Grimes.Pp
533898680cSPhilippe CharnierThe following options are available:
549b50d902SRodney W. Grimes.Bl -tag -width indent
559b50d902SRodney W. Grimes.It Fl c
569b50d902SRodney W. GrimesWrite the core file to the specified file instead of
579b50d902SRodney W. Grimes.Dq Pa core.<pid> .
581d73ef97SAttilio Rao.It Fl f
5973e8f06aSKonstantin BelousovDumps all available segments, excluding only malformed and undumpable
6073e8f06aSKonstantin Belousovsegments.
61581499c3SJohn BaldwinUnlike the default invocation, this flag dumps mappings of devices which
62581499c3SJohn Baldwinmay invalidate the state of device transactions or trigger other unexpected
63581499c3SJohn Baldwinbehavior.
64581499c3SJohn BaldwinAs a result, this flag should only be used when the behavior of the
65581499c3SJohn Baldwinapplication and any devices it has mapped is fully understood and any side
66581499c3SJohn Baldwineffects can be controlled or tolerated.
6773e8f06aSKonstantin Belousov.It Fl k
6873e8f06aSKonstantin BelousovUse the
6973e8f06aSKonstantin Belousov.Xr ptrace 2
7073e8f06aSKonstantin Belousov.Dv PT_COREDUMP
7173e8f06aSKonstantin Belousovkernel facility to write the core dump, instead of reading the process'
7273e8f06aSKonstantin Belousovmemory and constructing the dump file in
7373e8f06aSKonstantin Belousov.Nm
7473e8f06aSKonstantin Belousovitself.
7573e8f06aSKonstantin BelousovThis is faster, and the dump is written by the
7673e8f06aSKonstantin Belousovsame kernel code that writes core dumps upon fatal signals.
779b50d902SRodney W. Grimes.El
789b50d902SRodney W. Grimes.Sh FILES
799b50d902SRodney W. Grimes.Bl -tag -width /var/log/messages -compact
809b50d902SRodney W. Grimes.It Pa core.<pid>
813898680cSPhilippe Charnierthe core image
82390f1a74SRuslan Ermilov.El
839b50d902SRodney W. Grimes.Sh HISTORY
843898680cSPhilippe CharnierA
853898680cSPhilippe Charnier.Nm
863898680cSPhilippe Charnierutility appeared in
87c0b0bcf4SMike Pritchard.Bx 4.2 .
889b50d902SRodney W. Grimes.Sh BUGS
892e7ecbfbSAttilio RaoBecause of the
902e7ecbfbSAttilio Rao.Xr ptrace 2
912e7ecbfbSAttilio Raousage
92a5bf6586SPhilippe Charnier.Nm
93581499c3SJohn Baldwinmay not work with processes which are actively being investigated with
942e7ecbfbSAttilio Rao.Xr truss 1
952e7ecbfbSAttilio Raoor
96*3c405c7eSJens Schweikhardt.Xr gdb 1 Pq Pa ports/devel/gdb .
972e7ecbfbSAttilio RaoAdditionally, interruptable sleeps may exit with EINTR.
989b50d902SRodney W. Grimes.Pp
993898680cSPhilippe CharnierThe
1003898680cSPhilippe Charnier.Nm
1013898680cSPhilippe Charnierutility is not compatible with the original
102c0b0bcf4SMike Pritchard.Bx 4.2
103c0b0bcf4SMike Pritchardversion.
104