开发者

GDB doesn't work with -D_FILE_OFFSET_BITS=64

I'm compiling a i386 C++ app on Snow Leopard.

开发者_如何学CWhen I compile with -D_FILE_OFFSET_BITS=64 I can't use the binary with gdb. I get the following error message:

warning: Could not find object file "/var/folders/kw/kwmH332LGwCIh3GrRREgCk+++TI/-Tmp-//ccZfMAM5.o" - no debug information available for "test.cpp".


This likely has nothing at all to do with -D_FILE_OFFSET_BITS=64.

When you compile on Mac OS, debug info is not pulled into the executable, but remains in the object file, and the debugger looks for it there.

From your warning message, it appears that you did:

g++ -D_FILE_OFFSET_BITS=64 -g test.cpp

This creates a temporary object file (with name like ccZfMAM5.o), links that object file into the executable, and then removes the object file. Since the debugger can't read debug info from no longer present object file, you get the warning.

Instead, do this:

g++ -g -c -D_FILE_OFFSET_BITS=64 test.cpp
g++ -g test.o

This will make test.o object file (and debug info contained in it) available to the debugger.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜