mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
remove checkpoint trace generation since that requires qemu hacking and because we are able to generate the whole trace on VLSI
This commit is contained in:
parent
bb90644fb2
commit
742b9d884d
@ -1,53 +0,0 @@
|
|||||||
From f9882bd274bde82d8c38a9c31692b6ee33d8cd9a Mon Sep 17 00:00:00 2001
|
|
||||||
From: root <root@tera.eng.hmc.edu>
|
|
||||||
Date: Mon, 28 Feb 2022 22:48:29 +0000
|
|
||||||
Subject: [PATCH] bens hack to turn on logging mid-execution using GDB
|
|
||||||
|
|
||||||
---
|
|
||||||
gdbstub.c | 23 +++++++++++++++++++++++
|
|
||||||
1 file changed, 23 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/gdbstub.c b/gdbstub.c
|
|
||||||
index 141d7bc4ec..98ecce1b67 100644
|
|
||||||
--- a/gdbstub.c
|
|
||||||
+++ b/gdbstub.c
|
|
||||||
@@ -2317,6 +2317,23 @@ static void handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx)
|
|
||||||
}
|
|
||||||
put_packet("OK");
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+static void handle_set_qemu_logging(GArray *params, void *user_ctx)
|
|
||||||
+{
|
|
||||||
+ if (!params->len) {
|
|
||||||
+ put_packet("E22");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ int log_mask;
|
|
||||||
+ if (!get_param(params, 0)->val_ul) {
|
|
||||||
+ log_mask = 0;
|
|
||||||
+ } else {
|
|
||||||
+ log_mask = CPU_LOG_TB_IN_ASM | CPU_LOG_INT | CPU_LOG_TB_CPU | CPU_LOG_TB_NOCHAIN;
|
|
||||||
+ }
|
|
||||||
+ qemu_set_log(log_mask);
|
|
||||||
+ put_packet("OK");
|
|
||||||
+}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const GdbCmdParseEntry gdb_gen_query_set_common_table[] = {
|
|
||||||
@@ -2430,6 +2447,12 @@ static const GdbCmdParseEntry gdb_gen_set_table[] = {
|
|
||||||
.cmd_startswith = 1,
|
|
||||||
.schema = "l0"
|
|
||||||
},
|
|
||||||
+ {
|
|
||||||
+ .handler = handle_set_qemu_logging,
|
|
||||||
+ .cmd = "qemu.Logging:",
|
|
||||||
+ .cmd_startswith = 1,
|
|
||||||
+ .schema = "l0"
|
|
||||||
+ },
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/python3
|
#! /usr/bin/python3
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if len(sys.argv) != 9:
|
if len(sys.argv) != 8:
|
||||||
sys.exit("""Error createGenCheckpointScript.py expects 7 args:
|
sys.exit("""Error createGenCheckpointScript.py expects 7 args:
|
||||||
<TCP port number>
|
<TCP port number>
|
||||||
<path to vmlinux>
|
<path to vmlinux>
|
||||||
@ -9,8 +9,7 @@ if len(sys.argv) != 9:
|
|||||||
<path to GDB checkpoint state dump>
|
<path to GDB checkpoint state dump>
|
||||||
<path to GDB ram dump>
|
<path to GDB ram dump>
|
||||||
<checkpoint pc address>
|
<checkpoint pc address>
|
||||||
<number of times pc has already been hit before checkpoint>
|
<number of times pc has already been hit before checkpoint>""")
|
||||||
<whether to generate a trace after hitting checkpoint>""")
|
|
||||||
|
|
||||||
tcpPort=sys.argv[1]
|
tcpPort=sys.argv[1]
|
||||||
vmlinux=sys.argv[2]
|
vmlinux=sys.argv[2]
|
||||||
@ -19,7 +18,6 @@ statePath=sys.argv[4]
|
|||||||
ramPath=sys.argv[5]
|
ramPath=sys.argv[5]
|
||||||
checkPC=sys.argv[6]
|
checkPC=sys.argv[6]
|
||||||
checkPCoccurences=sys.argv[7]
|
checkPCoccurences=sys.argv[7]
|
||||||
genTrace=sys.argv[8]
|
|
||||||
|
|
||||||
GDBscript = f"""
|
GDBscript = f"""
|
||||||
# GDB config
|
# GDB config
|
||||||
@ -56,20 +54,7 @@ set logging off
|
|||||||
# Log main memory to a file
|
# Log main memory to a file
|
||||||
print "GDB storing RAM to {ramPath}\\n"
|
print "GDB storing RAM to {ramPath}\\n"
|
||||||
dump binary memory {ramPath} 0x80000000 0xffffffff
|
dump binary memory {ramPath} 0x80000000 0xffffffff
|
||||||
"""
|
|
||||||
if (genTrace=="1"):
|
|
||||||
GDBscript+=\
|
|
||||||
"""
|
|
||||||
# Generate Trace Until End
|
|
||||||
maintenance packet Qqemu.Logging:1
|
|
||||||
# Do this by setting an impossible breakpoint
|
|
||||||
b *0x1000
|
|
||||||
del 1
|
|
||||||
c
|
|
||||||
"""
|
|
||||||
else:
|
|
||||||
GDBscript+=\
|
|
||||||
"""
|
|
||||||
kill
|
kill
|
||||||
q
|
q
|
||||||
"""
|
"""
|
||||||
|
@ -6,12 +6,11 @@ recordFile="$tvDir/all.qemu"
|
|||||||
traceFile="$tvDir/all.txt"
|
traceFile="$tvDir/all.txt"
|
||||||
|
|
||||||
# Parse Commandline Arg
|
# Parse Commandline Arg
|
||||||
if [ "$#" -ne 2 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "genCheckpoint requires 2 arguments: <num instrs> <whether to genTrace>" >&2
|
echo "genCheckpoint requires 1 argument: <num instrs>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
instrs=$1
|
instrs=$1
|
||||||
genTrace=$2
|
|
||||||
if ! [ "$instrs" -eq "$instrs" ] 2> /dev/null
|
if ! [ "$instrs" -eq "$instrs" ] 2> /dev/null
|
||||||
then
|
then
|
||||||
echo "Error expected integer number of instructions, got $instrs" >&2
|
echo "Error expected integer number of instructions, got $instrs" >&2
|
||||||
@ -25,14 +24,8 @@ rawStateFile="$checkPtDir/stateGDB.txt"
|
|||||||
rawRamFile="$checkPtDir/ramGDB.bin"
|
rawRamFile="$checkPtDir/ramGDB.bin"
|
||||||
ramFile="$checkPtDir/ram.bin"
|
ramFile="$checkPtDir/ram.bin"
|
||||||
|
|
||||||
if [ $genTrace -eq "1" ]; then
|
|
||||||
read -p "This scripts is going to create a checkpoint at $instrs instrs.
|
|
||||||
AND it's going to start generating a trace at that checkpoint.
|
|
||||||
Is that what you wanted? (y/n) " -n 1 -r
|
|
||||||
else
|
|
||||||
read -p "This scripts is going to create a checkpoint at $instrs instrs.
|
read -p "This scripts is going to create a checkpoint at $instrs instrs.
|
||||||
Is that what you wanted? (y/n) " -n 1 -r
|
Is that what you wanted? (y/n) " -n 1 -r
|
||||||
fi
|
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
then
|
then
|
||||||
@ -63,7 +56,7 @@ then
|
|||||||
echo "It occurs ${occurences} times before the ${instrs}th instr."
|
echo "It occurs ${occurences} times before the ${instrs}th instr."
|
||||||
|
|
||||||
# Create GDB script because GDB is terrible at handling arguments / variables
|
# Create GDB script because GDB is terrible at handling arguments / variables
|
||||||
./createGenCheckpointScript.py $tcpPort $imageDir/vmlinux $instrs $rawStateFile $rawRamFile $pc $occurences $genTrace
|
./createGenCheckpointScript.py $tcpPort $imageDir/vmlinux $instrs $rawStateFile $rawRamFile $pc $occurences
|
||||||
# GDB+QEMU
|
# GDB+QEMU
|
||||||
echo "Starting QEMU in replay mode with attached GDB script at $(date +%H:%M:%S)"
|
echo "Starting QEMU in replay mode with attached GDB script at $(date +%H:%M:%S)"
|
||||||
(qemu-system-riscv64 \
|
(qemu-system-riscv64 \
|
||||||
@ -81,10 +74,8 @@ then
|
|||||||
echo "Changing Endianness at $(date +%H:%M:%S)"
|
echo "Changing Endianness at $(date +%H:%M:%S)"
|
||||||
make fixBinMem
|
make fixBinMem
|
||||||
./fixBinMem "$rawRamFile" "$ramFile"
|
./fixBinMem "$rawRamFile" "$ramFile"
|
||||||
if [ $genTrace -ne "1" ]; then
|
|
||||||
echo "Copying over a truncated trace"
|
echo "Copying over a truncated trace"
|
||||||
tail -n+$instrs $traceFile > $outTraceFile
|
tail -n+$instrs $traceFile > $outTraceFile
|
||||||
fi
|
|
||||||
read -p "Checkpoint completed at $(date +%H:%M:%S)" -n 1 -r
|
read -p "Checkpoint completed at $(date +%H:%M:%S)" -n 1 -r
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user