Mawg
Mawg

Reputation: 40140

How to core dump a Linux program and continue running?

For purposes of my own, I would like to take a regular core dump of my running application - from within the applciation - but continue running the program.

How can I do so? The app has a single process, with multiple threads.

Google core dump looked promising, but is no longer supported. Is there another way?

Upvotes: 2

Views: 977

Answers (2)

sr3z
sr3z

Reputation: 410

You can use GDB

Let say I am running an app call matrix (a simple ncurses sample app that emulates the words flow). 

I can obtain the process id by using pgrep and pass to gcore like this:

    gcore `pgrep matrix`
The core file you obtain will be core.pid format like this:
     core.6129

http://linux.byexamples.com/archives/371/gcore-obtain-core-dump-of-current-running-application/

Upvotes: 0

David Schwartz
David Schwartz

Reputation: 182753

Call fork and then dump core in the forked process. This has one significant disadvantage -- you can't see the stacks of threads other than the one that called fork.

Upvotes: 1

Related Questions