有了前几节的准备工作,我们的程序已经可以自动捕获异常了,那么我们开始通过windbg来分析dump解决实际问题。先从简单入手,CString大小写转化导致的异常(提取码ffk6)。
步骤1
使用windbg打开minidump,设置好应用程序的pdb, 执行命令 “.ecxr” 、”kv” ,打印如下栈信息
1 | 0:121> .ecxr |
步骤2
显示了应用程序的代码行号,但我们希望看到更仔细点,就需要加载windows的系统符号文件
1 | e:\mylocalsymbols;SRV*e:\mylocalsymbols*http://msdl.microsoft.com/download/symbols |
步骤3
设置后,重新“kv” 查看堆栈信息,显示如下
1 | 0:121> kv |
结论
可以看到是由于CString 触发了_CxxThrowException。 服务从VC6版本切换到VS2013,CString 的MakeLower 函数检查变的更加严格,部分特殊用户名在VC6中正确转化,但是在vs2013中会抛出异常,将大小写转化函数替换为CharLower ,问题解决