mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 16:25:31 +00:00
Add new files for running criu-coredump via python 2 or 3
Previous commit added support for python3 in criu-coredump. For convenience, add two files (coredump-python2 and coredump-python3) that start criu-coredump with respective python version. Edit env.sh accordingly. Signed-off-by: Andrey Vyazovtsev <viazovtsev.av@phystech.edu>
This commit is contained in:
committed by
Andrei Vagin
parent
3180d35fa4
commit
1c866dbb51
39
coredump/coredump.py
Executable file
39
coredump/coredump.py
Executable file
@@ -0,0 +1,39 @@
|
||||
import argparse
|
||||
import os
|
||||
|
||||
import criu_coredump
|
||||
|
||||
def coredump(opts):
|
||||
generator = criu_coredump.coredump_generator()
|
||||
cores = generator(os.path.realpath(opts['in']))
|
||||
for pid in cores:
|
||||
if opts['pid'] and pid != opts['pid']:
|
||||
continue
|
||||
with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f:
|
||||
cores[pid].write(f)
|
||||
|
||||
|
||||
def main():
|
||||
desc = 'CRIU core dump'
|
||||
parser = argparse.ArgumentParser(description=desc,
|
||||
formatter_class=argparse.RawTextHelpFormatter)
|
||||
|
||||
parser.add_argument('-i',
|
||||
'--in',
|
||||
default = '.',
|
||||
help = 'directory where to get images from')
|
||||
parser.add_argument('-p',
|
||||
'--pid',
|
||||
type = int,
|
||||
help = 'generate coredump for specific pid(all pids py default)')
|
||||
parser.add_argument('-o',
|
||||
'--out',
|
||||
default = '.',
|
||||
help = 'directory to write coredumps to')
|
||||
|
||||
opts = vars(parser.parse_args())
|
||||
|
||||
coredump(opts)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Reference in New Issue
Block a user