【发布时间】:2009-11-16 13:44:51
【问题描述】:
我观察到我的应用程序发生崩溃,调用堆栈如下所示
mfc42u!CString::AllocBeforeWrite+5
mfc42u!CString::operator=+22
不知道为什么会这样。这也不经常发生。 任何建议都会有所帮助。我有崩溃转储,但无法继续前进。
我正在执行的操作是这样的
iParseErr += m_RawMessage[wMsgLen-32] != NC_SP;
其中 m_RawMessage 是一个 512 长度的字符数组。 wMsgLen 是无符号短 并且 NC_SP 被定义为
#define NC_SP 0x20 // Space
编辑:
调用栈:
042afe3c 5f8090dd mfc42u!CString::AllocBeforeWrite+0x5 * WARNING: Unable to verify checksum for WP Communications Server.exe
042afe50 0045f0c0 mfc42u!CString::operator=+0x22
042aff10 5f814d6b WP_Communications_Server!CParserN1000::iCheckMessage(void)+0x665 [V:\CSAC\SourceCode\WP Communications Server\HW Parser N1000.cpp @ 1279]
042aff80 77c3a3b0 mfc42u!_AfxThreadEntry+0xe6
042affb4 7c80b729 msvcrt!_endthreadex+0xa9
042affec 00000000 kernel32!BaseThreadStart+0x37
这是完整的调用堆栈,我已将代码 sn-p 发布在我的原始消息中
谢谢
【问题讨论】:
-
Viswanathan 从您的 sn-p 中,CString 类如何参与并不明显。 m_RawMessage 是 CString 的实例吗?
-
如果 CParserN1000::iCheckMessage 不是您的线程过程,则您的堆栈已损坏。 BaseThreadStart/_endthreadex/_AfxThreadEntry 看起来像一个合法的堆栈。
-
你真的是要 += 一个布尔值吗?代码在很多方面看起来都非常错误......
标签: c++ mfc crash-dumps