11

のように gcc を呼び出しても、ソース ファイルへの絶対パスをデバッグ情報に埋め込むように gcc に指示できるかどうか疑問に思っています。

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

私が見たように、gccはあなたが提供したものを保存するだけなので、相対パスを指定すると、最後にgdbも相対パスしか知りません。

コンパイル中に絶対パスを使用せずにそれをバイパスする方法はありますか? のように: gcc に完全なパスを検索させますか?

よろしくお願いします

4

2 に答える 2

9
gcc -fdebug-prefix-map=..=$(readlink -f ..)
于 2016-05-16T05:38:38.690 に答える
0

What platform are you building for and what is the native debugging format for that platform? Not that this information will necessarily get you closer to solving your problem, but it may be worth looking at the specification for the debug format to see if what you want to do even makes sense from that perspective.

You are passing the '-g' option to the compiler right.

于 2009-08-14T01:03:46.670 に答える