Warm tip: This article is reproduced from stackoverflow.com, please click
gdb linux riscv xv6

Questions about debugging in xv6(riscv) -from MIT 6.S081/6.828 2019 OS course

发布于 2020-09-09 18:55:39

I am trying to debug user programs,but when I do as follows:

open a terminal:make qemu-gdb
another terminal:
riscv64-unknown-elf-gdb 
file wc(or any other user programs)
it says:
(gdb) file wc
warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration
of GDB. Attempting to continue with the default riscv settings.

warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration
of GDB. Attempting to continue with the default riscv settings.

Reading symbols from wc...
(No debugging symbols found in wc)

I edit the Makefile,and add -g in both CFLAGS and LDFLAGS,but it just don't work I wonder how can I debug user programs

I'd appreciate it if you could reply and helpe me

ps:here is the MakeFile and the project tree

tree:https://paste.ubuntu.com/p/s9JGY8d4Z9/ makefile:https://paste.ubuntu.com/p/Zp6HXcF4Vq/

Questioner
Red
Viewed
4
Red 2020-06-19 16:04

I finally figured it out:

file command should be followed with path of the executable

so as the tree suggests:if I want to debug wc,I should type:

file user/_wc

and then set breakpoints,and then continue

then run wc in qemu