使用 gdb 调试 xv6 代码无法读取符号表

问题描述 投票:0回答:0

我在使用 qemu-gdb 时遇到问题。我在一个选项卡中执行了

make qemu-gdb
,在另一个选项卡中执行了
riscv64-unknown-elf-gdb
。然后我得到这个:

riscv64-unknown-elf-gdb kernel/kernel
GNU gdb (GDB) 10.1
Copyright (C) 2020 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-apple-darwin21.5.0 --target=riscv64-unknown-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
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"...
/Users/lichenglong/.gdbinit:1: Error in sourced command file:
No symbol table is loaded.  Use the "file" command.
Reading symbols from kernel/kernel...
warning: File "/Users/username/cs_study/os/6S081/labs/xv6-labs-2022/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
    add-auto-load-safe-path /Users/username/cs_study/os/6S081/labs/xv6-labs-2022/.gdbinit
line to your configuration file "/Users/username/.gdbinit".
To completely disable this security protection add
    set auto-load safe-path /
line to your configuration file "/Users/username/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
    info "(gdb)Auto-loading safe path

根据提示,我在文件

add-auto-load-safe-path /Users/username/cs_study/os/6S081/labs/xv6-labs-2022/.gdbinit
中添加
/Users/username/.gdbinit
行。当我执行
source /Users/username/.gdbinit
时,提示
command not found: add-auto-load-safe-path
。 然后我将
set auto-load safe-path /
行添加到文件并获取它。但是当我运行
riscv64-unknown-elf-gdb
.

时,我得到了相同的结果
debugging operating-system gdb xv6
© www.soinside.com 2019 - 2024. All rights reserved.