请教一个栈上参数不正确的问题
C/C++本地代码调试
请教一个栈上参数不正确的问题
woodhead
2016-02-25, 14:13 下午
最近在分析一个dump,出错的栈是这个样子的:
0:030> kbn
*** Stack trace for last set context - .thread/.cxr resets it
# ChildEBP RetAddr Args to Child
00 0649eb84 00f815e6 e06d7363 00000001 00000003 KERNELBASE!RaiseException+0x58
01 0649ebc4 00f6b284 0649ec24 00fd1994 52edb865 NetVideo!_CxxThrowException+0x5b [f:\dd\vctools\crt\crtw32\eh\throw.cpp @ 152]
02 0649ec84 00f6b040 006e9f38 0000007f 52edb879 NetVideo!apache::thrift::transport::TSocket::write_partial+0x184 [e:\thrift-0.9.2\lib\cpp\src\thrift\transport\tsocket.cpp @ 586]
03 0649ed04 00f699fb 006e9f38 0000007f 0649f948 NetVideo!apache::thrift::transport::TSocket::write+0x60 [e:\thrift-0.9.2\lib\cpp\src\thrift\transport\tsocket.cpp @ 550]
04 0649ed18 00f530d8 0649eff0 00f55fb6 00f8c577 NetVideo!apache::thrift::transport::TBufferedTransport::flush+0x1b [e:\thrift-0.9.2\lib\cpp\src\thrift\transport\tbuffertransports.cpp @ 131]
05 0649ed20 00f55fb6 00f8c577 0649f948 0649eff0 NetVideo!apache::thrift::transport::TBufferedTransport::close+0x8 [e:\face_svn\code\frs\v01\service\service\thridly_tool\thrift\transport\tbuffertransports.h @ 247]
06 0649f954 00f562e1
0009d757 0b009da0 0b009da4
NetVideo!push_pic_to_match+0x566 [e:\face_svn\code\frs\v01\service\netvideo\netvideo\netvideo\netvideo.cpp @ 539]
07 0649f9c0 7473381b
00000000 0a4c0020 0009d757
NetVideo!capture_cbk+0x1c1 [e:\face_svn\code\frs\v01\service\netvideo\netvideo\netvideo\netvideo.cpp @ 575]
.frame 07里看三个参数分别为:00000000 0a4c0020 0009d757 对应的函数原型为void __stdcall capture_cbk(int _iConnID, unsigned char* _ucData, int _iLen),这个显示应该是正确的的。
看不懂的地方在6号栈帧:
6号栈帧函数原型:static BOOL push_pic_to_match(int channel_id, unsigned char* _ucData, int _iLen, std::vector<int> face_db),参数显示为:0009d757 0b009da0 0b009da4 感觉不对了。
0009d757
这个应该是_iLen的值。为什么会出现这种状况呢?栈被破坏了?6号栈帧的参数传递是怎么进行的呢?
6号栈帧ebp为:
0649f954
0:030> dd 0649f954
0649f954 0649f9c0 00f562e1 0009d757 0b009da0
0649f964 0b009da4 0b009da4 52edad91 0a4c0020
0649f974 00000420 00000580 055d4930 68737570
0649f984 63697020 67656220 00006e69 0000000e
0649f994 0000000f 0010fffe 00000000 00000000
0649f9a4 00000000 00000000 00000000 00000000
0649f9b4 0649fa1c 00fb4be0 ffffffff 0649f9d4
0649f9c4 7473381b 00000000 0a4c0020 0009d757
谢谢大家了!