gpt4 book ai didi

c - 如何使用一个终端调试 QEMU?

转载 作者:行者123 更新时间:2023-12-05 04:28:51 31 4
gpt4 key购买 nike

我正在为卡内基梅隆大学研制月球车,该车将于明年发射。具体来说,我正在使用名为 ISIS OBC(机载计算机)的飞行计算机,我试图找出如何首先在后台终端中运行 QEMU,然后运行 ​​GDB 以连接到我刚刚后台运行的 QEMU 实例.我已经尝试使用 & 在后台运行 QEMU 以及使用标志 -daemonize 但这会导致 QEMU 的 GDB 服务器根本无法工作。

总体目标是能够在一个终端窗口中调试 GDB 中的飞行软件,以便我可以从安装在存储库根目录中的 Docker 容器中运行它。需要一些设置才能调试我们的代码,有一些陷阱,比如与较新版本的 GCC 不兼容,因此能够运行 CODE 并从 Docker 容器(它有我们所有其他开发也安装了依赖项)是必须的。

我目前的解决方案是在我在启动脚本中完全在 docker 容器之外初始化的另一个 gnome 终端中运行 QEMU,但由于显而易见的原因,这在 Docker 中不起作用。以下是该代码,以防其他上下文有帮助:

#!/bin/bash
#The goal of the below code is to get the stdout from QEMU piped into GDB.
#Unfourtunately it appears that QEMU must be started as the FG in its own window so that it will
#start its GDB server, so an additional window is required.

my_tty=$(tty)
gnome-terminal -- bash -c './../obc-emulation-resources/obc-qemu/iobc-loader -f sdram build/app.isis-obc-rtos.bin -s sdram -o pmc-mclk -- -serial stdio -monitor none -s -S > /tmp/qemu-gdb; $SHELL' --name="QEMU-iOBC" --title="QEMU-iOBC" -p
tail -f /tmp/qemu-gdb > $my_tty&
./third_party/gcc-arm-none-eabi-10.3-2021.07/bin/arm-none-eabi-gdb -ex='target remote localhost:1234' -ex='symbol-file build/isis-obc-rtos.elf'

# Kill any leftover qemu debugging sessions
kill $(ps aux | grep '[i]obc-loader' | awk '{print $2}')

# Delete intermediate file
rm -f /tmp/qemu-gdb

# Get's rid of any extra text that may occur
echo ""
clear

我更愿意运行这样的东西来实现我的目标:

./../obc-emulation-resources/obc-qemu/iobc-loader -f sdram build/app.isis-obc-rtos.bin -s sdram -o pmc-mclk -- -serial stdio -monitor none -s -S > /tmp/qemu-gdb

而不是我现在运行的:

gnome-terminal -- bash -c './../obc-emulation-resources/obc-qemu/iobc-loader -f sdram build/app.isis-obc-rtos.bin -s sdram -o pmc-mclk -- -serial stdio -monitor none -s -S > /tmp/qemu-gdb; $SHELL' --name="QEMU-iOBC" --title="QEMU-iOBC" -p

“iobc-loader”是用于运行 QEMU 命令的包装器。“app.isis-obc-rtos.bin”当然是我尝试运行的二进制文件,而“isis-obc-rtos. elf"包含用于调试它的符号。如果答案很明显,我很抱歉,我是一名学生!

最佳答案

您可以尝试使用像 screentmux 这样的终端多路复用器,它允许您在单独的虚拟终端中在前台运行每个命令。

您还可以创建 Pane ,例如使用 tmux 按 Ctrl+b " 水平分割屏幕或 Ctrl+b % 垂直分割屏幕,然后 Ctrl+b o 在它们之间循环。

关于c - 如何使用一个终端调试 QEMU?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72489354/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com