Debugging (RSS)

All about debugging

Ethereal Packet sniffing tutorials...

While browsing the net I found a nice set of tutorials called Packet School 101 on Chris Sander's blog. A developer type like me, who needs to take a look at packet sniffs from time to time this is a very usefull set of articles.

How to set up Microsoft Symbol Server

Symbol server is important if you have large projects on the Windows platform within a large organization and your process involves daily/nightly builds. Then you have to distribute really large number of binary files impacting your network traffic. Instead of copying every single one of your symbols you can set up a symbol server, where the symbol files are distributed on demand, this way you can easily save gigs of network bandwidth and storage.

Setting up a Symbol Server.

Deblector, a marriage of Reflector and a debugger.

Felice Pollano has put together a very interesting tool, what is basically a debugger and a reflector - thus the name Deblector. This tool is using Lutz Roeder's Reflector to generate source code using reflection while you are debugging. This can be very handy when you does not have the source code or debug symbols or you just want to figure it out really quick what is happening under the hood. I think I need to give this tool a closer look soon... will post my experiences! 

Check the latest release of Deblector.

Stupid Error : RunTime Check Failure #0 - The value of ESP

I just spent the last hour with this and I have no clue how would I found out this alone. I am trying to figure out the maximum keyframe space of a wmv file and for this I am using the Windows Media Format SDK and the wmvprop sample. At some point of the execution I would make a call for each video stream to find out this property by calling:

hr = pVideoMediaProps->GetMaxKeyFrameSpacing(&pllKeyFrameTime);

When I was stepping through my code and arrived to the call above I received the following error:

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

I must tell you this error message is dead scary, because I am not a COM guru, nor a C++ one. So I spent an hour trying to figure it out and changed all the calling convetions in my call, but no joy! Then I called for help. Another 20 minutes 2 people staring at the screen then my collegue Kalman suggested to comment out my code and see if that works. It worked! Then we know that I am crappy coder :) Another session of blank staring for 2 mins then I saw this piece: like couple of lines earlier:

hr = pConfig->QueryInterface(IID_IWMStreamConfig, (void **) &pVideoMediaProps);

and the definition of my variable like 30 lines earlier:

IWMVideoMediaProps *pVideoMediaProps = NULL;

so that tells me basically that I screwed this up by querying for one interface and supplying another interface to QueryInterface. So tho correct the error it should be queried like this:

hr = pConfig->QueryInterface(IID_IWMVideoMediaProps, (void **) &pVideoMediaProps);

Honestly, I do not understand what happens under the hood - I really would like too, so someone smart please explain it to me - and why this error message shown, but I thought that I would try to save some time to other people with this. I really hope that this will be handy for someone sometimes :)

Another interesting twist was that after looking at the documentation I learned that:  

Remarks

This method retrieves the value set by SetMaxKeyFrameSpacing, or the default value for the key frame spacing, during the encoding process only. If called for a file that is open in the reader, the method always returns zero.

For more information, see the Remarks for SetMaxKeyFrameSpacing.

And I had a reader open and I received 0 as a result when I ignored this error! The moral of the story? COM rulez! Pay respect to it and documentation is your friend!

ROTOR v2 ships

This is really cool and I was waiting for this a long time know. Rotor (SSCLI) V2 shipped and you can download it from here. Generics, LCG, C# compiler with the new features like anonymous methods, new reflection. I just can't wait to dig into this stuff :)

ROTOR (SSCLI) 2.0 Ships! from JasonZ.

Protection Error while debugging DShow app

I recently had a small problem with debugging an MFC application, when I tried to run the application under debugger I received the following error mesage:

Protection Error - Debugger Detected! Please, close it down and restart.

more...

How to Kernel debugg a virtual pc image with windbg.

Here is a really quick howto if you want to kernel debug a virtual pc image on your machine.

  • on virtual pc modify the boot.ini file. Add the following: 

    /DEBUG /DEBUGPORT=COM the number of the COM port that you want to use for debugging /BAUDRATE=115200

Boot.ini then will look like this:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect/DEBUG /DEBUGPORT=COM2/BAUDRATE=115200

  • Configure the serial port for virtual PC

    Virtual PC 2004
  • Start Virtual PC 2004.
    Click the virtual machine that you want to configure, and then click Settings.
  • In the Setting list, click the serial port that you want to configure, click Physical serial port, and then click to clear the Wait for modem command to open port check box if it is selected.
  • Click Named pipe, and then type \\.\pipe\ name that you want to assign to the named pipe in the Named pipe box. For example, type \\.\pipe\com2 .
  • Click OK. 


Virtual Server 2005

  • Start the Virtual Server Administration Website program. To do this, click Start, point to All Programs, point to Microsoft Virtual Server, and then click Virtual Server Administration Website.
  • Under Virtual Machines, point to Configure, and then click the virtual machine that you want to modify.
  • Click the COM ports link.
  • Under the serial port that you want to configure for debugging, click Physical computer serial port, and then click to clear the Wait for modem command to open port check box.
  • Click Named pipe, and then type \\.\pipe\ name that you want to assign to the named pipe in the Named pipe box. For example, type \\.\pipe\com2 .
  • Click OK.
     
  • start windbg
    Windbg -k com:port=\\.\pipe\ pipe name ,pipe,resets=0,reconnect


Source:
How to debug the Virtual Server service on a computer that is running Virtual Server 2005 or Virtual PC 2004, part 1 of 2

A word for Windbg

Introduction to windbg for both managed and unmanaged debugging

A word for WinDbg - short introduction to unmanaged debugging.
http://mtaulty.com/blog/archive/2004/08/03/608.aspx

 

A word for WinDbg (2) - short introduction to managed debugging.
http://mtaulty.com/blog/archive/2004/08/03/609.aspx

 

Created with Microsoft Office OneNote 2003
One place for all your notes

You've typed !analyze -v, now what? - next steps in debugging

I have started to use windbg not so long ago as my main debugger and I still learning it but I am starting to like it a lot, although a lot to learn. It is really overwhelming and difficult to use first if you are a Visual Studio developer. This article is discussing the !analyze -v command what is used for analyzing crash dumps.

"...We often see people asking what to do when their driver doesn’t work – this question arises on an almost daily basis. While the actual setup of the debugger now seems to be reasonably well understood, the steps beyond that appear to be shrouded in mystery. This article will warn about common issues and delve into some of the basic steps that you should follow when debugging…"


Source <http://www.osronline.com/article.cfm?article=328>

Created with Microsoft Office OneNote 2003
One place for all your notes