gcc gdb没有调试信息 [英] gcc gdb no debugging info

查看:57
本文介绍了gcc gdb没有调试信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图防止g ++内联模板函数,这会导致gdb缺少调试信息,例如局部变量甚至是当前行号.

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.

我已经尽力尝试了g ++选项中的一切,例如:

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

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

甚至考虑在我的函数前加上__attribute__((noinline))无效.

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

我的调用栈看起来像

#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*) ()

我没有做任何行号和调试信息的地方.我正在使用g ++ 4.4.5进行编译,并使用GNU gdb(GDB)Fedora(7.1-34.fc13)进行调试.

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).

我非常困惑,调试非常困难,除了printf之外我别无选择.这是我使用的版本的已知问题,我能做些什么吗?

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?

更新:使用gcc/gdb的最新版本,没问题.好像是gcc/gdb错误.

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

推荐答案

我建议使用-g3符号来获取详细的调试信息.这样将产生完整的代码级信息,可用于调试流程.

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.

这篇关于gcc gdb没有调试信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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