简体   繁体   中英

gcc gdb no debugging info

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM