<?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>Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx</link><description>When you debug asp.net applications it is often useful to find out which requests are currently executing, how long they have been executing, what the querystring was etc. Since getting this information from a dump can be a long and tedious process even</description><dc:language>sv-SE</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#4890061</link><pubDate>Thu, 13 Sep 2007 10:40:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4890061</guid><dc:creator>LosManos</dc:creator><description>&lt;p&gt;hejdig.&lt;/p&gt;
&lt;p&gt;I would bet you 1600 comes from the conversion from julian to gregorian date system. &amp;nbsp;1600 is not the first gregorian year but something like the first leap year.&lt;/p&gt;
&lt;p&gt;See more about the gregorian calendar at:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.answers.com/topic/gregorian-calendar"&gt;http://www.answers.com/topic/gregorian-calendar&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Search for Sweden for the history about when Sweden changed their calendar. &amp;nbsp;Marvellous lack of thinking. &amp;nbsp;And a headache for historians who get high on exact dates.&lt;/p&gt;
&lt;p&gt;Thanks for a really good blog.&lt;/p&gt;
&lt;p&gt;/OF&lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#4900255</link><pubDate>Fri, 14 Sep 2007 00:03:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4900255</guid><dc:creator>Thiago</dc:creator><description>&lt;p&gt;Really helpful script!&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#4901246</link><pubDate>Fri, 14 Sep 2007 01:22:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4901246</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;p&gt;Very nice script, Tess! :)&lt;/p&gt;
&lt;p&gt;Have you tried to use PowerShell? &lt;/p&gt;
&lt;p&gt;I'm using PowerShell to create WinDbg scripts. This approach has several benefits and opens endless possibilities. &lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#4916352</link><pubDate>Fri, 14 Sep 2007 22:52:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4916352</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Thanks for the links on the gregorian calendar... really interesting. &amp;nbsp;It appears that the reason it is 1600 years off probably has to do with exactly this... and that the CLR bases the ticks on 1/1 0001 (SYSTEM TIME) while WinDbg goes by FILETIME which is (ticks since 1/1 1601)&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/oldnewthing/archive/2003/09/05/54806.aspx"&gt;http://blogs.msdn.com/oldnewthing/archive/2003/09/05/54806.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;About PowerShell,&lt;/p&gt;
&lt;p&gt;I looked at it some time ago and I have written some scripts for it, but for things like this where a regular windbg script works well i feel that it is a bit of overkill using powershell... especially since you have to install powershell and do a bit of prework before you can use it... &amp;nbsp; For larger scripts I find it extremely interesting though...&lt;/p&gt;
</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#4941837</link><pubDate>Sun, 16 Sep 2007 17:29:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4941837</guid><dc:creator>Brian</dc:creator><description>&lt;p&gt;Would it be possible to write a pre-processing script that could figure out the offsets rather than having them hardcoded?&lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#4951856</link><pubDate>Mon, 17 Sep 2007 10:15:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4951856</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Hi Brian,&lt;/p&gt;
&lt;p&gt;yes absolutely,&lt;/p&gt;
&lt;p&gt;you can run !name2ee System.Web.HttpContext and parse the output.&lt;/p&gt;
&lt;p&gt;I didn't do it here because I wanted to do something that was fairly easy to write and read, plus the extra pre-processing would happen on every run of the script... I figured that typically when you debug your own servers you will stay at one version for a while. &amp;nbsp; &lt;/p&gt;
&lt;p&gt;If you happen to write a script with pre-processing, please post it though since I and I am sure a lot of people reading this would find it very interesting.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;
</description></item><item><title>Debugging Script: Dumping out ASP.NET Session Contents</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#4976346</link><pubDate>Tue, 18 Sep 2007 13:49:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4976346</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;In my last post I wrote a script to dump out all the ASP.NET requests on the heap. Since one of the most&lt;/p&gt;
</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#5024234</link><pubDate>Fri, 21 Sep 2007 05:45:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5024234</guid><dc:creator>Brian Hartung</dc:creator><description>&lt;p&gt;&amp;gt;&amp;gt; If you happen to write a script with pre-processing, please post it though since I and I am sure a lot of people reading this would find it very interesting.&lt;/p&gt;
&lt;p&gt;Well, since you asked...and considering all the help you've given us over the years, how could I turn down a request like that! &amp;nbsp;What an exercise in frustration learning the scripting language turned out to be. &amp;nbsp;But at least now I feel reasonably comfortable with it.&lt;/p&gt;
&lt;p&gt;It will be interesting to see what this code looks like since I'm posting it here in the Comments box...&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;-Brian&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Title:	GetOffsetsForDumpAllRequestsScript.txt&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Description: Used to compute CLR version-specific offsets for ASP.NET&lt;/p&gt;
&lt;p&gt;$$		objects queried by the &amp;quot;DumpAllRequests&amp;quot; script written&lt;/p&gt;
&lt;p&gt;$$		by Tess Ferrandez (&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/tess"&gt;http://blogs.msdn.com/tess&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Author:	If this script works, it was written by Brian Hartung (brian AT hartungconsulting DOT com)&lt;/p&gt;
&lt;p&gt;$$ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If not, I don't know who wrote it.&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Run As:	$&amp;gt;&amp;lt;c:\tools\extensions\ComputeOffsetsForDumpAllRequestsScript.txt&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ License:	Public domain. &amp;nbsp;Do with this script what you will (I won't be offended).&lt;/p&gt;
&lt;p&gt;$$ Dump a CLR version header&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 0 (token {!eeversion})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;$$ Auto-generated offsets for DumpAllRequests.txt script\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;$$ CLR Version ${token}\n\n&amp;quot;;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;$$ All of the following sections use the same basic pattern. &amp;nbsp;First an EEClass address&lt;/p&gt;
&lt;p&gt;$$ is computed for a class and stored in a user-defined property. &amp;nbsp;Next, the EEClass is&lt;/p&gt;
&lt;p&gt;$$ dumped and the output is scanned looking for a specific property name. &amp;nbsp;We make use&lt;/p&gt;
&lt;p&gt;$$ of the .shell directive and the standard Windows findstr.exe utility (which supports&lt;/p&gt;
&lt;p&gt;$$ searching using regular expresssions). &amp;nbsp;Although the use of .shell results in a good&lt;/p&gt;
&lt;p&gt;$$ deal of screen flicker, it's quite a bit faster than iterating over the entire output&lt;/p&gt;
&lt;p&gt;$$ stream and tokenizing it using .foreach since it limits the results to the single row&lt;/p&gt;
&lt;p&gt;$$ we're interested in. &amp;nbsp;This also has the benefit of being more resilient to CLR version&lt;/p&gt;
&lt;p&gt;$$ changes. &amp;nbsp;The sos.dll debugger extension could have breaking changes made to it, such as&lt;/p&gt;
&lt;p&gt;$$ adding a column to the right of the member name in !dumpclass or changing the column order&lt;/p&gt;
&lt;p&gt;$$ such that Offset is not the third column, but this seems less likely than new members being&lt;/p&gt;
&lt;p&gt;$$ added to a class (which would break any techniques that search for a known token name&lt;/p&gt;
&lt;p&gt;$$ and index from that to obtain the Offset value...this is because the offset column appears&lt;/p&gt;
&lt;p&gt;$$ earlier in the stream than the property name, so one (fragile) technique would be to search&lt;/p&gt;
&lt;p&gt;$$ for a token that's expected to be at the end of the immediately preceding row and then index&lt;/p&gt;
&lt;p&gt;$$ forward from there. &amp;nbsp;The find.exe utility was not used because it will produce partial matches&lt;/p&gt;
&lt;p&gt;$$ and the algorithm here depends on an exact match on the property name. &amp;nbsp;As a final note, the&lt;/p&gt;
&lt;p&gt;$$ !dumpclass command was used rather than !dumpobject because 1) it doesn't require having a&lt;/p&gt;
&lt;p&gt;$$ reference to a live object and 2) its output would also include value type members.&lt;/p&gt;
&lt;p&gt;$$ As a final note, the fact that the .shell directive caused all that annoying screen flashing&lt;/p&gt;
&lt;p&gt;$$ caused me to have the result of this script be the generation of a block of script that could&lt;/p&gt;
&lt;p&gt;$$ be pasted at the top of the DumpAllRequests script rather than having it run each time. &amp;nbsp;That&lt;/p&gt;
&lt;p&gt;$$ means each time a new version of the CLR is installed, this stub will have to be regenerated&lt;/p&gt;
&lt;p&gt;$$ and re-pasted. &amp;nbsp;If the screen flashing is less of a concern than having up-to-the-minute offset&lt;/p&gt;
&lt;p&gt;$$ values, then simply remove the .printf directives that surround the aS commands which would&lt;/p&gt;
&lt;p&gt;$$ cause them to be executed and stored in user-defined properties at runtime rather than simply&lt;/p&gt;
&lt;p&gt;$$ displayed for copying-and-pasting purposes. &amp;nbsp;Of course, anyone choosing to go that route will&lt;/p&gt;
&lt;p&gt;$$ hopefully not have a problem with photosensitive seizures. &amp;nbsp;Don't say I didn't warn you...&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Compute required HttpContext member offsets&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!name2ee System.Web.dll System.Web.HttpContext&amp;quot; findstr /r ^EEClass:}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 1 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.block {aS HttpContextEEClass 0x${token}}&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!dumpclass ${HttpContextEEClass}&amp;quot; findstr /r _timeout$}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 2 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;.block {aS HttpContextTimeoutOffset 0x${token}}\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Compute required ISAPIWorkerRequest member offsets&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!name2ee System.Web.dll System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6&amp;quot; findstr /r ^EEClass:}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 1 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.block {aS ISAPIWorkerRequestEEClass 0x${token}}&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!dumpclass ${ISAPIWorkerRequestEEClass}&amp;quot; findstr /r _startTime$}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 2 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;.block {aS ISAPIWorkerRequestStartTimeOffset 0x${token}}\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Compute required HttpResponse member offsets&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!name2ee System.Web.dll System.Web.HttpResponse&amp;quot; findstr /r ^EEClass:}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 1 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.block {aS HttpResponseEEClass 0x${token}}&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!dumpclass ${HttpResponseEEClass}&amp;quot; findstr /r _completed$}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 2 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;.block {aS HttpResponseCompletedOffset 0x${token}}\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!dumpclass ${HttpResponseEEClass}&amp;quot; findstr /r _statusCode$}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 2 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;.block {aS HttpResponseStatusCodeOffset 0x${token}}\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Compute required HttpRequest member offsets&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!name2ee System.Web.dll System.Web.HttpRequest&amp;quot; findstr /r ^EEClass:}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 1 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.block {aS HttpRequestEEClass 0x${token}}&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!dumpclass ${HttpRequestEEClass}&amp;quot; findstr /r _httpVerb$}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 2 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;.block {aS HttpRequestHttpVerbOffset 0x${token}}\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!dumpclass ${HttpRequestEEClass}&amp;quot; findstr /r _path$}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 2 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;.block {aS HttpRequestPathOffset 0x${token}}\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;.block {as gtCommand .shell -ci &amp;quot;!dumpclass ${HttpRequestEEClass}&amp;quot; findstr /r _queryStringText$}&lt;/p&gt;
&lt;p&gt;.block&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	.foreach /pS 2 (token {${gtCommand}})&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;.block {aS HttpRequestQueryStringTextOffset 0x${token}}\n&amp;quot;&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;$$ Clear out the user-defined aliases so we don't leave garbage lying around&lt;/p&gt;
&lt;p&gt;ad /q *&lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#5026241</link><pubDate>Fri, 21 Sep 2007 09:19:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5026241</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Awesome stuff... thank you much for posting it Brian&lt;/p&gt;
</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#5057384</link><pubDate>Sat, 22 Sep 2007 19:56:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5057384</guid><dc:creator>Brian Hartung</dc:creator><description>&lt;p&gt;I created another WinDbg script which hopefully you might find useful. &amp;nbsp;The idea is that when you run a command and parse the output tokens using the .foreach command, it's not always possible to index into the stream using a fixed offset, but rather it might be useful to search for a known value and then index a fixed number of tokens from there. &amp;nbsp;I created a script called GetToken for just such a purpose. &amp;nbsp;Because scripts don't seem to post too well in these Comments (extra line breaks, loss of indentation, etc.), I have also posted a copy on my blog (&lt;a rel="nofollow" target="_new" href="http://brianhartung.blogspot.com/2007/09/useful-windbg-script-gettoken.html"&gt;http://brianhartung.blogspot.com/2007/09/useful-windbg-script-gettoken.html&lt;/a&gt;) which should retain all the formatting.&lt;/p&gt;
&lt;p&gt;Instructions for usage, parameters and outputs are embedded in the comments.&lt;/p&gt;
&lt;p&gt;Hope you find this useful,&lt;/p&gt;
&lt;p&gt;-Brian&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ GetToken:	A helper function used to run a specified command, search for a&lt;/p&gt;
&lt;p&gt;$$		specified token value in the output stream from the command and&lt;/p&gt;
&lt;p&gt;$$		then return the nth token following that specified search value&lt;/p&gt;
&lt;p&gt;$$		in a specified alias name.&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Returns:	1) The value of the nth token in the specified alias&lt;/p&gt;
&lt;p&gt;$$		2) A status code in $t0 (0 = Token Not Found / 1 = Token Found)&lt;/p&gt;
&lt;p&gt;$$		3) The offset to the specified search token in $t1&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Written by:	If this code works, it was written by Brian Hartung. &amp;nbsp;If not, I&lt;/p&gt;
&lt;p&gt;$$		don't know who wrote it.&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Run As:	$$&amp;gt;a&amp;lt; c:\tools\extensions\GetToken.txt &amp;quot;CommandToRun&amp;quot; &amp;quot;SearchValue&amp;quot; 0xn ReturnAlias&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Example:	To return the address of the EEClass for HttpContext, use these parameters:&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$		&amp;quot;!name2ee System.Web.dll System.Web.HttpContext&amp;quot; &amp;quot;EEClass:&amp;quot; 1 HttpContextEEClass&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Notes:	1) the value for parameter n must be specified in hex&lt;/p&gt;
&lt;p&gt;$$		2) the last two parameters must not have quotes&lt;/p&gt;
&lt;p&gt;$$		3) the alias name specified for returning the value must not already be defined&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ License:	Public Domain. &amp;nbsp;Do with this script what you will (I won't be offended).&lt;/p&gt;
&lt;p&gt;$$&lt;/p&gt;
&lt;p&gt;$$ Reset $t0 which will be used to return a success (1) or failure (0) status code&lt;/p&gt;
&lt;p&gt;r $t0=0&lt;/p&gt;
&lt;p&gt;$$ Reset $t1 which will be used as a token counter&lt;/p&gt;
&lt;p&gt;r $t1=0&lt;/p&gt;
&lt;p&gt;$$ Loop through the tokens returned by the command supplied in arg1&lt;/p&gt;
&lt;p&gt;.foreach (token {$arg1})&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	$$ The string comparison function $scmp returns 0 if the strings match.&lt;/p&gt;
&lt;p&gt;	$$ In this case, we're looking to see if the current token matches the&lt;/p&gt;
&lt;p&gt;	$$ search value supplied in arg2&lt;/p&gt;
&lt;p&gt;	.if($scmp(&amp;quot;${token}&amp;quot;, &amp;quot;$arg2&amp;quot;)==0)&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		$$ Compute the total offset to the desired token, which is the&lt;/p&gt;
&lt;p&gt;		$$ index of the search token plus the number of tokens to skip&lt;/p&gt;
&lt;p&gt;		$$ as specified in arg3&lt;/p&gt;
&lt;p&gt;		.block {r $t1 = @$t1 + ${$arg3}}&lt;/p&gt;
&lt;p&gt;		$$ Skip directly to the desired token&lt;/p&gt;
&lt;p&gt;		.foreach /pS $t1 (returnValue {$arg1})&lt;/p&gt;
&lt;p&gt;		{&lt;/p&gt;
&lt;p&gt;			$$ Store the current token in the specified return value alias&lt;/p&gt;
&lt;p&gt;			.block {aS ${$arg4} ${returnValue}}&lt;/p&gt;
&lt;p&gt;			$$ No need to consider any more tokens&lt;/p&gt;
&lt;p&gt;			.break&lt;/p&gt;
&lt;p&gt;		}&lt;/p&gt;
&lt;p&gt;		$$ Return the success status code&lt;/p&gt;
&lt;p&gt;		r $t0 = 1&lt;/p&gt;
&lt;p&gt;		.break&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;	.else&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		$$ Haven't found it yet, so keep incrementing the counter until we do&lt;/p&gt;
&lt;p&gt;		r $t1 = $t1 + 1&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#5089786</link><pubDate>Mon, 24 Sep 2007 09:19:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5089786</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;Again, really cool... &amp;nbsp;thank you very much for posting these Brian, &amp;nbsp;this latest one will be really useful... &lt;/p&gt;
</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#6192190</link><pubDate>Wed, 14 Nov 2007 06:05:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6192190</guid><dc:creator>Vishwas</dc:creator><description>&lt;p&gt;awesome post!!&lt;/p&gt;
&lt;p&gt;for the boolean values - it looks like only the last bit is counted for whether the value is true or false. So for Completed status, &lt;/p&gt;
&lt;p&gt;	.foreach /pS 1 (token {dd poi(${hc}+0x14)+61 l1}){&lt;/p&gt;
&lt;p&gt;		.if (${token} == 0) {&lt;/p&gt;
&lt;p&gt;			.printf &amp;quot;No\t\t&amp;quot;&lt;/p&gt;
&lt;p&gt;		} &lt;/p&gt;
&lt;p&gt;		.else {&lt;/p&gt;
&lt;p&gt;			.printf &amp;quot;Yes\t\t&amp;quot;&lt;/p&gt;
&lt;p&gt;		}&lt;/p&gt;
&lt;p&gt;	};	&lt;/p&gt;
&lt;p&gt;will say completed even if the vlaue at that address is 00000100, which is false or the request is incomplete. &lt;/p&gt;
&lt;p&gt;Instead what worked for me was - &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.if ($spat(&amp;quot;${token}&amp;quot;, &amp;quot;???????1&amp;quot;)){&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.printf &amp;quot;Yes\n&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.else{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.printf &amp;quot;No\n&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}	&lt;/p&gt;
&lt;p&gt;Do correct me if I am wrong, since I am a newbie to windbg and whatever I have learnt about scripts for windbg is from this post :). &lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#6250311</link><pubDate>Thu, 15 Nov 2007 12:11:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6250311</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;great, &amp;nbsp;yeah the scripts are a bit quick and dirty so i'm not surprised if there are issues with them on different versions.&lt;/p&gt;
&lt;p&gt;THanks for the correction&lt;/p&gt;
</description></item><item><title>Case Study: ASP.NET Deadlock calling WebServices</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#6797359</link><pubDate>Tue, 18 Dec 2007 18:31:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6797359</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;Lately, no matter where you turn there is LINQ presentations and Silverlight demos. A couple of years&lt;/p&gt;
</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#7218512</link><pubDate>Thu, 24 Jan 2008 11:37:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7218512</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;I wrote in the blog post &amp;quot;Another curiosity is that providing an initial skip to .foreach that is larger than 9 causes no tokens to be returned&amp;quot; &amp;nbsp;and I just got a note from Dan Wilson explaining this curiosity to me... apparently the value you give for the initial skip is hexadecimal (rather than decimal like i thought), so initial skips over 9 work just fine, its just a matter of giving the value in hex instead of decimal...&lt;/p&gt;
&lt;p&gt;Thanks much Dan for that insight, makes it a lot easier to write scripts since you dont have to nest the .foreach loops&lt;/p&gt;
</description></item><item><title>September 16th Links: ASP.NET, ASP.NET AJAX, IIS7, Visual Studio, Silverlight</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#7919906</link><pubDate>Wed, 27 Feb 2008 19:39:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7919906</guid><dc:creator>rox19840702</dc:creator><description>&lt;p&gt;September 16th Links: ASP.NET, ASP.NET AJAX, IIS7, Visual Studio, Silverlight&lt;/p&gt;
</description></item><item><title>Why are some commands missing in sos for 2.0 compared to sos for 1.1?</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#8441706</link><pubDate>Wed, 30 Apr 2008 09:27:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8441706</guid><dc:creator>If broken it is, fix it you should</dc:creator><description>&lt;p&gt;This question that I got from a reader is something that I get asked pretty frequently... &amp;quot;I met a small&lt;/p&gt;
</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#8606038</link><pubDate>Mon, 16 Jun 2008 19:57:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8606038</guid><dc:creator>Kumar</dc:creator><description>&lt;p&gt;Hi Tess&lt;/p&gt;
&lt;p&gt;Just wondering if adding this pre condition to the scripts above would ensure that only &amp;quot;HttpContext&amp;quot; objects are processed as !dumpheap can potentially return all types which have HttpContext in their name like HttpContextWrapper&lt;/p&gt;
&lt;p&gt;$$ FIND THE MT Address for HttpContext&lt;/p&gt;
&lt;p&gt;r @$t0=0;&lt;/p&gt;
&lt;p&gt;.foreach /pS 6 /ps 100 (tokenMT {!name2ee System.Web.dll System.Web.HttpContext})&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	r$t0 = ${tokenMT};&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;$$ LOOP THROUGH ALL HTTP CONTEXTS THAT ARE STILL ON THE HEAP &lt;/p&gt;
&lt;p&gt;$$ ---------------------------------------------------------------------------------- &lt;/p&gt;
&lt;p&gt;.foreach (hc {!dumpheap -mt @$t0 -short})&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Also I'm curious why virtual path extraction is done using nested .foreach as &lt;/p&gt;
&lt;p&gt;.foreach /pS 2 (tk {.foreach /pS 9 (token {!do -nofields poi(poi(poi(${hc}+0x10)+14)+8)}){.printf &amp;quot;${token} &amp;quot;}}) {&lt;/p&gt;
&lt;p&gt;		.printf &amp;quot;${tk}&amp;quot;&lt;/p&gt;
&lt;p&gt;	};&lt;/p&gt;
&lt;p&gt;instead of &lt;/p&gt;
&lt;p&gt;.foreach /pS 11 (token {!do -nofields 025c0384}){.printf &amp;quot;${token} \n&amp;quot;}&lt;/p&gt;
&lt;p&gt;Am I missing something here?&lt;/p&gt;
&lt;p&gt;Many thanks&lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#8895209</link><pubDate>Tue, 26 Aug 2008 00:58:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8895209</guid><dc:creator>PBSurfRider</dc:creator><description>&lt;p&gt;Can someone please explain how to run this script? &amp;nbsp;I installed WinDbg and saved the script to a txt file. &amp;nbsp;Now what? &amp;nbsp;There's no command line entry anywhere...&lt;/p&gt;</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#8896264</link><pubDate>Tue, 26 Aug 2008 08:59:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8896264</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;You would have to attach to an asp.net process (w3wp.exe) or open a dump of a w3wp.exe process and then run the script from the windbg commandline (the command prompt at the bottom of windbg) like this &lt;/p&gt;
&lt;p&gt;$&amp;gt;&amp;lt;c:\tools\DumpRequests.txt&lt;/p&gt;
&lt;p&gt;Replacing the path with your own path&lt;/p&gt;
</description></item><item><title>re: Debugging Script: Dumping out current and recent ASP.NET Requests</title><link>http://blogs.msdn.com/tess/archive/2007/09/12/debugging-script-dumping-out-current-and-recent-asp-net-requests.aspx#9932060</link><pubDate>Thu, 03 Dec 2009 16:55:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9932060</guid><dc:creator>Kevin Goff</dc:creator><description>&lt;p&gt;Very helpful. &amp;nbsp;Too bad !aspxpages isnt available for 2.x. &amp;nbsp;Will try and adapt this to the version I'm running.&lt;/p&gt;</description></item></channel></rss>