windbg 使用指南《一》
来源:互联网 发布:淘宝网领券中心 编辑:程序博客网 时间:2024/06/06 08:36
安装完WinDbug之后,在WinDbug路径下会有一个UMDH.exe的文件,通过这个文件可以通过“栈回溯数据库”的方式定位应用程序内存泄露的地方。
The User-Mode Dump Heap (UMDH) tool, Umdh.exe, analyzes the Microsoft Windows heap memory allocations for a given process. UMDH has the following modes.
- Analyze a running process ("Mode 1"). UMDH captures and analyzes the heap memory allocations for a process. For each allocation, UMDH displays the size of the allocation, the size of the overhead, the pointer to the allocation and the allocation stack. If a process has more than one active memory heap, UMDH captures all heaps.
- Analyze UMDH log files ("Mode 2"). UMDH analyzes the logs to help detect memory leaks. When comparing two UMDH output logs from subsequent runs of a UMDF driver, UMDH displays the calls in which the allocation size increased the most between the runs.
umdh只能针对分配了内存,但是没有进行释放的程序起到检测作用。除了umdh.exe 通过!heap 也可找到增长的那个堆,并找到对应的栈信息,从而定位到函数源码。
A:UMDH方式
创建应用程序WinDbugTest.exe
1.cmd窗口转到gflags.exe目录(WinDbug路径),运行:gflags.exe -i F:\Test|WinDbugTest\\Debug\WinDbugTest.exe +ust 来启用目标程序的ust功能
2.打开应用程序WinDbugTest.exe不执行任何操作;
3.cmd窗口转到umdh.exe目录(WinDbug路径),运行:umdh.exe -pn:WinDbugTest.exe -f:u1.log 记录当前栈引用数据库相关信息
4.对程序进行相关操作,执行一些创建内存以及释放内存的操作。
5.cmd窗口转到umdh.exe目录(WinDbug路径),运行:umdh.exe -pn:WinDbugTest.exe -f:u2.log 记录当前栈引用数据库相关信息
6.cmd窗口转到umdh.exe目录(WinDbug路径),运行:umdh.exe u1.log u2.log -f:u3.log 将之前获取的栈引用数据库信息进行对比来找到出现异常的地址
B:!Heap方式
1.!heap -s
2.!heap -stat -h XXXXX
3.!heap -flt s XX
4.!heap -p -a VVV
- windbg 使用指南《一》
- Windbg使用指南
- Windbg使用指南(1)---常用命令
- Windbg使用指南(1)---常用命令
- Windbg使用指南(1)---常用命令
- windbg 使用指南<二>
- WinDBG 使用教学(一)
- windbg学习记录(一)
- WinDbg学习笔记一
- WinDbg学习笔记(一)--认识WinDbg
- WinDbg学习笔记(一)--认识WinDbg
- WinDbg学习笔记(一)--认识WinDbg
- WinDbg学习笔记(一)--认识WinDbg
- WinDbg学习笔记(一)--认识WinDbg
- hook使用指南(一)
- SQLPlus命令使用指南(一)
- Scintilla使用指南(一)
- SQLPlus命令使用指南(一)
- pku 3126 Prime Path (bfs)
- WindowsAPI “奇葩”的函数传参方式
- Android 深入研究JNI详解
- cocos2dx 跨平台游戏开发基础框架以及Demo
- 将播放器以字符串的形式输出到页面上,并实现播放功能
- windbg 使用指南《一》
- Android 音量调节
- Data Structures (Weiss) Chapter 12: Deterministic Skip Lists (跳跃链表,Comparable)
- iOS: NSFileHandle的方法availableData
- windbg 使用指南<二>
- SRM 586 Div II Level Three: StringWeightDiv2,Dynamic Programming or Math
- iOS: NSFileHandle的方法closeFile
- 编程之美:平面最近点对
- windbg 学习指南<三>