21.windbg-.lastevent、!analyze(dump分析、异常错误码查询)
来源:互联网 发布:什么软件画电路图 编辑:程序博客网 时间:2024/05/18 03:58
.lastevent
.lastevent 命令显示最近一次发生的异常或事件。
0:000> .lasteventLast event: 1534.f4c: Break instruction exception - code 80000003 (first chance) debugger time: Tue May 22 10:47:26.962 2012 (GMT+8)0:000> ~. 0 Id: 1534.e8c Suspend: 1 Teb: 7ffdf000 Unfrozen 1 Id: 1534.1338 Suspend: 1 Teb: 7ffde000 Unfrozen# 2 Id: 1534.f4c Suspend: 1 Teb: 7ffdd000 Unfrozen
我们可以看出,当前为2号线程发生异常,线程0前面的点号(.)表示它是当前线程。线程2前面的数字号(#)表示它是产生异常或调试器附加到进程时活动的线程。如果使用CTRL+C、 CTRL+BREAK或Debug | Break中断到调试器,总是会产生一个 0x80000003异常代码。
0:000> .lasteventLast event: 1664.4184: Access violation - code c0000005 (first/second chance not available) debugger time: Thu Aug 13 11:20:44.037 2015 (GMT+8)
异常错误码查询
!analyze
!analyze扩展显示当前异常或bug check的信息。一般使用!analyze -v
分析参考:https://msdn.microsoft.com/en-us/library/windows/hardware/ff560201(v=vs.85).aspx
如下述为一个对NULL指针赋值生成的dump,自动生成dump可以参考16.windbg-.dump(转储文件)
0:000> !analyze -v******************************************************************************** ** Exception Analysis ** ************************************************************************************************************************************************************ ****** ****** Your debugger is not using the correct symbols ****** ****** In order for this command to work properly, your symbol path ****** must point to .pdb files that have full type information. ****** ****** Certain .pdb files (such as the public OS symbols) do not ****** contain the required information. Contact the group that ****** provided you with these symbols if you need this command to ****** work. ****** ****** Type referenced: kernel32!pNlsUserInfo ****** ******************************************************************************************************************************************************** ****** ****** Your debugger is not using the correct symbols ****** ****** In order for this command to work properly, your symbol path ****** must point to .pdb files that have full type information. ****** ****** Certain .pdb files (such as the public OS symbols) do not ****** contain the required information. Contact the group that ****** provided you with these symbols if you need this command to ****** work. ****** ****** Type referenced: kernel32!pNlsUserInfo ****** ****************************************************************************首先被提示,这是没有pdb文件 的
FAULTING_IP: test2+100201211002 8900 mov dword ptr [eax],eaxFAULTING_IP:出现错误时的指令,这句明显就是把eax赋到[eax]中
EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)EXCEPTION_RECORD:崩溃时的异常记录,可以使用.exr查看
ExceptionAddress: 01211002 (test2+0x00001002) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000NumberParameters: 2 Parameter[0]: 00000001 Parameter[1]: 00000000Attempt to write to address 00000000这个就很详细了,尝试向0地址写入,它其实就是调试中用到的结构体:可以直接通过MSDN查到它的定义
typedef struct _EXCEPTION_RECORD { DWORD ExceptionCode; DWORD ExceptionFlags; struct _EXCEPTION_RECORD *ExceptionRecord; PVOID ExceptionAddress; DWORD NumberParameters; ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; } EXCEPTION_RECORD;注意的是:上面的NumberParameter:2表示ExceptionInformation有两个附加异常码,1和0,对于多数异常来说,这些附加异常码是没有什么用的,MSDN:For most exception codes, the array elements are undefined.只有以下两个被定义了
当ExceptionCode为EXCEPTION_ACCESS_VIOLATION时,ExceptionInformation[0]=0表示线程试图读取不可访问的数据ExceptionInformation[0]=1
表示线程试图写入不可访问的地址,很明显,这里表示第二种,具体参考MSDN
DEFAULT_BUCKET_ID: NULL_POINTER_READDEFAULT_BUCKET_ID:表示了本次错误属于哪种通用失败
BUGCHECK_STR: APPLICATION_FAULT_NULL_POINTER_READ_NULL_POINTER_WRITEThe BUGCHECK_STR field shows the exception code. The name is a misnomer—the term bug check actually signifies a kernel-mode crash. In user-mode debugging, the exception code will be displayed—in this case, 0x80000003.
LAST_CONTROL_TRANSFER: from 76b6337a to 01211002堆栈的最后调用:
The LAST_CONTROL_TRANSFER field shows the last call on the stack. In this case, the code at address0x76b6337acalled a function at 0x1211002. You can use these addresses with the ln (List Nearest Symbols) command to determine what modules and functions these addresses reside in.
STACK_TEXT: WARNING: Stack unwind information not available. Following frames may be wrong.0020fbb8 76b6337a 7efde000 0020fc04 77e092b2 test2+0x10020020fbc4 77e092b2 7efde000 596d1564 00000000 kernel32!BaseThreadInitThunk+0xe0020fc04 77e09285 012112b6 7efde000 00000000 ntdll!__RtlUserThreadStart+0x700020fc1c 00000000 012112b6 7efde000 00000000 ntdll!_RtlUserThreadStart+0x1b堆信息
STACK_COMMAND: ~0s; .ecxr ; kb打印堆栈的命令
SYMBOL_NAME: test2+1002对应的符号名称
IMAGE_NAME: test2.exe对应的模块名称
3.符号文件简介:
符号文件对于调试程序是相当重要的,通常符号文件中包含以下内容
全局变量的名字和地址
函数名,地址及其原型
帧指针优化数据
局部变量的名字和地址
源文件路径以及每个符号的行号
变量,结构等的类型信息
- 21.windbg-.lastevent、!analyze(dump分析、异常错误码查询)
- 21.windbg-.lastevent、!analyze(dump分析、异常错误码查询)
- .lastevent、!analyze(dump分析、异常错误码查询)
- windbg的lastevent命令
- windbg分析dump文件
- windbg dump分析
- windbg dump 批量分析
- windbg分析dump
- windbg dump分析入门
- windbg分析dump文件
- windbg分析dump文件
- windbg分析dump文件
- windbg分析dump文件
- WinDbg分析DUMP文件
- 初识-WINDBG 分析DUMP
- windbg分析dump文件
- dump analyze
- 利用windbg分析dump文件
- java 设计模式--策略模式(strategy)
- java动态代理
- 解决MyEclipse 9.0手动安装SVN插件
- VS制作安装程序时删除以前旧版本
- Android中gravity与layout_gravity的区别
- 21.windbg-.lastevent、!analyze(dump分析、异常错误码查询)
- Posix多线程编程学习笔记(三)—信号灯(3)
- 在ubuntu下安装.bin文件JDK的方法
- Qt中提高sqlite的读写速度
- MP4文件格式详解——元数据moov(一)mvhd box
- Javascript 匿名函数的理解
- 面向对象设计6大原则(二)
- 与系统 性能相关的 常见十个瓶颈 说明
- 超级简单报表导出方案,如何用XML Publisher在eclipse中生成excel,pdf,html