【翻译 Windbg - 5】.Net 调试举例

简介:   .Net 调试举例 原文 http://blogs.msdn.com/tess/pages/net-debugging-demos-information-and-setup-instructions.

 

<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;} a:link, span.MsoHyperlink {color:blue; mso-themecolor:hyperlink; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {mso-style-noshow:yes; mso-style-priority:99; color:purple; mso-themecolor:followedhyperlink; text-decoration:underline; text-underline:single;} p {mso-style-unhide:no; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:宋体; mso-bidi-font-family:宋体;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; text-indent:21.0pt; mso-char-indent-count:2.0; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:136337071; mso-list-type:hybrid; mso-list-template-ids:1393718016 348154530 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-text:%1、; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:18.0pt; text-indent:-18.0pt;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->

.Net 调试举例

原文

http://blogs.msdn.com/tess/pages/net-debugging-demos-information-and-setup-instructions.aspx

作者

tess

翻译

AloneSword

译文

http://blog.csdn.net/alonesword/

 

.Net 调试举例——安装指南

这是一系列调试例程,帮您获得关于dotnet 应用程序的挂起,性能,内存或崩溃等类型问题的第一手经验。

 

这个示例是基于asp.net技术的,这就意味着安装此示例的开发环境中需要 iis .net framework 2.0

 

每个新的示例会有一些基础指南,但我还是故意的保留的其简洁性,以便你有更多的机会来探索自己的想法,同时如果您有其他想法我也会给一定的提示。

 

如果有充足的时间,我会将新的示例发布在 http://blogs.msdn.com/tess/ (我计划每个礼拜发布一个新示例)

 

所有的示例将使用同一个站点,因此所有的示例均安装在一个应用程序中。

 

注意:这些示例中将会引起高CPU使用率,高内存利用率和崩溃,因此请确保这些示例仅仅安装在开发环境中,系统挂起和服务崩溃不会影响到其他人。

 

安装

1、  下载示例站点(已附录在本帖后),解压缩文件到硬盘中的文件夹(备注:已经上传了一个不需要3.5 的新版本)

2、  添加一个新的iis虚拟目录,取名 BuggyBits

3、  定位到 http://localhost/BuggyBits/Default.htm ,确保虚拟目录设置正确;

4、  浏览公司信息站点:http://localhost/BuggyBits/CompanyInformation.aspx 以确保iis支持 aspx页面;

5、  从如下网址中下载并安装windows调试工具:

 http://www.microsoft.com/whdc/devtols/debugging/default.aspx    

6、  双击运行InternetConnections.reg,此文件作用于注册表(注意:如何注册表的风险由您自己承担,如果担心注册表文件稳定,可以使用 notepad 打开该文件并手动修改内容),用来改变外连接数量,也可使用Internet Explorer修改同样的站点。

7、  安装 tinyget(随IIS6.0资源包一起安装 http://support.microsoft.com/kb/840671 ,我们可以使用该工具对部分文件进行压力测试以便产生挂起和内存泄漏问题;

 

工具和术语

每个示例/实验中,假设您对如下的技术非常熟悉:


 

Windbg

Windows系统上安装的调试器

该工具将默认安装到调试目录 ”c:/program files/debugging tools for windows”

Adplus

自动获取内存存储的脚本,也安装在调试目录中。

Debuggers directory

默认目录: c:/program files/debugging tools for windows

SOS

调试托管的Dotnet扩展工具

该文件是随着framework 安装的,可以在framework安装目录 c:/windows/Microsoft.NET/Framework/v2.0.5277 中找到该文件,也可以简单的拷贝sos.dll文件到调试目录中即可。

Loading SOS

windbg命令窗口中键入 .load <path to sos>/sos.dll 来装载SOS;或通过 .loadby sos mscorwks (将从framework目录中加载)来加载;也可将sos文件拷贝到windbg的目录中,只需要键入 .load sos 加载 

Setting up symbols

符号特征文件是为 本地/dotnet 调试充分条件,也可以查看 本地/dotnet 的堆栈部分内容。可以查看如下地址查看更多的信息:

http://blogs.msdn.com/tess/archive/2005/12/05/why-do-i-get-weird-function-names-on-my-stack-a-discussion-on-symbols.aspx

可以在windbg命令行中运行如下命令来设置符号文件路径:

.symfix c:/mycache

.reload

其中 c:/mycache 是本地符号文件的缓存路径。如果在windbg中选择存储工作空间信息,符号文件也会保存以便下次调试时使用。

Tinyget

“TinyGet 5.2(TinyGet.exe)” 是一个命令行工具,支持多线程和缓冲池的超文本客户端,可以使用 TinyGet 工具来测试、跟踪使用http的从客户端到服务端通讯。通过 TinyGet ,可以通过不同影响因素来自定义测试请求,包括用户验证方法、HTTP 版本和输出格式。可以使用脚本定制循环次数或多线程问题:

查看 http://support.microsoft.com/kb/840671/ 以获取更多的信息。

 

熟悉 soswindbg 命令也是有帮助的,如下的引用文章也是非常有用的:

Install Windbg

Getting started - Part I

Getting started - Part II

Advanced commands

 

 

 

 

其他的实验指南:

实验指南

实验过程

.NET Debugging Demos Lab 1: Hang

Walkthrough 

.NET Debugging Demos Lab 2: Crash

Walkthrough

.NET Debugging Demos Lab 3: Memory

Walkthrough

.NET Debugging Demos Lab 4: High CPU hang

Walkthrough

.NET Debugging Demos Lab 5: Crash

Walkthrough

.NET Debugging Demos Lab 6: Memory Leak

Walkthrough

.NET Debugging Demos Lab 7: Memory Leak

Walkthrough

 

附件:BuggyBits.zip

 

 

【附录1】:这是一系列的10.net 调试实验中的第一个,这个实验会使用一个叫 BuggyBits 站点;

 

 

目录
相关文章
|
7月前
|
安全 C# 开发工具
模拟.NET应用场景,综合应用反编译、第三方库调试、拦截、一库多版本兼容方案
模拟.NET实际应用场景,综合应用三个主要知识点:一是使用dnSpy反编译第三库及调试,二是使用Lib.Harmony库实现第三库拦截、伪造,三是实现同一个库支持多版本同时引用。
模拟.NET应用场景,综合应用反编译、第三方库调试、拦截、一库多版本兼容方案
|
7月前
|
算法 编译器 API
|
9月前
|
开发框架 .NET C#
Visual Studio Code调试和发布ASP.NET Core Web应用
Visual Studio Code调试和发布ASP.NET Core Web应用
111 0
|
前端开发 API 开发者
.NET Web应用配置本地IIS(实现Visual Studio离线运行与调试
.NET Web应用配置本地IIS(实现Visual Studio离线运行与调试
304 0
.NET Web应用配置本地IIS(实现Visual Studio离线运行与调试
|
JSON 中间件 数据格式
.NET Core使用Source Link提高源代码调试体验和生产效率
.NET Core使用Source Link提高源代码调试体验和生产效率
118 0
.NET Core使用Source Link提高源代码调试体验和生产效率
|
开发框架 NoSQL Java
GDB调试.NET程序实录-.N ET调用.so出现问题怎么解决
GDB调试.NET程序实录-.N ET调用.so出现问题怎么解决
217 0
GDB调试.NET程序实录-.N ET调用.so出现问题怎么解决
|
文件存储 SQL .NET
在 NAS SMB 卷上用 Visual Studio 调试 ASP.NET + SQLServer 项目并部署到 IIS 服务
阿里云 NAS SMB 卷具有高可用高吞吐大容量等特点,可以很好地解决网站和数据库项目的存储问题。本文将介绍如何在 NAS SMB 卷上用 Visual Studio 调试 ASP.NET + SQLServer 项目并把项目部署到 IIS 服务作为正式服务开放出去。
2437 0
在 NAS SMB 卷上用 Visual Studio 调试 ASP.NET + SQLServer 项目并部署到 IIS 服务