WinDBG脚本入门

最近开始看一些针对非托管进程的WinDBG的使用了, Tess推荐去看Debugging Toolbox. 其第一篇就把我难住了, 脚本看不懂.

动手实践了一下, 发现下面的文章所讲的内容特别有帮助, 于是转载在这里.

 

原文地址

First steps with WinDBG scripting… (Memento)

http://www.msuiche.net/2007/08/03/first-steps-with-windbg-scripting-memento/

 

Here is a sample of script for Windbg for people who doesn’t want to waste time because they don’t find any document.

Firstly, to declare a variable you must use the prefix “r”. Moreover, the name must be $t[0..n]

Secondly, if you use the flag “/D” after “.printf” you can use pseudo-html code inside.

Thirdly, to read the value of an address you have to use “poi()” with the prefix “@” like : poi(@$t0)

To write byte or dword, you should use “eb” or “ed”.

And… the most fun is that you can create links like the following scheme :
.printf /D “<link cmd=\”COMMAND_TO_EXECUTE\”>DISPLAY_TEXT</link>\\n”;

 

To execute a script use
kd> $$>< "FULL_SCRIPT_PATH"

 

References:
http://blogs.msdn.com/debuggingtoolbox/archive/tags/Windbg+Scripts/default.aspx
http://www.dumpanalysis.org/blog/index.php/category/windbg-scripts/

posted on   中道学友  阅读(1261)  评论(0编辑  收藏  举报

编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2011-03-15 如果域控(domain controller)在防火墙内, 那么需要开放哪些端口才能让墙外的机器正常连接domain controller呢?
2010-03-15 记一次看DUMP的实战
2010-03-15 跨Farm的SSP的配置
2010-03-15 如何在x64的机器上使用WinDBG来debug一个32bit的.NET应用程序
2010-03-15 Deferred Symbol Loading
2010-03-15 Conent Deployment Job 的一点知识 关于Change log
2010-03-15 SQL Error Log 的位置

导航

< 2012年3月 >
26 27 28 29 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
1 2 3 4 5 6 7

技术追求准确,态度积极向上

点击右上角即可分享
微信分享提示