Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

gcore(1)

名称

gcore - 获取正在运行的进程的核心映像

用法概要

gcore [-pgFR] [-o filename] [-c content] process-id...

描述

gcore 实用程序为每个指定的进程创建核心映像。缺省情况下,其进程 ID 为 process-id 的进程的核心映像文件名为 core.process-id

选项

支持以下选项:

–c content

使用指定的内容生成核心映像文件。内容说明使用的标记与 coreadm(8) 中使用的标记相同。–c 选项不适用于使用 –p–g 标志生成的核心。

–F

强制。抓取目标进程,即使另一进程已掌握了控制权。

–g

Produces core image files in the global core file repository with the global content as configured by coreadm(8).如果用户对全局核心文件系统信息库没有权限,则该命令会失败。

–o filename

Substitutes filename in place of core as the first part of the name of the core image files. filename can contain the same tokens to be expanded as the paths in coreadm(8).

–p

Produces a core image file in the process-specific location with the process-specific content for each process as configured by coreadm(8).如果用户对每进程核心文件系统信息库没有权限,则该命令会失败。

–P

缺省情况下,gcore 会考虑使用 memcntl(2) 发出的、当前在进程的地址空间中处于活动状态的所有删改请求。进程核心进行转储期间,对此类进程使用 gcore 时指定此标志将忽略所有活动的删改请求。

–R

Bring in the content of the process to memory before dumping its core.This is a best effort and pages read are not locked.For large processes, this option is expected to shorten the time they remain stopped, at the cost of increasing the total time of execution of the command.

操作数

支持下列操作数:

process-id

process ID

用法

使用 –F 标志时应谨慎。在一个被调试的进程上施加两个控制进程可能会导致混乱。仅当主控制进程(通常是调试器)已停止了被调试的进程,并且在应用 proc 工具的可疑时刻主控制进程未在执行任何操作,才能保证安全。

退出状态

将返回以下退出值:

0

成功时返回。

非零

失败时,例如进程 ID 不存在。

文件

core.process-id

核心映像

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
system/core-os
接口稳定性
请参见下文。

命令语法是 "Committed"(已确定)。输出格式是 "Uncommitted"(未确定)。

另请参见

kill(1), setrlimit(2), core(5), proc(5), attributes(7), memcntl(2), coreadm(8)

附注

gcore 不受使用 RLIMIT_CORE 值的 setrlimit(2) 系统调用影响。