<?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>[PowerShell Script] Saving a Module from a .NET Method Call</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx</link><description>This is my first script using the PowerDbg functions. It’s a good example of how to use PowerDbg to build your own scripts. PowerDbgScriptSaveModule . ps1 is the PowerShell version of my Windbg script Save_Module.txt Actually it does more than the previous</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: [PowerShell Script] Saving a Module from a .NET method call</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#4854233</link><pubDate>Mon, 10 Sep 2007 19:15:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4854233</guid><dc:creator>nativecpp</dc:creator><description>&lt;p&gt;Hi Roberto,&lt;/p&gt;
&lt;p&gt;I have a general question on .Net and I thought you may have some ideas on how to solve this:&lt;/p&gt;
&lt;p&gt;Let say I have an app that I use try/catch to catch some system.exception such as division by zero. After catching this error, I could get the current stack frame from my app. Is there a way to dump the contents of all local vars (w/o var names) and params w/o using windbg (and SOS) and symbols. &lt;/p&gt;
&lt;p&gt;I tried to use reflection but seems there is not much I could do in reflection.&lt;/p&gt;
&lt;p&gt;If you could give me some ideas or link to some documents, I would appreciate that.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>re: [PowerShell Script] Saving a Module from a .NET method call</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#4854948</link><pubDate>Mon, 10 Sep 2007 20:19:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4854948</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;P&gt;Hi nativecpp,&lt;/P&gt;
&lt;P&gt;Without using Windbg and symbols I'd think about logging trace information.&lt;/P&gt;
&lt;P&gt;Within the catch block you could log the stack trace and frames using System.Diagnostics:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.diagnostics.stackframe.aspx" target=_new rel=nofollow&gt;http://msdn2.microsoft.com/en-us/library/system.diagnostics.stackframe.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.diagnostics.stacktrace.aspx" target=_new rel=nofollow&gt;http://msdn2.microsoft.com/en-us/library/system.diagnostics.stacktrace.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Besides your methods could save the content from the local variables or the most important local variables.&lt;/P&gt;
&lt;P&gt;Then when you check the log file or Event log you will have the stack trace and the most important local variables.&lt;/P&gt;
&lt;P&gt;It is a proactive approach using trace information: the application itself logs the stack from the exception and, as part of the execution flow, the important variables are always logged at different points of the same method call. When you analyze the log you will have the stack trace and the local variables from all stack frames in previous log entries.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description></item><item><title>re: [PowerShell Script] Saving a Module from a .NET method call</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#4857875</link><pubDate>Tue, 11 Sep 2007 03:00:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4857875</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;p&gt;Attention! I just fixed two minor bugs:&lt;/p&gt;
&lt;p&gt;- The MetaData start address was not being displayed.&lt;/p&gt;
&lt;p&gt;- The !dumpmodule was replaced by !DumpModule because I had some problems with our internal SOS version.&lt;/p&gt;
&lt;p&gt;Please, make sure to use this updated version.&lt;/p&gt;</description></item><item><title>re: [PowerShell Script] Saving a Module from a .NET method call</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#4866812</link><pubDate>Tue, 11 Sep 2007 18:24:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4866812</guid><dc:creator>nativecpp</dc:creator><description>&lt;p&gt;Hi Roberto,&lt;/p&gt;
&lt;p&gt;Thanks for the suggestopns. I did use stackframe to log as much info as possible, I think. But I would like to automatically dump at least params and some local vars (may be 1st nth ones)w/o having the catcher to do that.&lt;/p&gt;
&lt;p&gt;I am just wondering if there is a way to do dumping &amp;nbsp;if I have a stack frame and whether I can do follow those SOS commands ??&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>re: [PowerShell Script] Saving a Module from a .NET method call</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#4867527</link><pubDate>Tue, 11 Sep 2007 19:35:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4867527</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;P&gt;Hi nativecpp,&lt;/P&gt;
&lt;P&gt;The local variables and parameters should be logged outside the catch block. Doing so you will end up having information from the local var and parameters aside of having an exception, like I mentioned before.&lt;/P&gt;
&lt;P&gt;Another approach: your application could create a dump when handling a specific exception. To do that it should use MiniDumpWriteDump API function from DBGHELP.DLL.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/ms680360.aspx" target=_new rel=nofollow&gt;http://msdn2.microsoft.com/en-us/library/ms680360.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/bb204861.aspx" target=_new rel=nofollow&gt;http://msdn2.microsoft.com/en-us/library/bb204861.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The SOSEX extension helps to get the local variables: &lt;A href="http://www.stevestechspot.com/SOSEXANewDebuggingExtensionForManagedCode.aspx" target=_new rel=nofollow&gt;http://www.stevestechspot.com/SOSEXANewDebuggingExtensionForManagedCode.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Another approach: Within the catch handler you can use Trace.WriteLine("WINDBGCMD: &amp;lt;execute commands here&amp;gt;"). To do that you need to use .ocommand WINDBGCMD from the debugger window. Using this approach you can attach the debugger to the application and when the exception happens the debugger recognizes the command string prefix WINDBGCMD and execute the commands you want. Doing that you would be able to see the local variables.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description></item><item><title>re: [PowerShell Script] Saving a Module from a .NET Method Call</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#5406487</link><pubDate>Fri, 12 Oct 2007 00:10:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5406487</guid><dc:creator>Joe</dc:creator><description>&lt;p&gt;You scripts are amazing! I&amp;#180;m waiting for the next PowerDbg script.&lt;/p&gt;
&lt;p&gt;Keep doing this great work!&lt;/p&gt;
&lt;p&gt;Joe&lt;/p&gt;</description></item><item><title>[PowerShell Script] Isolating the Threads Consuming High CPU</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#6856877</link><pubDate>Tue, 25 Dec 2007 03:51:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6856877</guid><dc:creator>Debugging Toolbox</dc:creator><description>&lt;p&gt;When helping my customers with scenarios in which the symptom is high CPU, I very often end up with only&lt;/p&gt;
</description></item><item><title>[PowerShell Script] PowerDbg v5.0—Using PowerShell to Control WinDbg</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#9394615</link><pubDate>Wed, 04 Feb 2009 08:05:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9394615</guid><dc:creator>Debugging Toolbox</dc:creator><description>&lt;p&gt;I’m very excited to present the new PowerDbg v5.0! There’s just one change, but it’s a HUGE change that&lt;/p&gt;
</description></item><item><title>[PowerShell Script] PowerDbg v5.1—Using PowerShell to Control WinDbg</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#9491486</link><pubDate>Fri, 20 Mar 2009 03:40:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9491486</guid><dc:creator>Debugging Toolbox</dc:creator><description>&lt;p&gt;So, here we go again. This is a minor version with a few new cmdlets. These new cmdlets are those that&lt;/p&gt;
</description></item><item><title>[PowerShell Script] PowerDbg v5.2—Using PowerShell to Control WinDbg</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2007/09/06/powershell-script-saving-a-module-from-a-net-method-call.aspx#9576003</link><pubDate>Wed, 29 Apr 2009 19:15:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9576003</guid><dc:creator>Debugging Toolbox</dc:creator><description>&lt;p&gt;This version has two improvements and some scripts were changed to be compatible with this new version:&lt;/p&gt;
</description></item></channel></rss>