$ make
+ cc kern/init/entry.S
+ cc kern/init/init.c
+ cc kern/libs/stdio.c
+ cc kern/driver/console.c
+ cc libs/string.c
+ cc libs/printfmt.c
+ cc libs/readline.c
+ cc libs/sbi.c
+ ld bin/kernel
riscv64-unknown-elf-objcopy bin/kernel --strip-all -O binary bin/ucore.img
$ qemu-system-riscv64 -S -s -hda ./bin/ucore.img
WARNING: Image format was not specified for './bin/ucore.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
VNC server running on 127.0.0.1:5900xxxxxxxxxx qemu-system-riscv64 -S -s -hda ./bin/ucore.img$ qemu-system-riscv64 -S -s -hda ./bin/ucore.img WARNING: Image format was not specified for './bin/ucore.img' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions.VNC server running on 127.0.0.1:5900
$ riscv64-unknown-elf-gdb ./bin/kernel
GNU gdb (SiFive GDB 8.3.0-2020.04.0) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=riscv64-unknown-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/sifive/freedom-tools/issues>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bin/kernel...
(gdb)
(gdb) target remote :1234
Remote debugging using :1234
0x0000000000001000 in ?? ()