// Get a DumpPointer from a MINIDUMP_LOCATION_DESCRIPTOR protected internal DumpPointer TranslateDescriptor(MINIDUMP_LOCATION_DESCRIPTOR location) { // A Location has both an RVA and Size. If we just TranslateRVA, then that would be a // DumpPointer associated with a larger size (to the end of the dump-file). DumpPointer p = TranslateRVA(location.Rva); p.Shrink(location.DataSize); return(p); }
internal void GetThreadContext(MINIDUMP_LOCATION_DESCRIPTOR loc, IntPtr buffer, int sizeBufferBytes) { if (loc.IsNull) { throw new ClrDiagnosticsException("Context not present", ClrDiagnosticsExceptionKind.CrashDumpError); } DumpPointer pContext = TranslateDescriptor(loc); int sizeContext = (int)loc.DataSize; if (sizeBufferBytes < sizeContext) { // Context size doesn't match throw new ClrDiagnosticsException( "Context size mismatch. Expected = 0x" + sizeBufferBytes.ToString("x") + ", Size in dump = 0x" + sizeContext.ToString("x"), ClrDiagnosticsExceptionKind.CrashDumpError); } // Now copy from dump into buffer. pContext.Copy(buffer, (uint)sizeContext); }