Nightloader/i386/dump.bash

29 lines
568 B
Bash
Raw Normal View History

#!/usr/bin/env bash
if [[ -f "memory.dump" ]];
then
rm -f memory.dump
fi
if [[ -f "memory.bin" ]];
then
rm memory.bin
fi
if [[ ! -e "qmp.socket" ]];
then
echo "Couldn't find socket (file: 'qmp.socket')."
exit -1
fi
echo "dump-guest-memory memory.dump" | qmp-shell -H qmp.socket
echo "dump memory lower.bin 0 0xa0000" | gdb --core=memory.dump -q
echo "dump memory upper.bin 0xc0000 0x400000" | gdb --core=memory.dump -q
truncate memory.bin --size 64M
dd if=lower.bin of=memory.bin
dd if=upper.bin of=memory.bin seek=1536
rm lower.bin
rm upper.bin