bugfix argument passing to GDB script; remove outdated GDB script

This commit is contained in:
bbracker 2021-10-26 12:43:42 -07:00
parent f39a509b5b
commit 1409dc48a8
3 changed files with 5 additions and 69 deletions

View File

@ -1,64 +0,0 @@
define genCheckpoint
# GDB config
set pagination off
set logging overwrite on
set logging redirect on
set confirm off
# QEMU must also use TCP port 1240
target extended-remote :1240
# QEMU Config
maintenance packet Qqemu.PhyMemMode:1
# Symbol file
file ../buildroot-image-output/vmlinux
# Argument Parsing
set $tcpPort=$arg0
set $instrCount=$arg1
set $statePath=$arg2
set $ramPath=$arg3
set $checkPC=$arg4
set $checkPCoccurences=$arg5
eval "set $statePath = \"%s/stateGDB.txt\"", $statePath
eval "set $ramPath = \"%s/ramGDB.txt\"", $ramPath
# Step over reset vector into actual code
stepi 100
# Set breakpoint for where to stop
b do_idle
# Proceed to checkpoint
printf "GDB proceeding to checkpoint at %d instrs\n", $instrCount
#stepi $instrCount-1000
b *$checkPC
ignore 2 $checkPCoccurences
c
printf "Reached checkpoint at %d instrs\n", $instrCount
# Log all registers to a file
printf "GDB storing state to %s\n", $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
eval "set logging file %s", $ramPath
set logging on
x/134217728xb 0x80000000
set logging off
# Continue to checkpoint; stop on the 3rd time
# Should reach login prompt by then
printf "GDB continuing execution to login prompt\n"
ignore 1 2
c
printf "GDB reached login prompt!\n"
kill
q
end

View File

@ -1,4 +1,4 @@
define genCheckpoint
define genCheckpoint
# GDB config
set pagination off
set logging overwrite on
@ -8,7 +8,7 @@ define genCheckpoint
# Argument Parsing
set $tcpPort=$arg0
set $instrCount=$arg1
set $statePath=$arg1
set $statePath=$arg2
set $ramPath=$arg2
set $checkPC=$arg3
set $checkPCoccurences=$arg4
@ -31,7 +31,7 @@ define genCheckpoint
# Proceed to checkpoint
printf "GDB proceeding to checkpoint at %d instrs\n", $instrCount
#stepi $instrCount-1000
b *$checkPC
eval "b *0x%s",$checkPC
ignore 2 $checkPCoccurences
c

View File

@ -3,7 +3,7 @@
source genSettings.sh
tcpPort=1236
instrs=50000000
instrs=10000000
checkOutDir="$outDir/checkpoint$instrs"
checkIntermedDir="$checkOutDir/intermediate-outputs"
@ -28,7 +28,7 @@ then
-bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio \
-singlestep -rtc clock=vm -icount shift=1,align=off,sleep=on,rr=replay,rrfile="$intermedDir/$recordFile" \
-gdb tcp::$tcpPort -S) \
& riscv64-unknown-elf-gdb -quiet -x genCheckpoint.gdb -ex "genCheckpoint $tcpPort $instrs \"$checkIntermedDir\" 0x$pc $occurences"
& riscv64-unknown-elf-gdb -x genCheckpoint.gdb -ex "genCheckpoint $tcpPort $instrs \"$checkIntermedDir\" \"$pc\" $occurences"
# Post-Process GDB outputs
./parseState.py "$checkOutDir"
./fix_mem.py "$checkIntermedDir/ramGDB.txt" "$checkOutDir/ram.txt"