How to obtain a core file without restarting an application?
https://access.redhat.com/solutions/9952
- Red Hat Enterprise Linux
问题
- How to obtain a core file without restarting an application?
- How an application core can be generated when a process is not crashing?
- How to create an application core when process core size is set to 0?
决议
-
The
gcorecommand can be used to obtain the core file without causing the application to abort using the following procedure:- Ensure that the
gdbpackage is installed. - Run the application.
-
Execute the gcore command to generate a core file (like core.pid) from the application in the current directory:
$ gcore (pid of the process)
- Ensure that the
-
The core file will be outputted to the present working directory.
- Note :
- The
gcorecommand runsgdband attaches to the process, causing the process to enterTstatus. However, the process should try to continue to run after gdb finishes collecting a core. - One point to remember is that with
gcorewe can't get a coredump of a kernel process. Becausekernelprocesses are immune to system call tracing,ptracewhich thegcorecommand uses. When we issue agcoreto a pid, we are usingPTRACE_ATTACH. When a parent process traces a child process, it usesPTRACE_TRACEME. See the man page ofptracefor more details.
- The

博客围绕不重启应用获取核心文件展开,提出了在进程未崩溃、进程核心大小设为0时如何生成应用核心的问题。给出决议,可使用gcore命令,按确保相关包安装、运行应用、执行命令的步骤获取核心文件,还指出该命令使用的注意事项。
1269

被折叠的 条评论
为什么被折叠?



