Welcome to McFunley.com Sign in | Join | Faq

Getting some grease under my fingernails

posted on Monday, February 21, 2005 12:33 AM by mcfunley

I decided I needed some debugger extensions specifically intended for ASP.NET hang dumps. Psscor has a few nice ones but I figured I would learn a lot in the attempt, anyway.

 

Here’s how the project is breaking down.

 

Days 1-2: Messed around trying to learn how to use the build utility that comes with the Windows 2003 DDK. This would have been faster if I had looked at a makefile more than once in the previous five years.

 

Day 3: Toyed with the idea of using LoadLibrary on psscor and filtering the output, but instead decided that I was insane.

 

Days 4-5: Got pretty familiar with writing an extension on my own, and what the implementation details would be. It was becoming pretty clear that I would need to get some info on the structures if I was to have any hope of getting finished.

 

Days 5-7: Downloaded the SSCLI and realized that it’s got a (pretty old) version of SOS.dll in it. I have a few moments of euphoria here and radically switch approaches: I will now start with this and extend it to suit my needs.

 

I pretty quickly find out that this DLL is assuming the SSCLI execution engine and won’t work with the Microsoft production ones (mscorsvr in my case, or mscoree). No problem, I assume that won’t take too long to fix.

 

The problem is that this thing is filled with code like this:

 

// Note this is possible to be spoofed, but pretty unlikely

// call XXXXXXXX

if (spot[-5] == 0xE8) {

move (*whereCalled, retAddr-4);

      *whereCalled += retAddr;

//*whereCalled = *((int*) (retAddr-4)) + retAddr;

if (*whereCalled < 0x80000000 && *whereCalled > 0x1000)

return;

else

*whereCalled = 0;

}

 

(your guess is as good as mine).

 

I’m not sure if they had their best programmers working on this thing. I don’t know. Perhaps they just never expected someone like me to look at it in depth.

 

So that’s where I’m stuck for the moment. I’m going through it, commenting it and trying to understand it. I will eventually refactor it quite a bit. At the moment there are a lot of very long, very hard to follow functions in it. But, it’s good to look at some unmanaged code for a change.

Comments

SKIN NAME : ImageHeader