Mike Stall has had a recent string of posts about debugger features, which got me thinking about what I waste time doing in debuggers these days.
Omniscient debuggers would be great, but what I would really like is a memory window that I can annotate. I don’t care if this makes it into Visual Studio or WinDbg, but it would save me time that I currently waste scribbling on notepads.
I should be able to stick some comments in the memory window, and they should stay at that address for the extent of the debugger run. This is what I mean:

In this case, since my memory window is @ESP, I should be able to see my annotations being pushed down on the stack as I step.
I realize maybe one percent of developers could use this, but dammit, we’re the coolest one percent.
Raymond Chen has had an entry or two about “Psychic Debugging.” This skill is a lot like everyday psychic abilities by virtue of being really just intuition and guesswork, but dissimilar in that it produces results that benefit society.
Today one of the developers was working on a weird problem he found in his development environment. He could test his functionality once (it’s an ASPX page), but the second time he tried to use it there was usually a “random” exception on the page that didn’t make any sense. Sometimes, instead of an exception, his worker process just crashed. He also told me that he was trying to use a new API that I knew mapped to a third-party COM object.
This is where the mystical powers came in handy. I tried running his page once, then running a different page—same weird exceptions and crashes. It was here that I started to suspect that the heap was being corrupted by the COM library.
(Let me quickly explain what heap corruption is: suppose I have two objects, X and Y, next to one another in memory. Now suppose I make a mistake writing my program and accidently write beyond the end of object X. I’ve now screwed up object Y, but we might not know about it until we try to use object Y. We might not try to use object Y for quite a while, so this makes the real cause of the bug awfully difficult to find. To make matters worse, the next time we run the program our bug writing to object X might scribble all over a completely different object that will crash the program somewhere else.)
On a hunch I attached a debugger after the first load of the page. When the exception occurred, I ran the !verifyheap command in the SOS extension. This reported that there was a corrupt object on the heap. I ran the same test a few times to confirm the theory.
If you’re lucky, you might see a debug break like this in one of the Windows Debuggers as soon as the heap corruption occurs:
HEAP[heapcorrupt.exe]: Heap block at 001AD700 modified at 001AD780
past requested size of 78
...
ntdll!DbgBreakPoint:
This is just a debug break, so it won’t tear down the process immediately. Depending on the application you’re working on the real problems could start much later, long after the offending code has finished executing.
All I can say is that it’s a goddamned miracle that the developer was doing a good job testing his functionality and noticed this. The mayhem that would have ensued if this made it to QA would have made it far more difficult to track down the source of the problem. The happy ending here is that the vendor has a fully-managed version of their component that we can switch to—hopefully that will be more difficult for them to screw up.
Tony Siragusa is the nuclear option in Fox Sports’ ongoing war against dramatic pause.

Every Sunday he roves the sidelines ensuring that even the slightest moment of dead air is filled with sense-dulling stupidity. “I love coming to Cleveland because they’ve got the best nacho cheese in the league here. Ok, back to you guys.” Last week, he told viewers that Redskins quarterback Mark Brunell had been practicing all week with wet balls to prepare for the depressing perpetual downpour in Seattle. Not content to leave it at that, he then demonstrated the act of submerging a football in a bucket of water.
If Scooter the Talking Baseball wasn’t evidence enough, it should now be obvious that Fox’s interest is machiavellian masochism rather than the enjoyment of genuine fans. They know that you will watch, and they want to make it hurt as much as possible. It is therefore left to us to take action, get involved, and improve the quality of our football experience. Here are some thoughts I had, which I urge you to try the next time Siragusa visits your NFL city. Bear in mind that these may require felonious access to the playing surface.
- “Steal his nose,” refuse to give it back. Let Siragusa chase you for three hours.
- With several accomplices, distract Siragusa with a system of flashing mirrors. (Unlikely to work in winter.)
- Stage a sham rib cookoff near the stadium prior to kickoff; lace Tony’s racks with Lunesta.
Ok, back to you guys.