gcc / gdb:如何将源文件的绝对路径嵌入调试信息? [英] gcc/gdb: How to embed absolute path to source file in debug information?

查看:398
本文介绍了gcc / gdb:如何将源文件的绝对路径嵌入调试信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道我是否可以告诉gcc在调试信息中嵌入源文件的绝对路径,即使我像

  gcc -g ../src/somecode.c -o ../bin/somecode.o 

,因为我看到它atm,gcc只是存储你提供的,所以如果你提供一个相对路径,最后,gdb只知道相对路径。



是否有一种方法来绕过它,而不使用绝对路径编译?喜欢:让gcc查找完整的路径?



提前感谢
rTi

解决方案

  gcc -fdebug-prefix-map = .. = $(readlink -f ..)


i am just wondering if i can tell gcc to embed the absolute path to a source file in the debug information, even if i call gcc like

gcc -g ../src/somecode.c -o ../bin/somecode.o 

as i see it atm, gcc just stores what you provide, so if you provide a relative path, at the end, gdb only knows the relative path as well.

is there a way to bypass that without using absolute paths while compiling? like: let gcc lookup the complete path?

thanks in advance rTi

解决方案

gcc -fdebug-prefix-map=..=$(readlink -f ..)

这篇关于gcc / gdb:如何将源文件的绝对路径嵌入调试信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆