gcc gdb no debugging info

血红的双手。 提交于 2019-12-12 02:59:44

问题


I'm trying to prevent g++ from inlining templated functions, which cause gdb to lack debugging information, like local variables or even current line numbers.

Actually, I'm guessing this is something related to inlining template functions, because this is the only situation where I can't have access to anything in my callstack.

I've pretty much tried everything I could in g++ options, such as:

-DDEBUG -O0 -fno-inline -fno-implicit-inline-templates

and even considered prefixing my functions with __attribute__ ((noinline)) to no effect.

My callstacks would look like

#0  CVector<CGatherColor>::operator[] (this=0x9324480, index=1208) at ../utils/vector.h:28
#1  0x0000000000ee1d27 in unsigned int CBrdfLoop::trace_t<CAreaLightSquare, CNoCulling, CAreaLightSquare, CBrdfLdSampler>(int, unsigned int, CPrimMBVH*, CVector<CBrdfCache::CVertexCache>*, CAreaLightSquare&, CNoCulling&, CAreaLightSquare&, CBrdfLoop::CVtxSmpInfo const&, CBrdfLdSampler&) ()
#2  0x0000000000eb52ac in void CBrdfLoop::illuminate_t<CAreaLightSquare, CAreaLightSquare, CBrdfLdSampler>(unsigned int, CBrdfLdSampler&, CVector<CBrdfCache::CVertexCache>*, CAreaLightSquare&, CAreaLightSquare&, unsigned int, CPrimMBVH*) ()

where there are no line numbers and no debugging information whatever I do. I'm compiling with g++ 4.4.5 and debugging with GNU gdb (GDB) Fedora (7.1-34.fc13).

I'm quite stuck, and debugging is quite difficult, leaving me no options but printf... Is this a known issue of the versions I'm using, is there anything I can do?

Update: With more recent versions of gcc/gdb, no problem. Seems like a gcc/gdb bug.


回答1:


I suggest to use -g3 symbol to get the detailed debugging information. That will produce complete code level information which can be used in debugging the flow.



来源:https://stackoverflow.com/questions/13137027/gcc-gdb-no-debugging-info

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!