I am working on a large application and often use WinDbg to diagnose problems based on a DMP file from a client. I wrote some small extensions for WinDbg, which turned out to be very useful for extracting bits of information from DMP files. In my expansion code, I find myself dereferencing C ++ class objects in the same way, time and time again, manually. For instance:
Address = GetExpression("somemodule!somesymbol");
ReadMemory(Address, &addressOfPtr, sizeof(addressOfPtr), &cb);
ReadMemory(addressOfObj, &addressOfObj, sizeof(addressOfObj), &cb);
ULONG offset;
ULONG addressOfField;
GetFieldOffset("somemodule!somesymbolclass", "somefield", &offset);
ReadMemory(addressOfObj+offset, &addressOfField, sizeof(addressOfField), &cb);
This works well, but since I wrote more extensions, with more functionality (and access to more complex objects in our DMP application files), I really wanted to get a better solution. Of course, I have access to the source of our own application, so I think there should be a way to copy the object from the DMP file and use this memory to create the actual object in the debugger extender, to which I can call functions (by binding in the dll from our applications). This would save me having to pull things out of the DMP manually.
? , , ReadMemory DMP. , , , . , - ... , ++ - - vtable, ? :
SomeClass* thisClass = SomeClass::New();
ReadMemory(addressOfObj, &(*thisClass), sizeof(*thisClass), &cb);
FOLLOWUP: , POSSIBLY ExtRemoteTyped EngExtCpp - , ? - ? , .
FOLLOWUP 2: .
1) ExtRemoteTyped, , ReadMemory/GetFieldOffset. , ALOT, , DMP. , - .
2) ReadMemory , , DMP. , , sizeof (* thisClass), , , vtables .