我正在分析由我的應用程序生成的核心轉儲。從堆棧跟蹤我可以從/lib/tls/libc.so.6使用gdb分析核心轉儲幀
#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()
看到下面的行中加註() #0 0x00779eff緩衝功能的定義如下
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
但要檢查什麼是大小的值傳遞給它 我該怎麼辦呢?任何幫助將不勝感激
感謝 SKP
這取決於您的代碼是否使用調試符號進行編譯。由於resize函數是從構造函數中調用的,你不能檢查使用的參數是什麼值,或者是作爲參數給予構造函數的大小? –
是啊,它是用-g選項編譯的 – user3160866
你想調試優化的代碼嗎? – dbrank0