远程调试 HiFive 在 QEMU 中释放



我正在尝试在 QEMU 中为sifive_u机器进行远程调试。所有工具都来自 Arch Linux 存储库:

➜  qemu-system-riscv64 --version
QEMU emulator version 4.2.0
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
➜  riscv64-linux-gnu-gdb --version
GNU gdb (GDB) 8.3.1
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.

我按如下方式启动机器:

qemu-system-riscv64 -M sifive_u -m 256M -bios default -nographic -S -s

当我连接调试器时,我尝试继续执行,但没有任何反应;如果我分离调试器,OpenSBI 启动画面将打印到串行控制台。典型的gdb会话如下所示:

GNU gdb (GDB) 8.3.1
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-pc-linux-gnu --target=riscv64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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".
(gdb) target remote :1234
Remote debugging using :1234
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x0000000000001000 in ?? ()
(gdb) info thread
Id   Target Id                                            Frame
* 1    Thread 1.1 (sifive-e51-riscv-cpu harts[0] [running]) 0x0000000000001000 in ?? ()
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x0000000080005a52 in ?? ()
(gdb) info thread
Id   Target Id                                            Frame
* 1    Thread 1.1 (sifive-e51-riscv-cpu harts[0] [halted ]) 0x0000000080005a52 in ?? ()
(gdb) detach
Detaching from program: , process 1
Ending remote debugging.
[Inferior 1 (process 1) detached]

似乎很奇怪,我只能在info thread中看到一个线程;我希望看到每个哈特一个线程。

我的预感是,我最终依附于一只输了彩票并入睡的哈特,而对于某些人来说,其他哈特都不允许继续执行。如果我使用virt机器,则当我运行continue时执行会按预期开始,并且我立即看到 OpenSBI 启动,因此它似乎以某种方式与sifive_u的使用有关。

有人知道我做错了什么吗?

https://www.qemu.org/docs/master/system/gdb.html#Debugging%20multicore%20machines

请参阅本页中的"调试多核计算机"。

(gdb)target extended-remote :1234
(gdb)add-inferior
(gdb)inferior 2
(gdb)attach 2
(gdb)i threads

看这张图片

相关内容

  • 没有找到相关文章

最新更新