Skip to content

Commit

Permalink
Updated qemu script to print gdb port, updated docs to match (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkohlbre committed May 14, 2020
1 parent 32122e9 commit a3094b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ add_custom_target("bootrom" ALL


###############################################################################
## COMPONENT: linux kernel
## COMPONENT: linux kernel
###############################################################################

add_custom_command(OUTPUT ${linux_wrkdir}/.config DEPENDS ${linux_defconfig} ${linux_wrkdir_exists}
Expand Down Expand Up @@ -312,7 +312,7 @@ add_custom_command(OUTPUT ${scripts}/run-qemu.sh DEPENDS ${scripts}
export HOST_PORT=\${HOST_PORT:=\"\$((3000 + RANDOM % 3000))\"}; \
echo \"**** Running QEMU SSH on port \${HOST_PORT} ****\"; \
export SMP=1; \
while [ \"\$1\" != \"\" ]; do if [ \"\$1\" = \"-debug\" ]; then DEBUG=\"-gdb tcp::\$((HOST_PORT + 1)) -S -d in_asm -D debug.log\"; fi; if [ \"\$1\" = \"-smp\" ]; then SMP=\"\$2\"; shift; fi; shift; done; \
while [ \"\$1\" != \"\" ]; do if [ \"\$1\" = \"-debug\" ]; then echo \"**** GDB port \$((HOST_PORT + 1)) ****\"; DEBUG=\"-gdb tcp::\$((HOST_PORT + 1)) -S -d in_asm -D debug.log\"; fi; if [ \"\$1\" = \"-smp\" ]; then SMP=\"\$2\"; shift; fi; shift; done; \
${qemu_system} \
\$DEBUG \
-m 2G \
Expand Down
4 changes: 2 additions & 2 deletions docs/source/Getting-Started/How-to-Debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ If you want to debug with the kernel's debug information
riscv64-unknown-linux-gnu-gdb ./riscv-linux/vmlinux
```

Then, attach to QEMU:
Then, attach to QEMU on the port printed by the starting qemu script:

```bash
(gdb) target remote localhost:1234
(gdb) target remote localhost:$PORT
```

Now, you can start debugging the SM (bbl) or the kernel.
Expand Down

0 comments on commit a3094b9

Please sign in to comment.