[Windows]调试
零点零一
Make it right before you make it faster. Keep it right when you make it faster. Make it clear before you make it faster. Do not sacrifice clarity for small gains in efficiency. -- Brian Kernighan
展开
-
细谈VC程序调试的若干方法
记得我刚开始用VC编程时,多次遇到程序编译链接都没有任何错误提示时运行却发生意外错误或者陷入死机状态,对此我真是茫然不知所措。后来经过项目工程的“洗礼”,我学到了一些解决这类错误的方法同时也将自己积累的经验运用到开发工作中,从而避免了重蹈覆辙,编程效率得以明显提高。如果你用VC而不精通解决上述种种莫名其妙故障的调试技术,那么软件的进度和质量将无法保障。VC调试之重要不言而喻。 其实VC所依赖...转载 2020-04-20 14:05:03 · 605 阅读 · 0 评论 -
程序崩溃时自动记录minidump的c++类
程序崩溃时自动记录minidump的c++类经过测试可以使用http://www.cnblogs.com/lidabo/archive/2012/11/21/2781476.html封装了一个C++类,当程序意外崩溃的时候可以生成dump文件,以便确定错误原因。头文件: 1 //crash_dumper_w32.h 2 3 #ifndef _CRASH转载 2017-05-24 12:46:24 · 1261 阅读 · 1 评论 -
VC/MFC调试技术
在VC程序中使用调试语句 为了更好地对程序调试,可以使用如下方法:使用断言、使用跟踪语句、使用异常和返回值。一、断言1、基本概念 断言是一种让错误在运行时候自我暴露的简单有效实用的技术。它们帮助你较早较轻易地发现错误,使得整个调试过程效率更高。 断言是布尔调试语句,用来检测在程序正常运行的时候某一个条件的值是否总为真,它能让错误在运行时刻暴露在程序员面转载 2017-05-24 14:29:29 · 745 阅读 · 0 评论 -
调试技巧MFC中TRACE宏的使用
个人总结:最近看网络编程是碰到了TRACE语句,不知道在哪里输出,查了一晚上资料也没找出来,今天终于在CSDN上找到了,真是个高地方啊,方法如下:1.在MFC中加入TRACE语句2.在TOOLS->MFC TRACER中选择 “ENABLE TRACING”点击OK3.进行调试运行,Go(F5)(特别注意:不是执行‘!’以前之所以不能看到TRACE内容,是因为不是调试执行,转载 2017-05-24 15:44:42 · 823 阅读 · 0 评论 -
在VS2005中使用MFC,提示_CrtDbgReport: String too long or IO Error
提示_CrtDbgReport: String too long or IO Error在VS2005中使用MFC,UNICODE调用TRACE,TRACE(_T("测试Trace效果!"));输出_CrtDbgReport: String too long or IO Error修改为TRACE(("测试Trace效果!")); 可尝试使用OutputDebugS原创 2017-05-24 15:49:24 · 1323 阅读 · 0 评论 -
Unicode下TRACE中文(_CrtDbgReport: String too long or IO Error)
在使用Unicode的工程项目中,如果是Debug模式。当TRACE Unicode 中文字符串时,会输出提示:_CrtDbgReport: String too long or IO Error有两种方法来解决这个问题方法一:直接使用 OutputDebugString 替换 TRACE相关说明:函数原型:void OutputDebugString(LP转载 2017-05-24 15:50:45 · 496 阅读 · 0 评论 -
windows蓝屏日志文件、dump文件收集方法
我们以收集一款收费软件引起windows系统蓝屏为例子,进行讲解。 常规报错需收集日志信息:1、计费服务端日志:服务端安装目录下手动创建wxlog和wxpluglog两个文件夹,分别获取计费日志及插件日志。若网吧之前已经存在日志目录并且日志较大,可以先删除之前的日志文件,重现问题后再提取新日志2、计费客户端日志:在客户端system32目录下手动创建wxlog和wxpluglog两个文件夹,分别获转载 2017-06-14 09:36:40 · 13523 阅读 · 0 评论 -
VS使用技巧
VS使用技巧如有图片不能显示,请去原文查看:http://www.cnblogs.com/xpvincent/p/3596553.htmli. Ctrl-M-O 折叠所有方法 ii. Ctrl-M-P 展开所有方法并停止大纲显示(不可以再折叠了) iii. Ctrl-M-M 折叠或展开当前方法 iv. Ctrl-M-L展开所有方法 相转载 2017-09-29 11:12:20 · 429 阅读 · 0 评论 -
Windbg调试----Windbg入门
Windbg简单来说就是一个Windows下对用户态/内核态的程序进行调试,以及对Core Dump文件的分析。对于Crash,资源泄露,死锁等问题的分析,Windbg是一个强有力的利器。相关资料本人也是在维护和开发产品的过程中使用过Windbg,但并未对Windbg进行过系统和深入的学习,也通过这一系列的博客来完善自己对Windbg以及周边知识的理解与使用。我也列出自己正在或者即将阅读的书/资料...转载 2018-03-24 16:38:11 · 797 阅读 · 2 评论 -
WinDbg分析DUMP文件
WinDbg分析DUMP文件1. 如何生成dump文件? 原理:通过SetUnhandledExceptionFilter设置捕获dump的入口,然后通过MiniDumpWriteDump生成dump文件; SetUnhandledExceptionFilter:https://msdn.microsoft.com/query/dev1转载 2017-05-24 11:22:56 · 12079 阅读 · 0 评论 -
Effective minidump
Effective minidump 简介在过去几年里,崩溃转储(crash dump)成为了调试工作的一个重要部分。如果软件在客户现场或者测试实验室发生故障,最有价值的解决方式是能够创建一个故障瞬间的应用程序状态镜像,然后可以在开发者的机器上通过调试器进行分析。第一代的crash dump通常被称为“全用户转储(full user dump)”,它包含了进程的虚拟内存的全部内容。毫无转载 2017-05-24 09:46:16 · 456 阅读 · 0 评论 -
DebugView 调试相关资料
DebugView 调试入门http://blog.csdn.net/jiankunking/article/details/44984487转载 2016-12-23 17:19:06 · 368 阅读 · 0 评论 -
VS2005 CString总是显示{...}不显示字符串内容的处理办法
VS2005 CString总是显示{...}不显示字符串内容的处理办法这是因为在白能量窗口中总是显示的是对象的原始结构,我们要查看字符串的内容的时候还要点进去看CString的成员值才能知道。工具-》选项 选择“调试-》常规” 找到“再变量窗口中显示对象的原始结构”一项,取消即可。转载 2017-04-13 14:03:40 · 984 阅读 · 0 评论 -
C 标准库的 setlocale() 函数用法
C 和 C++ 的标准库分别有自己的 locale 操作方法,C 标准库的 locale 设定函数是 setlocale(),而 C++ 标准库有 locale 类和流对象的 imbue() 方法。这篇讲解 C 标准库中 setlocale() 的使用。 GNU libc 中的 setlocale()参考:man 3 setlocale头文件与声明如下:#inc转载 2017-04-14 13:47:18 · 1158 阅读 · 0 评论 -
vs2005 sp1 补丁的安装问题
vs2005 sp1 补丁的安装问题最近做windows mobile 6.0的手机软件开发,听说用vs2005 开发的话最少得装vs2005 sp1,于是去官网上下了VS80sp1-KB926604-X86-CHS.exe 补丁 .运行....不一会就报c盘空间太小.,汗这么能吃硬盘空间,我原本c盘2.99g 就剩下900多兆了,机器卡的都动不了了,我以为下的程序有问题呢,结束任转载 2017-05-23 09:59:20 · 722 阅读 · 0 评论 -
内存泄漏检测和隔离--来自msdn2005
内存泄漏检测和隔离内存泄漏检测和隔离Visual Studio 2005动态分配和释放内存的功能是 C/C++ 编程的最强大功能之一,但最大的长处也可能成为最大的弱点。C/C++ 应用程序即是如此,在这些应用程序中,内存处理问题属于最常见的 bug。最难捉摸也最难检测到的错误之一是内存泄漏,即未能正确释放以前分配的内存的 bug。只发生一次的小的内存泄漏可能不会转载 2017-05-23 10:25:45 · 406 阅读 · 0 评论 -
VS解决BEX错误但无法关闭DEP保护的问题
最近程序报出BEX错误:问题签名:问题事件名称: BEX应用程序名: Auth.exe应用程序版本: 0.0.0.0应用程序时间戳: 546d9e0c故障模块名称: Auth.exe故障模块版本: 0.0.0.0故障模块时间戳: 546d9e0c异常偏移: 00137ec6异常代码: c0000417异常数据: 00000000 ..转载 2017-05-23 17:45:29 · 2813 阅读 · 0 评论 -
vc++程序崩溃后不生成dump文件
http://blog.csdn.net/lixiangminghate/article/details/50413924 这几天给自己的程序通过SetUnhandleExceptionFilte加dump机制。实测时发现不是所有的崩溃,都能生成dump文件:比如assert(false);语句就没有生成dump文件。上网查了一下发现跟我有相同困惑的人还不少,比如这篇"转载 2017-05-23 18:00:10 · 4635 阅读 · 0 评论 -
使用MiniDumpWriteDump API 来生成程序的Dump
MiniDumpWriteDump是MS DbgHelp.dll 中一个API, 用于导出当前运行的程序的Dump. 这个dll程序系统中就有, 但是很多软件, 都在自己的安装目录下保存了这个.dll的最新的版本.为了测试这个API, 参考网上一些资料, 写了一个简单的C++ 程序. 目的是当有异常发生的时候, 自动生成Dump文件供之后的分析. 有了Dump文件, 我们就可以使用WinDBG转载 2017-05-24 09:23:43 · 1717 阅读 · 0 评论 -
Visual Studio C++快速附加到服务进程的方法
今天仍然在看服务程序的调试,在项目属性里面:配置属性-》调试-》 在页面选择 “附加” 选择“是“,如果我们这边启动了服务,另一边在VS里面赶快按F5执行,就快速的附加到了该进程里面了。原创 2016-12-23 16:59:59 · 4296 阅读 · 0 评论