【发布时间】:2016-11-08 11:40:42
【问题描述】:
我正在分析我的应用程序生成的核心转储。从堆栈跟踪中,我可以看到以下几行 #0 0x00779eff in raise () from /lib/tls/libc.so.6
#1 0x0077b705 in abort () from /lib/tls/libc.so.6
#2 0x006554f7 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.5
#3 0x00655544 in std::terminate () from /usr/lib/libstdc++.so.5
#4 0x006556b6 in __cxa_throw () from /usr/lib/libstdc++.so.5
#5 0x006558d2 in operator new () from /usr/lib/libstdc++.so.5
#6 0x006559bf in operator new[] () from /usr/lib/libstdc++.so.5
#7 0x090c15df in Buffer::resize ()
#8 0x090bd230 in Buffer::Buffer ()
Buffer函数定义如下
int
Buffer::resize (
size_t size
)
{
…….
}
现在我选择了第 7 帧
(gdb) f 7
#7 0x090c15df in Buffer::resize ()
(gdb) info frame
Stack level 7, frame at 0xbfff82f0:
eip = 0x90c15df in Buffer::resize(unsigned int); saved eip 0x90bd230
called by frame at 0xbfff8310, caller of frame at 0xbfff8280
Arglist at 0xbfff82e8, args:
Locals at 0xbfff82e8, Previous frame's sp is 0xbfff82f0
Saved registers:
ebx at 0xbfff82e4, ebp at 0xbfff82e8, esi at 0xbfff8250, edi at 0xbfff8254, eip at 0xbfff82ec
但想检查传递给它的 size 值是多少 我怎么做 ?任何帮助将不胜感激
谢谢 SKP
【问题讨论】:
-
这在一定程度上取决于您的代码是否使用调试符号编译。由于 resize 函数是从构造函数调用的,所以您不能检查从 this 使用的参数是什么值,还是作为参数给构造函数的大小也是如此?
-
是的,它是用 -g 选项编译的
-
您是否尝试调试优化代码?