diff --git a/.gitignore b/.gitignore index 353977d1..3e023b15 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ wally-pipelined/linux-testgen/nohup* wally-pipelined/linux-testgen/x* !wally-pipelined/linux-testgen/linux-testvectors/tvCopier.py !wally-pipelined/linux-testgen/linux-testvectors/tvLinker.sh +!wally-pipelined/linux-testgen/linux-testvectors/intermediate-outputs +wally-pipelined/linux-testgen/linux-testvectors/intermediate-outputs/* +!wally-pipelined/linux-testgen/linux-testvectors/intermediate-outputs/git_create_dir.txt wally-pipelined/linux-testgen/buildroot/ wally-pipelined/linux-testgen/buildroot-image-output wally-pipelined/linux-testgen/buildroot-config-src/main.config.old diff --git a/wally-pipelined/linux-testgen/linux-testvectors/intermediate-outputs/git_create_dir.txt b/wally-pipelined/linux-testgen/linux-testvectors/intermediate-outputs/git_create_dir.txt new file mode 100644 index 00000000..8b0068e8 --- /dev/null +++ b/wally-pipelined/linux-testgen/linux-testvectors/intermediate-outputs/git_create_dir.txt @@ -0,0 +1 @@ +This file only exists so that git will create ./. diff --git a/wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug b/wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug index b5791934..c7a03428 100644 --- a/wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug +++ b/wally-pipelined/linux-testgen/testvector-generation/gdbinit_debug @@ -1,3 +1,3 @@ file ../buildroot-image-output/vmlinux set pagination off -target extended-remote :1234 +target extended-remote :1236 diff --git a/wally-pipelined/linux-testgen/testvector-generation/gdbinit_qemulog b/wally-pipelined/linux-testgen/testvector-generation/gdbinit_qemulog index ad9d9351..f4318ad1 100755 --- a/wally-pipelined/linux-testgen/testvector-generation/gdbinit_qemulog +++ b/wally-pipelined/linux-testgen/testvector-generation/gdbinit_qemulog @@ -1,6 +1,7 @@ set pagination off -target extended-remote :1234 -b *0xffffffe00020144e +target extended-remote :1236 +file ../buildroot-image-output/vmlinux +b arch_cpu_idle c c c diff --git a/wally-pipelined/linux-testgen/testvector-generation/logAllBuildroot.sh b/wally-pipelined/linux-testgen/testvector-generation/logAllBuildroot.sh index 035613c5..797b9f7d 100755 --- a/wally-pipelined/linux-testgen/testvector-generation/logAllBuildroot.sh +++ b/wally-pipelined/linux-testgen/testvector-generation/logAllBuildroot.sh @@ -11,16 +11,19 @@ intermedDir="../linux-testvectors/intermediate-outputs" outDir="../linux-testvectors" # =========== Debug the Process ========== -# Uncomment this version for GDB/QEMU debugging -# - Opens up GDB interactively -# - 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 -s -S & riscv64-unknown-elf-gdb -x gdbinit_debug -#($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -d nochain,cpu,in_asm -serial /dev/null -singlestep -s -S 2> $intermedDir/qemu_output.txt) & riscv64-unknown-elf-gdb +# 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 +# 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 -gdb tcp::1236 -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 -d nochain,cpu,in_asm -serial /dev/null -singlestep -s -S 2> $intermedDir/qemu_output.txt) & riscv64-unknown-elf-gdb -x gdbinit_qemulog_debug +#($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -d nochain,cpu,in_asm -serial /dev/null -singlestep -gdb tcp::1236 -S 2> $intermedDir/qemu_output.txt) & riscv64-unknown-elf-gdb -x gdbinit_qemulog_debug # Uncomment this version for parse_qemu.py debugging # - Uses qemu_output.txt @@ -33,10 +36,9 @@ $customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Ima # 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" +# - Makes testvectors#cat $intermedDir/qemu_in_gdb_format.txt | ./parse_gdb_output.py "$outDir" # =========== Just Do the Thing ========== # Uncomment this version for the whole thing # - Logs info needed by buildroot testbench -#($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -d nochain,cpu,in_asm -serial /dev/null -singlestep -s -S 2>&1 >/dev/null | ./parse_qemu.py | ./parse_gdb_output.py "$outdir") & riscv64-unknown-elf-gdb -x gdbinit_qemulog +($customQemu -M virt -nographic -bios $imageDir/fw_jump.elf -kernel $imageDir/Image -append "root=/dev/vda ro" -initrd $imageDir/rootfs.cpio -d nochain,cpu,in_asm -serial /dev/null -singlestep -gdb tcp::1236 -S 2>&1 >/dev/null | ./parse_qemu.py | ./parse_gdb_output.py "$outDir") & riscv64-unknown-elf-gdb -x gdbinit_qemulog diff --git a/wally-pipelined/linux-testgen/testvector-generation/parse_gdb_output.py b/wally-pipelined/linux-testgen/testvector-generation/parse_gdb_output.py index 7e48fa63..910358a9 100755 --- a/wally-pipelined/linux-testgen/testvector-generation/parse_gdb_output.py +++ b/wally-pipelined/linux-testgen/testvector-generation/parse_gdb_output.py @@ -9,7 +9,7 @@ csrs = ['fcsr','mcause','mcounteren','medeleg','mepc','mhartid','mideleg','mie', list(map(csrs.remove, ['fcsr','mhartid','pmpcfg0','pmpaddr0','mip'])) #output_path = '/courses/e190ax/busybear_boot_new/' #output_path = '/courses/e190ax/buildroot_boot/' -output_path = sys.argv[1] +output_path = sys.argv[1]+'/' print(f'output dir: {output_path}') instrs = -1 try: