Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Core Dump Without Killing Process

Is it possible to generate a core dump without killing the process? If so, what is the command/signal to do so?

Thanks, Jim

like image 490
Jim Avatar asked Jun 11 '10 19:06

Jim


People also ask

Should I disable core dumps?

They are also known as memory dump, crash dump, system dump, or ABEND dump. However, core dumps may contain sensitive info—for example, passwords, user data such as PAN, SSN, or encryption keys. Hence, we must disable them on production Linux servers.

What causes core dump in Linux?

A core dump is a file that gets automatically generated by the Linux kernel after a program crashes. This file contains the memory, register values, and the call stack of an application at the point of crashing.


2 Answers

I had the best success with attaching gdb in batch mode to the running program, get a backtrace and then detach.

gdb --batch --quiet -ex "set pagination off" -ex "thread apply all bt"
-ex "detach" -ex "quit" pid pid_of_process
like image 111
bluepin Avatar answered Sep 19 '22 07:09

bluepin


See the 'gcore' command, part of GDB.

like image 39
janneb Avatar answered Sep 21 '22 07:09

janneb