Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a core dump even if the process is normally running? [duplicate]

Under Linux, when a process crashes, a core dump will be created.

However, I want to create a core dump when the process doesn't crash, but looks buggy. A remote expert need the core dump to analyze.

Under Windows, we can create a dump file of a process through task manager, and after that, the process is still running.

Is it possible under Linux?

like image 663
xmllmx Avatar asked Dec 21 '14 03:12

xmllmx


People also ask

What is difference between core dump and crash?

Core dump - Application use ,, Used to dump some Application core files, If was there any Application realted issues. crash dump -> This Used for both Application & System hardware & software failure.

Is core dump a debugging technique?

When an application crashes, you can arrange for its state to be saved to disk, in a core dump file, which can indicate where the error occurred in the source code, the contents of memory at the time of the error, and the values of any variables and expressions set at the time.


2 Answers

Call gdb, then

attach pid
gcore

where pid is the process id of the process in question.

like image 137
Wintermute Avatar answered Oct 14 '22 05:10

Wintermute


You can use gcore utility right from command line:

gcore [-o filename] pid

By the way, if you want to see only stack trace of the process, gstack utility will do the job.

Both utilities come with gdb.

like image 23
Evgeny Kluev Avatar answered Oct 14 '22 05:10

Evgeny Kluev