<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Digging deeper into managed code with Visual Studio:  Using SOS</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx</link><description>I have let my blog laps for too long. I am back to blogging. I realized reciently that we have simply not written down many interesting facts about how the runtime actually works. I want to fix this. Coming up in future blogs I am going to be doing a</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Digging deeper into managed code with Visual Studio:  Using SOS</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#742399</link><pubDate>Wed, 06 Sep 2006 11:14:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:742399</guid><dc:creator>barrkel</dc:creator><description>Great info! Thanks.&lt;br&gt;&lt;br&gt;BTW, when using windbg + sos to debug, what breakpoint (native: bp / bu) is best to set in order to use managed breakpoints (thus both !name2ee and !bpmd probably needed)? With a breakpoint on loading of mscorwks or calling of various CLR functions, when is the CLR booted up enough so that !name2ee etc. can work?</description></item><item><title>re: Digging deeper into managed code with Visual Studio:  Using SOS</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#742937</link><pubDate>Wed, 06 Sep 2006 19:46:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:742937</guid><dc:creator>vancem</dc:creator><description>The subject of using SOS in windbg will be the subject of a future blog, however, I can quickly answer your question. &amp;nbsp; &amp;nbsp;&lt;br&gt;The !bpmd (Breakpoint MethodDescriptor), is a command that will set a breakpoint on a managed method by name. &amp;nbsp; For example in the example the command&lt;br&gt;&lt;br&gt; &amp;nbsp; &amp;nbsp;!bpmd &amp;nbsp;InspectingManagedCode.exe Program.Main&lt;br&gt;&lt;br&gt;Will set a breakpoint in the ‘Main’ routine of the example program in the ZIP file. &amp;nbsp; Note that UNLIKE the !name2ee SOS command (which looks up a method, or class by name), the method being referenced in the !BPMD command does NOT need to be loaded to work (it sets a ‘deferred’ breakpoint).&lt;br&gt; &amp;nbsp;&lt;br&gt;However to use ANY SOS command, you need to load SOS, and it turns out that SOS needs the .NET runtime dlls ‘mscorwks.dll’ to be loaded before it can load. &amp;nbsp; There are a variety of techniques you can use. &amp;nbsp; &amp;nbsp;The one I use is&lt;br&gt;&lt;br&gt; &amp;nbsp; &amp;nbsp;bu mscorwks!EEStartup&lt;br&gt;&lt;br&gt;This sets a breakpoint at the ‘EEStartup’ method in the .NET runtime DLL ‘mscorwks. &amp;nbsp; When this breakpoint hits you can do the command&lt;br&gt;&lt;br&gt; &amp;nbsp; &amp;nbsp;.loadby sos mscorwks&lt;br&gt;&lt;br&gt;Which tells windbg to load the sos.dll by searching the in the directory where mscorwks lives. &amp;nbsp;Once loaded you can execute a ! bpmd &amp;nbsp;command.&lt;br&gt;&lt;br&gt;Finally if you need !name2ee to work and the module is not yet loaded, you should set a breakpoint (using !bpmd &amp;nbsp;command), in the module of interest, run to that breakpoint (now it is loaded), and then do the !name2ee command. &amp;nbsp;&lt;br&gt;</description></item><item><title>Useful Links</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#2821209</link><pubDate>Wed, 23 May 2007 21:59:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2821209</guid><dc:creator>Andy's Biztalk &amp; BAM Blog</dc:creator><description>&lt;p&gt;.NET Programming and Practices Programming with .NET Best Practices for Handling Exceptions Patterns&lt;/p&gt;
</description></item><item><title>.Net B/S结构程序资源索引</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#4039703</link><pubDate>Wed, 25 Jul 2007 11:16:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4039703</guid><dc:creator>PrideRoCK</dc:creator><description>&lt;p&gt;.net b/s 结构程序性能优化索引 如何最大限度提高.NET的性能 如何最大限度提高.NET的性能(续) 客户端调用服务器端方法——ASP.NET AJAX(Atlas)、Anthem.NET和Ajax.NET Professional实现之小小比较 net b/s 数据库Microsoft SqlServer 2005 优化索引 SQL Server性能调优入门(图文版) 怎么捅破那层纸? 怎么捅破那层纸?(续) Sql Server Performance Tuning(捅破窗户纸续2)..&lt;/p&gt;
</description></item><item><title>Paradigms around Debugging Memory leaks</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#4905996</link><pubDate>Fri, 14 Sep 2007 09:28:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4905996</guid><dc:creator>Mike Stall's .NET Debugging Blog</dc:creator><description>&lt;p&gt;In native code, memory is explicitly managed by the program calling Malloc()/Free() (or comparable APIs).&lt;/p&gt;
</description></item><item><title>MSDN Blog Postings  &amp;raquo; Paradigms around Debugging Memory leaks</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#4906815</link><pubDate>Fri, 14 Sep 2007 11:04:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4906815</guid><dc:creator>MSDN Blog Postings  » Paradigms around Debugging Memory leaks</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://msdnrss.thecoderblogs.com/2007/09/14/paradigms-around-debugging-memory-leaks/"&gt;http://msdnrss.thecoderblogs.com/2007/09/14/paradigms-around-debugging-memory-leaks/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Digging deeper into managed code with Visual Studio:  Using SOS</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#7637480</link><pubDate>Tue, 12 Feb 2008 13:06:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7637480</guid><dc:creator>ananda84</dc:creator><description>&lt;p&gt;Good information.&lt;/p&gt;
&lt;p&gt;Is it possible to set breakpoint on native api functions like kernel32!CreateFileW using VS 2005+SOS?&lt;/p&gt;
</description></item><item><title>Casting using [isinst] and [castclass]</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#8541826</link><pubDate>Sat, 24 May 2008 00:48:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8541826</guid><dc:creator>Code Details</dc:creator><description>&lt;p&gt;Much has been written about casting in .NET and how the various options we have at our disposal affect&lt;/p&gt;
</description></item><item><title>   Advanced Debugging Resources  : ????????????????????? TAHETA.ORG</title><link>http://blogs.msdn.com/vancem/archive/2006/09/05/742062.aspx#9341712</link><pubDate>Tue, 20 Jan 2009 05:59:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9341712</guid><dc:creator>   Advanced Debugging Resources  : ????????????????????? TAHETA.ORG</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.taheta.org/?p=192"&gt;http://www.taheta.org/?p=192&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>