<?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>Jigar Mehta's Blog : Debugging</title><link>http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx</link><description>Tags: Debugging</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Look at the operating system version and SP details from the dump in WinDbg..</title><link>http://blogs.msdn.com/jigarme/archive/2008/06/04/look-at-the-operating-system-version-and-sp-details-from-the-dump-in-windbg.aspx</link><pubDate>Tue, 03 Jun 2008 21:50:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8571965</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/8571965.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=8571965</wfw:commentRss><description>&lt;p&gt;This is a very common question, we encounter almost all the times.&lt;/p&gt;  &lt;p&gt;Just imagine a situation, we have got a memory dump from somewhere and want to see what operating system which is run there and what SP is installed.. For this, there is a very simple command.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New" size="2"&gt;0:001&amp;gt;&lt;font color="#ff0000"&gt;vertarget&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Windows Server 2003 Version 3790 (Service Pack 2) MP (4 procs) Free x86 compatible       &lt;br /&gt;Product: Server, suite: TerminalServer SingleUserTS        &lt;br /&gt;kernel32.dll version: 5.2.3790.4062 (srv03_sp2_gdr.070417-0203)        &lt;br /&gt;Debug session time: Tue Oct 30 05:54:21.000 2007 (GMT+5)        &lt;br /&gt;System Uptime: 3 days 8:21:53.750        &lt;br /&gt;Process Uptime: 0 days 4:28:05.000        &lt;br /&gt;&amp;#160; Kernel time: 0 days 0:00:34.000        &lt;br /&gt;&amp;#160; User time: 0 days 0:09:37.000&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif" /&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8571965" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>How to change value of register when doing live debugging with Windbg?</title><link>http://blogs.msdn.com/jigarme/archive/2008/06/04/how-to-change-value-of-register-when-doing-live-debugging-with-windbg.aspx</link><pubDate>Tue, 03 Jun 2008 21:46:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8571951</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/8571951.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=8571951</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;Windbg has not only registers reading functionality but it can also modify registers when doing live debugging..&lt;/p&gt;  &lt;p&gt;Its really useful sometimes to modify the register values and take different path to check for particular code branch..&lt;/p&gt;  &lt;p&gt;You can modify the register value like this..&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" size="2"&gt;0:000&amp;gt;&lt;font color="#ff0000"&gt;r @eax=0x80040005&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Above command will modify value of register eax and set it to 0x80040005.&lt;/p&gt;  &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif" /&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8571951" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>What is better way of keeping an eye on last win32 error while debugging?</title><link>http://blogs.msdn.com/jigarme/archive/2008/05/08/what-is-better-way-of-keeping-an-eye-on-last-win32-error-while-debugging.aspx</link><pubDate>Thu, 08 May 2008 20:26:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8473045</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/8473045.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=8473045</wfw:commentRss><description>&lt;p&gt;I have found it necessary many times to keep an eye on last win32 error, while using Win32 APIs in code! (Calling GetLastError() after each API usage is not feasible solution!).. In Visual Studio they have provided a very good small feature. You can write @err,hr in the watch window,&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Whatisbetterwayofkeepinganeyeonlastwin32_14293/05-08-2008%20(225206)_4.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="81" alt="05-08-2008 (225206)" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Whatisbetterwayofkeepinganeyeonlastwin32_14293/05-08-2008%20(225206)_thumb_1.jpg" width="795" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Similarly, you can use another pseudo register @eax for keeping an eye on the function return value! (If you are looking at some Win32 API's return value, you can also do @eax,hr to find out the text message behind the integer..)&lt;/p&gt;  &lt;p&gt;Sometimes these small debugging tips increase significant debugging speed..&lt;/p&gt;  &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif" /&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8473045" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>How can I check the details about Process Token while debugging in Visual Studio?</title><link>http://blogs.msdn.com/jigarme/archive/2008/05/08/how-can-i-check-the-details-about-process-token-while-debugging-in-visual-studio.aspx</link><pubDate>Thu, 08 May 2008 20:04:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8472901</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/8472901.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=8472901</wfw:commentRss><description>&lt;p&gt;Visual Studio 2005 onwards, watch window has got a pseudo register for investigating the details about process token. So, all you have to do is, just start debugging and write &amp;quot;$user&amp;quot; in watch window,&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowcanIcheckthedetailsaboutProcessTokenw_13D78/05-08-2008%20(223012)_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="216" alt="05-08-2008 (223012)" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowcanIcheckthedetailsaboutProcessTokenw_13D78/05-08-2008%20(223012)_thumb.jpg" width="794" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Its interesting to look at expanded view of privileges and groups sometimes!&lt;/p&gt;  &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif" /&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8472901" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Visual Studio 2005 debugging trick..</title><link>http://blogs.msdn.com/jigarme/archive/2007/11/20/visual-studio-2005-debugging-trick.aspx</link><pubDate>Tue, 20 Nov 2007 21:15:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6439436</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/6439436.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=6439436</wfw:commentRss><description>&lt;p&gt;Just now, I found a trick in Visual Studio 2005 to debug pointers in better way. You can ',n' in watch window where 'n' is number of elements to display. I think following snapshot is self explanatory..&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/VisualStudio2005debuggingtrick_14DFD/SHOT0063_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="321" alt="SHOT0063" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/VisualStudio2005debuggingtrick_14DFD/SHOT0063_thumb.jpg" width="612" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6439436" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Interesting windbg command-line parameters..</title><link>http://blogs.msdn.com/jigarme/archive/2007/11/07/interesting-windbg-command-line-parameters.aspx</link><pubDate>Wed, 07 Nov 2007 16:17:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5958841</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5958841.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5958841</wfw:commentRss><description>&lt;p&gt;Here is a list of few interesting command-line parameters and their mapping to interactive commands in windbg..&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Interestingwindbgcommandlineparameters_10842/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="193" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Interestingwindbgcommandlineparameters_10842/image_thumb.png" width="621" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;PS: Taken from &lt;a href="http://www.amazon.com/Advanced-Debugging-Addison-Wesley-Microsoft-Technology/dp/0321374460" target="_blank"&gt;"Advanced Windows Debugging"&lt;/a&gt; (the best debugging book, I have ever come across!!).. Go grab your copy!&lt;/p&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5958841" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>How to install windbg for post-mortem debugging..</title><link>http://blogs.msdn.com/jigarme/archive/2007/11/07/how-to-install-windbg-for-post-mortem-debugging.aspx</link><pubDate>Wed, 07 Nov 2007 16:12:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5958706</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5958706.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5958706</wfw:commentRss><description>&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;I was looking for a way to install windbg as postmortem debugger so that everytime any process crashes or exits unexpectedly, windbg is launched automatically and I can take a look at whats happening there!&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;Windbg has special command line option for installing it as postmortem debugger. Use following command,&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;C:\Program files\Debugging Tools for Windows&amp;gt;&lt;span style="background: yellow"&gt;windbg.exe -IS&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;This will set AeDebug entry as,&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;Path\windbg -p %ld -e %ld -g"&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;If you want to associate .dmp, .mdmp or .wew extensions with windbg (so that when you double click on them in explorer, windbg gets opened automatically), you can use &lt;span style="background: yellow"&gt;-IAS&lt;/span&gt; option.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 8pt; font-family: 'Verdana','sans-serif'"&gt;PS: command-line option -I is for installing windbg as post-mortem debugger. [S] command line option is optional, if used it will not display any success message after executing the option (silently installation), only error messages are propogated..&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 5pt; margin-left: 0in; margin-right: 0in"&gt;&amp;nbsp;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom: 5pt; margin-left: 0in; margin-right: 0in"&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5958706" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Extracting modules (EXE, DLL, and other binaries) from memory dump..</title><link>http://blogs.msdn.com/jigarme/archive/2007/11/07/extracting-modules-exe-dll-and-other-binaries-from-memory-dump.aspx</link><pubDate>Wed, 07 Nov 2007 03:45:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5948022</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5948022.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5948022</wfw:commentRss><description>&lt;div&gt;Yet another debugging challenge.&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;Imagine a situation where you get a memory dump from customer and need modules (DLL, EXE, OCX etc.) to further debug.. (.NET modules can be used to look at source code by reverse engineering..)&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;SOS.dll is at the rescue. We can use clr10\sos.dll inside windbg directory to save all the modules (loaded by target process at the time of taking the memory dump). Interesting fact is, sos.dll can not only extract managed modules, it can also save all the native/unmanaged modules!!&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;First, load the sos.dll in windbg.&lt;/div&gt; &lt;div&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/ExtractingmodulesEXEDLLandotherbinaries_57F5/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="36" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/ExtractingmodulesEXEDLLandotherbinaries_57F5/image_thumb.png" width="278" border="0"&gt;&lt;/a&gt; &lt;/div&gt; &lt;div&gt;Then use !sam &amp;lt;path&amp;gt; OR !SaveAllModule &amp;lt;path&amp;gt; to extract the modules on specific disk location..&lt;/div&gt; &lt;div&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/ExtractingmodulesEXEDLLandotherbinaries_57F5/image_4.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="42" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/ExtractingmodulesEXEDLLandotherbinaries_57F5/image_thumb_1.png" width="274" border="0"&gt;&lt;/a&gt; &lt;/div&gt; &lt;div&gt;Thats it! Mission accomplished. Though, its not a long process, it can be useful in some scenario..&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;PS: Later version of sos.dll does not support !sam, you need to manually extract each and every module by providing the loading address.&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5948022" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>How to debug startup code for a process which is started by some other executable!</title><link>http://blogs.msdn.com/jigarme/archive/2007/11/06/how-to-debug-startup-code-for-a-process-which-is-started-by-some-other-executable.aspx</link><pubDate>Tue, 06 Nov 2007 20:08:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5939885</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5939885.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5939885</wfw:commentRss><description>&lt;p&gt;Yet another debugging challenge..&lt;/p&gt; &lt;p&gt;The problem is, we want to debug the startup code for an application which is run by some other application! e.g. I will open a console (cmd.exe) which in turn opens calc.exe and I want to debug the initial calc.exe code..&lt;/p&gt; &lt;p&gt;Windbg has solution to this problem! When you select "open an executable", you have a small checkbox saying "Debug child processes also" which actually makes sure that all the processes spawned by parent EXE (which you select in this dialog!) are also attached by debugger.&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="360" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_thumb.png" width="433" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;If you are interested in command line option, '-o' option is at disposal.&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_4.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="49" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_thumb_1.png" width="330" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Its only this scenario when '|' command is used (at least in user mode)! Because when we attach to any child processes, it shows the current process being debugged in space left to command line in windbg, as shown below!&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_6.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="68" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_thumb_2.png" width="396" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If you give command | you will be able to see all the processes in list which can be debugged (only one process can be debugged at a time!). You will get output similar to one shown below.&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_8.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="159" alt="image" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtodebugstartupcodeforaprocesswhichiss_13E4D/image_thumb_3.png" width="382" border="0"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;We can also move between different processes by using |&amp;lt;number&amp;gt;s command. e.g. in above example, if we want to go back to debug cmd.exe, we have to give command |0s.&amp;nbsp; &lt;/p&gt; &lt;p&gt;PS: This works only if you are opening (spawning) parent executable.. 'Attach to process' does not have this option of debugging all child processes!&lt;/p&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5939885" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>How to look at value of structure object who is member of Class object while debugging in WinDbg??</title><link>http://blogs.msdn.com/jigarme/archive/2007/10/29/how-to-look-at-value-of-structure-object-who-is-member-of-class-object-while-debugging-in-windbg.aspx</link><pubDate>Mon, 29 Oct 2007 05:03:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5752624</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5752624.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5752624</wfw:commentRss><description>&lt;p&gt;Sometimes when you debug applications, it happens that you have got the pointer to class which has few member variables including structures and another class objects! How to look at values of those inner class/structure variable's members?? So, here is the tip. &lt;/p&gt; &lt;p&gt;Following is the code being used for demonstrating commands.&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;struct&lt;/span&gt; testStruct&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; i;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;char&lt;/span&gt; ch;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;long&lt;/span&gt; l;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;char&lt;/span&gt;* str;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;};&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; myClass2&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt;:&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    myClass2();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    ~myClass2();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    testStruct structObj;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;};&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;myClass2::myClass2()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="rem"&gt;//Do Nothing..&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    &lt;span class="kwrd"&gt;char&lt;/span&gt; *pStr = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;char&lt;/span&gt;[100];&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    sprintf(pStr, &lt;span class="str"&gt;"Test Message"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    structObj.i = 101; structObj.l = 1001; structObj.ch = &lt;span class="str"&gt;'j'&lt;/span&gt;; structObj.str = pStr;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;myClass2::~myClass2()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    delete structObj.str;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;&lt;span class="kwrd"&gt;int&lt;/span&gt; test2(myClass2* classObject)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; classObject-&amp;gt;structObj.i;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; CWinDbgDlg::OnBnClickedButton2()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;    &lt;span class="rem"&gt;// TODO: Add your control notification handler code here&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    myClass2 *ptr = &lt;span class="kwrd"&gt;new&lt;/span&gt; myClass2();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; retVal = test2(ptr);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;So, what we want to do is, while we break @ test2 function, we want to see in WinDbg whats the value of structObj.str of that instance.&lt;/p&gt;
&lt;p&gt;Here are steps which needs to be done in Windbg. Attach the process to WinDbg, break on the function test2 by putting simple breakpoint. Hit kb command to find out the first parameter to test2 function (which is pointer to class object for myClass2).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtolookatvalueofstructureobjectwhoisme_6641/SHOT0028_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="87" alt="SHOT0028" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtolookatvalueofstructureobjectwhoisme_6641/SHOT0028_thumb.jpg" width="743" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;First parameter to function test2 is, 0x006ab520 (see the third column in first row of call stack above). As you might know, if you want to see member variable of class object pointer, you can use dt command.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtolookatvalueofstructureobjectwhoisme_6641/SHOT0029_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="58" alt="SHOT0029" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtolookatvalueofstructureobjectwhoisme_6641/SHOT0029_thumb.jpg" width="335" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;But, our goal is to find out whats inside structObj! Well, you can give following command to get that detail,&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtolookatvalueofstructureobjectwhoisme_6641/SHOT0030_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="122" alt="SHOT0030" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/Howtolookatvalueofstructureobjectwhoisme_6641/SHOT0030_thumb.jpg" width="437" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Notice the difference between last command and one prior to that. We appended "structObj." at the end. That's how we can find members inside that structure. Mission Accomplished!!&lt;/p&gt;
&lt;p&gt;I know, its really difficult to explain what exactly we are doing, and I think I am trying my best to explain it with the help of snapshot and coding, if you think it can be improved, please let me know..&lt;/p&gt;
&lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5752624" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>How to break in WinDbg when particular function returns specific value??</title><link>http://blogs.msdn.com/jigarme/archive/2007/10/29/how-to-break-in-windbg-when-particular-function-returns-specific-value.aspx</link><pubDate>Mon, 29 Oct 2007 03:09:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5750548</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5750548.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5750548</wfw:commentRss><description>&lt;p&gt;If you are debugging a lot, you might come across a need where you need to put a breakpoint on a function and special requirement is you need to break only when that function returns a specific value!! e.g. I am checking for CoCreateInstance method from COM library and want to break only when it returns 0x80040154 (i.e. Class Not Registered!). Obviously, we can put normal breakpoint by using following command, &lt;/p&gt; &lt;p&gt;bp Ole32!CoCreateInstance&lt;/p&gt; &lt;p&gt;but it will break everytime that function will be called, say if you have 3000 COM component instances created in your code, you will loose some of your hairs reaching interest of your break in WinDbg.&lt;/p&gt; &lt;p&gt;So, here is the technique to the rescue. I will first explain the logic how its done.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Little background, In Windbg, we can put conditional breakpoints where we can check register values (like eax, ebx, eip, esp etc.) when particular breakpoint is hit. Conditional breakpoints will break only if condition is satisfied.  &lt;li&gt;If we can get the return address for our function of interest, we can put breakpoint on that address checking for eax register value (return value is always stored in eax register when function returns). And that way, we can break while returning the function if particular value is set in eax register.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Here is a sample example.. What we need to do is, we want to break in WinDbg only when myClass::test1 returns 100 otherwise go ahead.&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; myClass&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt;:&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    myClass();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; test1(&lt;span class="kwrd"&gt;int&lt;/span&gt; param1);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Crash();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;};&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;myClass::myClass()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="rem"&gt;//DO Nothing.. let runtime construct the object..&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&lt;span class="kwrd"&gt;int&lt;/span&gt; myClass::test1(&lt;span class="kwrd"&gt;int&lt;/span&gt; param1)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; param1 * 2;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; myClass::Crash()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; another_var=0;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; p = 200/another_var;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; CWinDbgDlg::OnBnClickedButton1()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    &lt;span class="rem"&gt;// TODO: Add your control notification handler code here&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    myClass *obj = &lt;span class="kwrd"&gt;new&lt;/span&gt; myClass();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; retVal = obj-&amp;gt;test1(50);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt;(retVal == 100)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        &lt;span class="rem"&gt;//Some faulty condition has occurred, you dont want to come here,&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;        &lt;span class="rem"&gt;//catch this condition before this happens (in debugger)..&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        obj-&amp;gt;Crash();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;I am debugging above code. Following are few things that should be carried out in WinDbg. Attach to the process you want to debug.&lt;/p&gt;
&lt;p&gt;Find out the address of function (not the return address) you are interested in.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowtobreakinWinDbgwhenparticularfunction_4A23/SHOT0028_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="41" alt="SHOT0028" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowtobreakinWinDbgwhenparticularfunction_4A23/SHOT0028_thumb.jpg" width="335" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Put a breakpoint on that function (this is just to find out return address of the function.. If you can findout return address by some other technique let me know!)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowtobreakinWinDbgwhenparticularfunction_4A23/SHOT0029_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="28" alt="SHOT0029" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowtobreakinWinDbgwhenparticularfunction_4A23/SHOT0029_thumb.jpg" width="168" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Hit 'g' and execute application till it calls this function. When it breaks for that function, give k* command to see call stack, as it will show the return address in function call stack!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowtobreakinWinDbgwhenparticularfunction_4A23/SHOT0028_4.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="106" alt="SHOT0028" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/HowtobreakinWinDbgwhenparticularfunction_4A23/SHOT0028_thumb_1.jpg" width="586" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Here, 0x00412e93 is the return address we are interested in! So, put the conditional breakpoint as follows,&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;bp 00412e93 &lt;span class="str"&gt;"j @eax = 0x00000064  '';'gc'"&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notice here one thing? Yes, you are right. We are putting breakpoint for eax register while checking for value 0x00000064 which is Hex equivallent of 100 decimal (dont forget this step, otherwise you will never hit the breakpoint!)&lt;/p&gt;
&lt;p&gt;After doing above, hit 'g' and you will break only when test1 function returns 100. (In my case, it will break immediately because I have hardcoded the parameter 50).&lt;/p&gt;
&lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5750548" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Looking at commands supported by WinDbg extensions..</title><link>http://blogs.msdn.com/jigarme/archive/2007/10/29/looking-at-commands-supported-by-windbg-extensions.aspx</link><pubDate>Mon, 29 Oct 2007 02:15:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5749283</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5749283.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5749283</wfw:commentRss><description>&lt;p&gt;If you want to look at commands supported by any windbg extensions, you can follow various ways.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;You can use !&amp;lt;ext_name&amp;gt;.help command to see all the commands supported by that extension. Replace &amp;lt;ext_name&amp;gt; with your extension module name. (Note: This will only work if particular extension supports help command.)&lt;/li&gt; &lt;li&gt;You can open the extension DLL in &lt;a href="http://www.dependencywalker.com/"&gt;Dependency Walker&lt;/a&gt; and it will show all the command in exported function panel! There is no magic behind it, its merely a fact that WinDbg has very simple extension model, where you need to implement exported function for each command. Windbg just does GetProcAddress for that function and call into that, when we use that debugger extension command in Windbg. And dependency walker has functionality to show exported function from a module.&lt;br&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/LookingatcommandssupportedbyWinDbgexten_42CD/SHOT0029_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="785" alt="SHOT0029" src="http://blogs.msdn.com/blogfiles/jigarme/WindowsLiveWriter/LookingatcommandssupportedbyWinDbgexten_42CD/SHOT0029_thumb.jpg" width="613" border="0"&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5749283" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>How to attach WinDbg to a service?</title><link>http://blogs.msdn.com/jigarme/archive/2007/10/27/how-to-attach-windbg-to-a-service.aspx</link><pubDate>Sat, 27 Oct 2007 06:19:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5701031</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5701031.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5701031</wfw:commentRss><description>&lt;p&gt;There are various ways to do this.&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Find the PID for process that is hosting the service. You can do this with the help of command,&lt;br&gt;tasklist /svc&lt;br&gt;&lt;br&gt;Look for service and associated PID, then go to command prompt, into the directory where windbg is installed and give command,&lt;br&gt;windbg.exe -p &amp;lt;ProcessID&amp;gt;&lt;br&gt;&lt;/li&gt; &lt;li&gt;Another way is to directly use the service name as parameter to windbg. This is more convenient way, but hardly known to users/developers. You can use following command,&lt;br&gt;&lt;br&gt;windbg.exe -psn RPCSS&lt;br&gt;&lt;br&gt;Above command will find out the process which is hosting RPCSS process and then attach the debugger to that process.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5701031" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Loading/reloading symbols for just one module..</title><link>http://blogs.msdn.com/jigarme/archive/2007/10/26/loading-reloading-symbols-for-just-one-module.aspx</link><pubDate>Fri, 26 Oct 2007 02:18:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5681040</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/5681040.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=5681040</wfw:commentRss><description>&lt;p&gt;Many a times it happens that from within a debugging session, we need to load / reload symbols for a particular module (Talking in context of WinDbg).. e.g. we started debugging, set normal symbol path and down the line while debugging, came to know that we need symbol for particular module. We modify symbol file path. If we do,&lt;/p&gt; &lt;p&gt;.reload /f&lt;/p&gt; &lt;p&gt;it loads all symbols again from the same location which might take time.&lt;/p&gt; &lt;p&gt;So, just managed to find the command to load just one particular module's symbols,&lt;/p&gt; &lt;p&gt;.reload /f @"mydll.dll"&lt;/p&gt; &lt;p&gt;This will load symbols for mydll.dll using latest symbol path.&lt;/p&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5681040" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Notepad hangs while saving the file</title><link>http://blogs.msdn.com/jigarme/archive/2007/05/17/notepad-hangs-while-saving-the-file.aspx</link><pubDate>Thu, 17 May 2007 03:52:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2683872</guid><dc:creator>Jigar Mehta</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jigarme/comments/2683872.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jigarme/commentrss.aspx?PostID=2683872</wfw:commentRss><description>&lt;p&gt;From last few days, I have been experiencing very strange problem.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: When I create a new file in Notepad.exe and click on File+Save or alt+s, it literally hangs when showing the dialog (save dialog to give file name/path). If I wait for more than 2 minutes, it comes out of the hang state and shows me the dialog.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Troubleshooting&lt;/strong&gt;:&lt;strong&gt; &lt;/strong&gt;I ran procmon (&lt;a href="http://www.microsoft.com/technet/sysinternals/utilities/processmonitor.mspx"&gt;http://www.microsoft.com/technet/sysinternals/utilities/processmonitor.mspx&lt;/a&gt;) and saw that notepad.exe was trying to reach "\\jigarm\" machine name. Analysing more, I found that it was there in the Recent History list. Now, the situation is, I had a machine named "jigarm", now I had to format it and new machine name is, "jigarme" So, everytime, I try to save the file, it loads the most recent path and just because "jigarm" does not exist, network access API call, just waits for timeout. (Windows Vista has significant improvement on these kind of hanging kernel calls!)&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Resolution&lt;/strong&gt;: I opened regcrawler (&lt;a href="http://www.dcsoft.com/products/regeditx/regcrawler.htm"&gt;http://www.dcsoft.com/products/regeditx/regcrawler.htm&lt;/a&gt;) and searched for all references to "\\jigarm" in whole registry, I found not only notepad.exe but other processes like, windbg.exe and winword.exe having reference to that network machine name in recent save locations.&lt;/p&gt; &lt;p&gt;Stay tuned.. &lt;img alt="Wave" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif"&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2683872" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jigarme/archive/tags/Debugging/default.aspx">Debugging</category></item></channel></rss>