Update QemuVectorTesting documentation Additions - Add gdb cli invocation as alternate to gdbgui Updates - Fix some spelling errors - Fix aliases to work with paths based on `$ROOTDIR` - Update paths (b/c some files moved and removed any absolute paths) Change-Id: Ic0cd347ee0c61489135f214820cdac0ad1fa76c5
diff --git a/QemuVectorTestingAndDebugging.md b/QemuVectorTestingAndDebugging.md index b0b50ef..620f411 100644 --- a/QemuVectorTestingAndDebugging.md +++ b/QemuVectorTestingAndDebugging.md
@@ -4,14 +4,16 @@ 1. [Build steps:](#build-steps) 2. [Start Qemu](#start-qemu) 3. [Exiting Qemu](#exiting-qemu) -2. [GDBGUI Setup](#gdbgui-setup) - 1. [Installating gdbgui](#installating-gdbgui) +2. [Running GDB](#running-gdb) + 1. [Use the following command to run GDB](#use-the-following-command-to-run-gdb) +3. [GDBGUI Setup](#gdbgui-setup) + 1. [Installing gdbgui](#installing-gdbgui) 2. [Running gdbgui](#running-gdbgui) 3. [gdbgui window](#gdbgui-window) -3. [GDB Usage](#gdb-usage) +4. [GDB Usage](#gdb-usage) 1. [Some Useful GDB instructions](#some-useful-gdb-instructions) -4. [Aliases for convenience](#aliases-for-convenience) -5. [Advanced Usage](#advanced-usage) +5. [Aliases for convenience](#aliases-for-convenience) +6. [Advanced Usage](#advanced-usage) 1. [Debugging Qemu](#debugging-qemu) ## Qemu Setup @@ -43,9 +45,19 @@ To exit qemu, in the same teriminal, press `Ctrl-a` then `Ctrl-x`. +## Running GDB + +### Use the following command to run GDB + +Run GDB to create a gdb session in the CLI: + +``` +$ROOTDIR/cache/toolchain_vp/bin/riscv32-unknown-elf-gdb $ROOTDIR/out/shodan/build-bin/sw/device/examples/hello_vector/hello_vector_sim_verilator.elf --eval-command "target remote :1234" +``` + ## GDBGUI Setup -### Installating gdbgui +### Installing gdbgui `python3 -m pip install gdbgui` @@ -54,7 +66,7 @@ Use the following command to begin gdbgui: ``` -gdbgui -g '$ROOTDIR/out/host/toolchain_vp/bin/riscv32-unknown-elf-gdb /usr/local/google/home/gkielian/shodan/out/shodan/build-bin/sw/device/examples/hello_vector/hello_vector_sim_verilator.elf --eval-command \"target remote :1234\"' +export PURE_PYTHON=1; gdbgui -g "$ROOTDIR/out/host/toolchain_vp/bin/riscv32-unknown-elf-gdb $ROOTDIR/out/shodan/build-bin/sw/device/examples/hello_vector/hello_vector_sim_verilator.elf --eval-command \"target remote :1234\"" ``` ### gdbgui window @@ -65,7 +77,6 @@  - ## GDB Usage With one of the gdb methods working, you can now step through and check @@ -88,7 +99,8 @@ terminal, and then these aliases can speed up the workflow: ``` -alias run_gdb="gdbgui -g '$ROOTDIR/out/host/toolchain_vp/bin/riscv32-unknown-elf-gdb /usr/local/google/home/gkielian/shodan/out/shodan/build-bin/sw/device/examples/hello_vector/hello_vector_sim_verilator.elf --eval-command \"target remote :1234\"'" +alias run_gdb="$ROOTDIR/cache/toolchain_vp/bin/riscv32-unknown-elf-gdb $ROOTDIR/out/shodan/build-bin/sw/device/examples/hello_vector/hello_vector_sim_verilator.elf --eval-command \"target remote :1234\"" +alias run_gdb_gui="export PURE_PYTHON=1; gdbgui -g '$ROOTDIR/cache/toolchain_vp/bin/riscv32-unknown-elf-gdb $ROOTDIR/out/shodan/build-bin/sw/device/examples/hello_vector/hello_vector_sim_verilator.elf --eval-command \"target remote :1234\"'" alias run_qemu="qemu-system-riscv32 -M opentitan -kernel $ROOTDIR/out/shodan/build-out/sw_shodan/device/examples/hello_vector/hello_vector_sim_verilator.elf -bios $ROOTDIR/out/shodan/build-bin/sw/device/boot_rom/boot_rom_fpga_nexysvideo.elf -nographic -cpu rv32,x-v=true,vlen=512,vext_spec=v1.0 -s -S" ``` @@ -103,4 +115,4 @@ Above starts up qemu with the debugger and breaks the simulator on the `vsetvl` instruction so that you can check the state of the cpu. -This may be useful when debugging qemu itself. \ No newline at end of file +This may be useful when debugging qemu itself.