7

I just want to dump core without stopping the program. This would be essentialy serializing a whole state of the program. A very convenient thing for debugging later.

Is it possible under linux?

skaffman
  • 390,936
  • 96
  • 800
  • 764
Łukasz Lew
  • 45,986
  • 40
  • 137
  • 203
  • This is actually a duplicate, see http://stackoverflow.com/questions/131439/how-can-a-c-program-produce-a-core-dump-of-itself-without-terminating – Artelius Oct 07 '09 at 11:42

4 Answers4

6

I found simple solution:

$gcore
usage:  gcore [-o filename] pid

It is distributed with gdb.

Łukasz Lew
  • 45,986
  • 40
  • 137
  • 203
2

I don't think this is exactly what you want (unless you want to pause the program while inspecting, or even modify the memory), but have a look at CryoPID.

Artelius
  • 46,971
  • 12
  • 87
  • 103
1

Even better!!! Gdb 7.0 have support for reversible debugging. And it was released yesterday, what a coincidence :D

Łukasz Lew
  • 45,986
  • 40
  • 137
  • 203
0

should be doable, at least /proc//smaps contains information of the process memory and the actual memory should be accessible via /dev/mem

I think you need to suspend the process to avoid corruption of the captured info, though.

Kimvais
  • 36,728
  • 16
  • 105
  • 138