From 09959617c6b54d3a92e1d94feedce6a38066181c Mon Sep 17 00:00:00 2001 From: bbracker Date: Sun, 24 Oct 2021 15:18:44 -0700 Subject: [PATCH] update debugger script to new style --- .../testvector-generation/debug.gdb | 24 +++++++++++ .../testvector-generation/debug.sh | 20 ++++++++++ .../testvector-generation/debugBuildroot.sh | 40 ------------------- .../testvector-generation/gdbinit_debug | 18 --------- 4 files changed, 44 insertions(+), 58 deletions(-) create mode 100755 wally-pipelined/linux-testgen/testvector-generation/debug.gdb create mode 100755 wally-pipelined/linux-testgen/testvector-generation/debug.sh delete mode 100755 wally-pipelined/linux-testgen/testvector-generation/debugBuildroot.sh delete mode 100644 wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug diff --git a/wally-pipelined/linux-testgen/testvector-generation/debug.gdb b/wally-pipelined/linux-testgen/testvector-generation/debug.gdb new file mode 100755 index 00000000..dbdf274a --- /dev/null +++ b/wally-pipelined/linux-testgen/testvector-generation/debug.gdb @@ -0,0 +1,24 @@ +define debug + # Arguments + set $tcpPort=$arg0 + + # GDB config + set pagination off + set logging overwrite on + set logging redirect on + set confirm off + + # Connect to QEMU session + eval "target extended-remote :%d",$tcpPort + + # Symbol Files + file ../buildroot-image-output/vmlinux + + # Run until Linux login prompt + b do_idle + ignore 1 2 + c + + kill + q +end diff --git a/wally-pipelined/linux-testgen/testvector-generation/debug.sh b/wally-pipelined/linux-testgen/testvector-generation/debug.sh new file mode 100755 index 00000000..fc5549a2 --- /dev/null +++ b/wally-pipelined/linux-testgen/testvector-generation/debug.sh @@ -0,0 +1,20 @@ +#!/bin/bash +source genSettings.sh +tcpPort=1237 + +# Run without GDB +($customQemu \ +-M virt \ +-nographic \ +-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) + +# Run with GDB +#($customQemu \ +#-M virt \ +#-nographic -serial /dev/null \ +#-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 \ +#-gdb tcp::$tcpPort -S) \ +#& riscv64-unknown-elf-gdb -x debug.gdb -ex "debug $tcpPort" + diff --git a/wally-pipelined/linux-testgen/testvector-generation/debugBuildroot.sh b/wally-pipelined/linux-testgen/testvector-generation/debugBuildroot.sh deleted file mode 100755 index a51b975c..00000000 --- a/wally-pipelined/linux-testgen/testvector-generation/debugBuildroot.sh +++ /dev/null @@ -1,40 +0,0 @@ -# Oftentimes this script runs so long you'll go to sleep. -# But you don't want the script to die when your computer goes to sleep. -# So consider invoking this with nohup (i.e. "nohup ./logAllBuildroot.sh") -# You can run "tail -f nohup.out" to see what would've -# outputted to the terminal if you didn't use nohup - -customQemu="/courses/e190ax/qemu_sim/rv64_initrd/qemu_experimental/qemu/build/qemu-system-riscv64" -#customQemu="qemu-system-riscv64" -imageDir="../buildroot-image-output" -intermedDir="../linux-testvectors/intermediate-outputs" -outDir="../linux-testvectors" - -# =========== Debug the Process ========== -# Uncomment this version for QEMU debugging of kernel -# - good for poking around VM if it boots up -# - good for running QEMU commands (press "Ctrl-A" then "c" to open QEMU command prompt) -#$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 -# Uncomment this version for GDB debugging of kernel -# - attempts to load in symbols from "vmlinux" -# - good for looking at backtraces when Linux gets stuck for some reason -$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 -gdb tcp::1237 -S & riscv64-unknown-elf-gdb -x gdbinit_debug - -# Uncomment this version to generate qemu_output.txt -# - Uses GDB script -# - Logs raw QEMU output to qemu_output.txt -#($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::1237 -S 2> $intermedDir/qemu_output.txt) & riscv64-unknown-elf-gdb -x gdbinit_debug - -# Uncomment this version for parse_qemu.py debugging -# - Uses qemu_output.txt -# - Makes qemu_in_gdb_format.txt -# - Splits qemu_in_gdb_format.txt into chunks of 100,000 instrs -#cat $intermedDir/qemu_output.txt | ./parse_qemu.py >$intermedDir/qemu_in_gdb_format.txt -#cd $intermedDir -#split -d -l 5000000 ./qemu_in_gdb_format.txt --verbose -#cd ../../testvector-generation - -# Uncomment this version for parse_gdb_output.py debugging -# - Uses qemu_in_gdb_format.txt -# - Makes testvectors -#cat $intermedDir/qemu_in_gdb_format.txt | ./parse_gdb_output.py "$outDir" diff --git a/wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug b/wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug deleted file mode 100644 index 621db22b..00000000 --- a/wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug +++ /dev/null @@ -1,18 +0,0 @@ -set pagination off -file ../buildroot-image-output/fw_jump.elf -file ../buildroot-image-output/vmlinux -target extended-remote :1237 -b *0x80200040 -c -#del 1 -#stepi 500 -#b irqchip_plic_warm_init -#c -#b plic_init -#c -#b do_idle -#c -#b *0xffffffff80202e58 -#ignore 2 87 -#c -#del 2