Difference between revisions of "Criu-coredump"

From CRIU
Jump to: navigation, search
(Fix page to describe current coredump statate)
 
Line 1: Line 1:
 
Generate valid core dump from CRIU images.
 
Generate valid core dump from CRIU images.
 
=== Description ===
 
=== Description ===
CRIU images contain lots of information about process state. In fact, it is sufficient enough to generate a
+
Criu-coredump is a tool that takes a directory with CRIU images and produces Elf cores.
valid core dump which can be later be used by gdb, for example. criu-coredump does exactly that, it takes a
 
directory with CRIU images and produces Elf core dumps.
 
  
Basically, you can use CRIU to checkpoint task when you need it (i.e. when it hangs, or when an error occures)
+
It consists of a python script(criu/coredump/criu-coredump) for cmdline use, as well as a python module(criu/coredump/criu_coredump) to manipulate generated cores on a deeper level.
or make your application call CRIU via one of its interfaces(CLI, RPC or C library) and then produce core dump
 
and inspect it via gdb.
 
  
To generate core dump of your application you don't even need to be a root, it is enough for you to be the owner
+
=== Prerequisites ===
of that task. For that all you have two choices: 1) Use CRIU service running and use [[RPC]] or [[C_API]]. It is
 
useful if you want your app to automatically call CRIU. 2) Use CRIU binary with suid bit set.
 
  
criu-coredump project provides both cmdline tool and python module(criu_coredump), so you can use it in your
+
As the main goal of CRIU is to be able to save process tree on disk to be restored later, the amount of information its images contain is much bigger than what is typically contained in a core dump(i.e. memory + few notes). That and the fact that CRIU provides a number of convenient API's, in theory gives anyone an ability to use CRIU for debugging their applications, i.e. like the abandoned google-coredumper allows you to generate core dumps at any time. But in practice, there are no tools that have native support for criu images, making it impossible to conveniently use them for such purpose. So it would be nice if we could convert criu images into much more common core dumps to be used with a great variety of available tools.
python apps.
 
  
 
=== Limitations ===
 
=== Limitations ===
Line 23: Line 16:
  
 
VVAR and VSYSCALL vmas are just filled with zeroes, as CRIU doesn't currently provide them. VVAR is a tricky one and gdb also has problems dumping it[https://lkml.org/lkml/2015/3/12/439]. VSYSCALL in theory could just be read from current process, so it should be quite easy to fix.
 
VVAR and VSYSCALL vmas are just filled with zeroes, as CRIU doesn't currently provide them. VVAR is a tricky one and gdb also has problems dumping it[https://lkml.org/lkml/2015/3/12/439]. VSYSCALL in theory could just be read from current process, so it should be quite easy to fix.
 
=== Installation ===
 
 
<pre>$ python setup.py install</pre>
 
  
 
=== Usage ===
 
=== Usage ===
  
 
<pre>
 
<pre>
criu-coredump [-h] [-i IN] [-p PID] [-o OUT]
+
criu-coredump [-h] [-i IN] [-p PID] [-o OUT]                        
 
+
                                                                           
optional arguments:
+
CRIU core dump                                                             
   -h, --help        show this help message and exit
+
                                                                           
   -i IN, --in IN    directory where to get images from.
+
optional arguments:                                                        
   -p PID, --pid PID  generate core dump of a process identified by PID.
+
   -h, --help        show this help message and exit                      
                    If not specified -- generating for each pid.
+
   -i IN, --in IN    directory where to get images from                    
   -o OUT, --out OUT  directory to write core dump to.
+
   -p PID, --pid PID  generate coredump for specific pid(all pids py default)
 +
   -o OUT, --out OUT  directory to write coredumps to                      
 
</pre>
 
</pre>
  
 
=== Project resources ===
 
=== Project resources ===
Project is located at [https://github.com/efiop/criu-coredump GitHub].
+
[https://asciinema.org/a/18936 Demo] of a previous version of criu-coredump, when it was planned to be a part of CRIT.
  
 
[[Category:Sub-projects]]
 
[[Category:Sub-projects]]

Latest revision as of 13:43, 12 July 2016

Generate valid core dump from CRIU images.

Description[edit]

Criu-coredump is a tool that takes a directory with CRIU images and produces Elf cores.

It consists of a python script(criu/coredump/criu-coredump) for cmdline use, as well as a python module(criu/coredump/criu_coredump) to manipulate generated cores on a deeper level.

Prerequisites[edit]

As the main goal of CRIU is to be able to save process tree on disk to be restored later, the amount of information its images contain is much bigger than what is typically contained in a core dump(i.e. memory + few notes). That and the fact that CRIU provides a number of convenient API's, in theory gives anyone an ability to use CRIU for debugging their applications, i.e. like the abandoned google-coredumper allows you to generate core dumps at any time. But in practice, there are no tools that have native support for criu images, making it impossible to conveniently use them for such purpose. So it would be nice if we could convert criu images into much more common core dumps to be used with a great variety of available tools.

Limitations[edit]

For now only x86_64 is supported. The matter of supporting other architectures supported by CRIU is to use proper constants in elf header and provide proper arch-dependent notes.

Some notes in coredump are not fullfilled(i.e. SIGINFO).

VVAR and VSYSCALL vmas are just filled with zeroes, as CRIU doesn't currently provide them. VVAR is a tricky one and gdb also has problems dumping it[1]. VSYSCALL in theory could just be read from current process, so it should be quite easy to fix.

Usage[edit]

criu-coredump [-h] [-i IN] [-p PID] [-o OUT]                         
                                                                            
CRIU core dump                                                              
                                                                            
optional arguments:                                                         
  -h, --help         show this help message and exit                        
  -i IN, --in IN     directory where to get images from                     
  -p PID, --pid PID  generate coredump for specific pid(all pids py default)
  -o OUT, --out OUT  directory to write coredumps to                        

Project resources[edit]

Demo of a previous version of criu-coredump, when it was planned to be a part of CRIT.