2024-07-18 23:51:28 +00:00
|
|
|
#!/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
|
2024-08-30 01:00:19 +00:00
|
|
|
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
|
2024-08-30 01:50:41 +00:00
|
|
|
dd if=upper.bin of=memory.bin seek=1536
|
2024-08-30 01:00:19 +00:00
|
|
|
|
|
|
|
rm lower.bin
|
|
|
|
rm upper.bin
|