checkpoint generator bugfixes

This commit is contained in:
bbracker 2021-10-03 00:30:04 -04:00
parent f6ef8e5656
commit a202c705cd
3 changed files with 12 additions and 7 deletions

View File

@ -10,7 +10,7 @@ customQemu="/courses/e190ax/qemu_sim/rv64_initrd/qemu_experimental/qemu/build/qe
# use on other systems # use on other systems
#customQemu="qemu-system-riscv64" #customQemu="qemu-system-riscv64"
instrs=8500000 instrs=50000000
imageDir="../buildroot-image-output" imageDir="../buildroot-image-output"
outDir="../linux-testvectors/checkpoint$instrs" outDir="../linux-testvectors/checkpoint$instrs"
@ -24,9 +24,11 @@ if [[ $REPLY =~ ^[Yy]$ ]]
then then
mkdir -p $outDir mkdir -p $outDir
mkdir -p $intermedDir mkdir -p $intermedDir
# Simulate QEMU, parse QEMU trace, run GDB script which logs a bunch of data at the checkpoint
($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -rtc clock=vm -icount shift=1 -d nochain,cpu,in_asm -serial /dev/null -singlestep -gdb tcp::1240 -S 2>&1 1>&2 | ./parse_qemu.py | ./parseNew.py | ./remove_dup.awk > $intermedDir/rawTrace.txt) & riscv64-unknown-elf-gdb -x ./checkpoint.gdb -ex "createCheckpoint $instrs \"$intermedDir\"" ($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -rtc clock=vm -icount shift=1 -d nochain,cpu,in_asm -serial /dev/null -singlestep -gdb tcp::1240 -S 2>&1 1>&2 | ./parse_qemu.py | ./parseNew.py | ./remove_dup.awk > $intermedDir/rawTrace.txt) & riscv64-unknown-elf-gdb -x ./checkpoint.gdb -ex "createCheckpoint $instrs \"$intermedDir\""
./fix_mem.py "$intermedDir/ramGDB.txt" "$outDir/ram.txt" # Post-Process GDB outputs
./parseState.py "$outDir" ./parseState.py "$outDir"
./fix_mem.py "$intermedDir/ramGDB.txt" "$outDir/ram.txt"
else else
echo "You can change the number of instructions by editing the \"instrs\" variable in this script." echo "You can change the number of instructions by editing the \"instrs\" variable in this script."
echo "Have a nice day!" echo "Have a nice day!"

View File

@ -7,6 +7,9 @@ define createCheckpoint
# QEMU must also use TCP port 1240 # QEMU must also use TCP port 1240
target extended-remote :1240 target extended-remote :1240
# QEMU Config
maintenance packet Qqemu.PhyMemMode:1
# Argument Parsing # Argument Parsing
set $statePath=$arg1 set $statePath=$arg1
@ -29,14 +32,14 @@ define createCheckpoint
# Log all registers to a file # Log all registers to a file
printf "GDB storing state to %s\n", $statePath printf "GDB storing state to %s\n", $statePath
set logging file $statePath eval "set logging file %s", $statePath
set logging on set logging on
info all-registers info all-registers
set logging off set logging off
# Log main memory to a file # Log main memory to a file
printf "GDB storing RAM to %s\n", $ramPath printf "GDB storing RAM to %s\n", $ramPath
set logging file ../linux-testvectors/intermediate-outputs/ramGDB.txt eval "set logging file %s", $ramPath
set logging on set logging on
x/134217728xb 0x80000000 x/134217728xb 0x80000000
set logging off set logging off

View File

@ -1,5 +1,5 @@
#! /usr/bin/python3 #! /usr/bin/python3
import sys import sys, os
################ ################
# Helper Funcs # # Helper Funcs #
@ -29,8 +29,8 @@ print("Begin parsing state.")
# Parse Args # Parse Args
if len(sys.argv) != 2: if len(sys.argv) != 2:
sys.exit('Error parseState.py expects 1 arg:\n parseState.py <path_to_checkpoint_dir>') sys.exit('Error parseState.py expects 1 arg:\n parseState.py <path_to_checkpoint_dir>')
outDir = sys.argv[1] outDir = sys.argv[1]+'/'
stateGDBpath = outDir+'/intermediate-outputs/stateGDB1K.txt' stateGDBpath = outDir+'intermediate-outputs/stateGDB.txt'
if not os.path.exists(stateGDBpath): if not os.path.exists(stateGDBpath):
sys.exit('Error input file '+stateGDBpath+'not found') sys.exit('Error input file '+stateGDBpath+'not found')