Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get a core dump of a running process and its symbol table?

Is it possible to get gdb or use some other tools to create a core dump of a running process and it's symbol table? It would be great if there's a way to do this without terminating the process.

If this is possible, what commands would you use? (I'm trying to do this on a Linux box)

like image 682
readonly Avatar asked Sep 16 '08 00:09

readonly


People also ask

What generates a core dump?

Core dumps are generated when the process receives certain signals, such as SIGSEGV, which the kernels sends it when it accesses memory outside its address space. Typically that happens because of errors in how pointers are used. That means there's a bug in the program. The core dump is useful for finding the bug.

How do I view a core dump?

In a terminal, run sleep 30 to start a process sleeping for 30 seconds. While it is running, press Ctrl + \ to force a core dump. You'll now see a core file in the directory you are in.

What is core dump in programming?

A core dump is the printing or the copying to a more permanent medium (such as a hard disk ) the contents of random access memory ( RAM ) at one moment in time. One can think of it as a full-length "snapshot" of RAM. A core dump is taken mainly for the purpose of debugging a program.

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.


1 Answers

 $ gdb --pid=26426 (gdb) gcore Saved corefile core.26426 (gdb) detach 
like image 52
DustinB Avatar answered Sep 18 '22 12:09

DustinB