This commit is contained in:
David Harris 2021-10-03 00:43:47 -04:00
commit a15068717b
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
#customQemu="qemu-system-riscv64"
instrs=8500000
instrs=50000000
imageDir="../buildroot-image-output"
outDir="../linux-testvectors/checkpoint$instrs"
@ -24,9 +24,11 @@ if [[ $REPLY =~ ^[Yy]$ ]]
then
mkdir -p $outDir
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\""
./fix_mem.py "$intermedDir/ramGDB.txt" "$outDir/ram.txt"
# Post-Process GDB outputs
./parseState.py "$outDir"
./fix_mem.py "$intermedDir/ramGDB.txt" "$outDir/ram.txt"
else
echo "You can change the number of instructions by editing the \"instrs\" variable in this script."
echo "Have a nice day!"

View File

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

View File

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