gpt4 book ai didi

c++ - C/C++ 远程编译,使用 ELF 的本地调试 session (嵌入式,Cortex-M)

转载 作者:太空宇宙 更新时间:2023-11-04 04:12:33 24 4
gpt4 key购买 nike

我在笔记本上用 C/C++ 编写了大量代码。不幸的是,双核在编译方面有其局限性,我经常这样做。但优点是我是移动的,我可以随身携带我的调试器 (usb j-link)(不,ethernet-j-link 选项太贵了)。

我有一台 24 核服务器。我想使用服务器进行编译,然后将编译后的文件(主要是ELF)复制到我的本地机器上进行调试。

两台机器都使用 Ubuntu(笔记本为 Ubuntu Budgie,服务器为 Ubuntu Server)。

遗憾的是,Eclipse GDB (Atollic 8.1) 不再能够将二进制地址映射到我在图形调试器中的源文件(可以理解)。

我想知道图形调试器如何将地址映射到文本 (src)。这个路径信息在 ELF 文件中吗?如果是这样,我该如何更正它,以便远程编译的二进制文件能够在我的笔记本上调试运行?

最佳答案

在 gdb 中,你可以这样做:

set substitute-path from to

Define a source path substitution rule, and add it at the end of the current list of existing substitution rules. If a rule with the same from was already defined, then the old rule is also deleted. For example, if the file /foo/bar/baz.c was moved to /mnt/cross/baz.c, then the command (gdb) set substitute-path /foo/bar /mnt/cross will tell GDB to replace ‘/foo/bar’ with ‘/mnt/cross’, which will allow GDB to find the file baz.c even though it was moved. In the case when more than one substitution rule have been defined, the rules are evaluated one by one in the order where they have been defined. The first one matching, if any, is selected to perform the substitution. For instance, if we had entered the following commands: (gdb) set substitute-path /usr/src/include /mnt/include (gdb) set substitute-path /usr/src /mnt/src GDB would then rewrite /usr/src/include/defs.h into /mnt/include/defs.h by using the first rule. However, it would use the second rule to rewrite /usr/src/lib/foo.c into /mnt/src/lib/foo.c.

关于c++ - C/C++ 远程编译,使用 ELF 的本地调试 session (嵌入式,Cortex-M),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55582815/

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