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
  • 398,947
  • 96
  • 818
  • 769
Łukasz Lew
  • 48,526
  • 41
  • 139
  • 208
  • 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
  • 48,526
  • 41
  • 139
  • 208
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
  • 48,337
  • 13
  • 89
  • 105
1

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

Łukasz Lew
  • 48,526
  • 41
  • 139
  • 208
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
  • 38,306
  • 16
  • 108
  • 142