repository: C:/dev/kvm-guest-drivers-windows
branch: master
commit cccf2bd5f427c73dc6be4c528aa6f9554ffc5e8c
Author: Yan Vugenfirer <[email protected]>
Date: Sun Feb 21 12:59:54 2010 +0200
[WIN-GUEST-DRIVERS] NetKVMDumpParser debug tool that enables additional
dump file parsing.
NetKVM driver can be compiled to save debug information during BSOD. This
information includes interrupt, dpc timing, pnp messages and other. It may be
extended to include other additional info (see driver sources
Common/ParaNdis-Debug.c).
This debugging capability already exists in the driver, the commit is only
for the parsing tool.
Signed-off-by: Yan Vugenfirer [email protected]
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/DebugSdk.vsprops
b/NetKVM/DebugTools/NetKVMDumpParser/DebugSdk.vsprops
new file mode 100644
index 0000000..6b0ed8c
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/DebugSdk.vsprops
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="DebugSdk"
+ >
+ <UserMacro
+ Name="DEBUGSDK"
+ Value="C:\Program Files\Debugging Tools for Windows\sdk"
+ />
+</VisualStudioPropertySheet>
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.cpp
b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.cpp
new file mode 100644
index 0000000..b9ba556
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.cpp
@@ -0,0 +1,836 @@
+/**********************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ *
+ * File: NetKVMDumpParser.cpp
+ *
+ * This file contains dump parsing logic
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+**********************************************************************/
+
+#include "stdafx.h"
+#include "NetKVMDumpParser.h"
+#include "..\..\Common\DebugData.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#define DEBUG_SYMBOLS_IF IDebugSymbols2
+
+#define PRINT(fmt, ...) printf("[%s]: "##fmt##"\n", __FUNCTION__, __VA_ARGS__);
+//#define PRINT(fmt, ...) { CString __s; __s.Format(TEXT("[%s]:
")##TEXT(fmt)##TEXT("\n"), TEXT(__FUNCTION__), __VA_ARGS__);
OutputDebugString(__s.GetBuffer()); }
+
+CString ErrorToString(HRESULT hr)
+{
+ CString s;
+ LPTSTR lpMessageBuffer;
+ if (FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ hr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
+ (LPTSTR) &lpMessageBuffer,
+ 0,
+ NULL ))
+ {
+ s = lpMessageBuffer;
+ LocalFree(lpMessageBuffer);
+ }
+ else
+ {
+ s.Format("[Error %lu]", hr);
+ }
+ return s;
+}
+
+static const LPCSTR OpNames[] = {
+ "PowerOff ",
+ "PowerOn ",
+ "SysPause ",
+ "SysResume ",
+ "InternalSendPause ",
+ "InternalReceivePause ",
+ "InternalSendResume ",
+ "InternalReceiveResume",
+ "SysReset ",
+ "Halt ",
+ "ConnectIndication ",
+ "DPC ",
+ "Send ",
+ "SendNBLRequest ",
+ "SendPacketRequest ",
+ "SendPacketMapped ",
+ "SubmittedPacket ",
+ "BufferSent ",
+ "BufferReceivedStat ",
+ "BufferReturned ",
+ "SendComplete ",
+ "TxProcess ",
+ "PacketReceived ",
+ "OidRequest ",
+ "PnpEvent ",
+};
+
+static CString HistoryOperationName(ULONG op)
+{
+ CString s;
+ if (op < sizeof(OpNames)/ sizeof(OpNames[0]))
+ s = OpNames[op];
+ else
+ s.Format("##%d", op);
+ return s;
+}
+
+typedef struct _tagNamedFlag
+{
+ ULONG64 flag;
+ LPCSTR name;
+}tNamedFlag;
+
+typedef struct _tagNamedValue
+{
+ ULONG64 value;
+ LPCSTR name;
+}tNamedValue;
+
+#define STRINGER(x) #x
+#define VALUE(v) { v, STRINGER(##v) }
+#define ENDTABLE { 0, NULL }
+
+const tNamedValue SessionStatusValues[] =
+{
+VALUE(DEBUG_SESSION_ACTIVE),
+VALUE(DEBUG_SESSION_END_SESSION_ACTIVE_TERMINATE),
+VALUE(DEBUG_SESSION_END_SESSION_ACTIVE_DETACH),
+VALUE(DEBUG_SESSION_END_SESSION_PASSIVE),
+VALUE(DEBUG_SESSION_END),
+VALUE(DEBUG_SESSION_REBOOT),
+VALUE(DEBUG_SESSION_HIBERNATE),
+VALUE(DEBUG_SESSION_FAILURE),
+ENDTABLE
+};
+
+const tNamedValue DebuggeeStateValues[] =
+{
+VALUE(DEBUG_CDS_ALL),
+VALUE(DEBUG_CDS_REGISTERS),
+VALUE(DEBUG_CDS_DATA),
+ENDTABLE
+};
+
+const tNamedValue DebuggeeStateArgValues[] =
+{
+VALUE(DEBUG_DATA_SPACE_VIRTUAL),
+VALUE(DEBUG_DATA_SPACE_PHYSICAL),
+VALUE(DEBUG_DATA_SPACE_CONTROL),
+VALUE(DEBUG_DATA_SPACE_IO),
+VALUE(DEBUG_DATA_SPACE_MSR),
+VALUE(DEBUG_DATA_SPACE_BUS_DATA),
+VALUE(DEBUG_DATA_SPACE_DEBUGGER_DATA),
+VALUE(DEBUG_DATA_SPACE_COUNT),
+ENDTABLE
+};
+
+const tNamedFlag EngineStateFlags[] =
+{
+VALUE(DEBUG_CES_ALL),
+VALUE(DEBUG_CES_CURRENT_THREAD),
+VALUE(DEBUG_CES_EFFECTIVE_PROCESSOR),
+VALUE(DEBUG_CES_BREAKPOINTS),
+VALUE(DEBUG_CES_CODE_LEVEL),
+VALUE(DEBUG_CES_EXECUTION_STATUS),
+VALUE(DEBUG_CES_ENGINE_OPTIONS),
+VALUE(DEBUG_CES_LOG_FILE),
+VALUE(DEBUG_CES_RADIX),
+VALUE(DEBUG_CES_EVENT_FILTERS),
+VALUE(DEBUG_CES_PROCESS_OPTIONS),
+VALUE(DEBUG_CES_EXTENSIONS),
+VALUE(DEBUG_CES_SYSTEMS),
+VALUE(DEBUG_CES_ASSEMBLY_OPTIONS),
+VALUE(DEBUG_CES_EXPRESSION_SYNTAX),
+VALUE(DEBUG_CES_TEXT_REPLACEMENTS),
+ENDTABLE
+};
+
+
+const tNamedFlag SymbolStateFlags[] =
+{
+VALUE(DEBUG_CSS_ALL),
+VALUE(DEBUG_CSS_LOADS),
+VALUE(DEBUG_CSS_UNLOADS),
+VALUE(DEBUG_CSS_SCOPE),
+VALUE(DEBUG_CSS_PATHS),
+VALUE(DEBUG_CSS_SYMBOL_OPTIONS),
+VALUE(DEBUG_CSS_TYPE_OPTIONS),
+ENDTABLE
+};
+
+const tNamedValue EngineExecutionStatus[] =
+{
+VALUE(DEBUG_STATUS_NO_CHANGE),
+VALUE(DEBUG_STATUS_GO),
+VALUE(DEBUG_STATUS_GO_HANDLED),
+VALUE(DEBUG_STATUS_GO_NOT_HANDLED),
+VALUE(DEBUG_STATUS_STEP_OVER),
+VALUE(DEBUG_STATUS_STEP_INTO),
+VALUE(DEBUG_STATUS_BREAK),
+VALUE(DEBUG_STATUS_NO_DEBUGGEE),
+VALUE(DEBUG_STATUS_STEP_BRANCH),
+VALUE(DEBUG_STATUS_IGNORE_EVENT),
+VALUE(DEBUG_STATUS_RESTART_REQUESTED),
+VALUE(DEBUG_STATUS_REVERSE_GO),
+VALUE(DEBUG_STATUS_REVERSE_STEP_BRANCH),
+VALUE(DEBUG_STATUS_REVERSE_STEP_OVER),
+VALUE(DEBUG_STATUS_REVERSE_STEP_INTO),
+ENDTABLE
+};
+
+const tNamedFlag EngineExecutionStatusFlags[] =
+{
+VALUE(DEBUG_STATUS_INSIDE_WAIT),
+VALUE(DEBUG_STATUS_WAIT_TIMEOUT),
+ENDTABLE
+};
+
+const tNamedFlag ModuleFlags[] =
+{
+VALUE(DEBUG_MODULE_LOADED),
+VALUE(DEBUG_MODULE_UNLOADED),
+VALUE(DEBUG_MODULE_USER_MODE),
+VALUE(DEBUG_MODULE_EXPLICIT),
+VALUE(DEBUG_MODULE_SECONDARY),
+VALUE(DEBUG_MODULE_SYNTHETIC),
+VALUE(DEBUG_MODULE_SYM_BAD_CHECKSUM),
+ENDTABLE
+};
+
+const tNamedValue SymbolTypeValues[] =
+{
+VALUE(DEBUG_SYMTYPE_NONE),
+VALUE(DEBUG_SYMTYPE_COFF),
+VALUE(DEBUG_SYMTYPE_CODEVIEW),
+VALUE(DEBUG_SYMTYPE_PDB),
+VALUE(DEBUG_SYMTYPE_EXPORT),
+VALUE(DEBUG_SYMTYPE_DEFERRED),
+VALUE(DEBUG_SYMTYPE_SYM),
+VALUE(DEBUG_SYMTYPE_DIA),
+ENDTABLE
+};
+
+
+const tNamedFlag SymbolOptionsFlags[] =
+{
+VALUE(SYMOPT_CASE_INSENSITIVE),
+VALUE(SYMOPT_UNDNAME),
+VALUE(SYMOPT_DEFERRED_LOADS),
+VALUE(SYMOPT_NO_CPP),
+VALUE(SYMOPT_LOAD_LINES),
+VALUE(SYMOPT_OMAP_FIND_NEAREST),
+VALUE(SYMOPT_LOAD_ANYTHING),
+VALUE(SYMOPT_IGNORE_CVREC),
+VALUE(SYMOPT_NO_UNQUALIFIED_LOADS),
+VALUE(SYMOPT_FAIL_CRITICAL_ERRORS),
+VALUE(SYMOPT_EXACT_SYMBOLS),
+VALUE(SYMOPT_ALLOW_ABSOLUTE_SYMBOLS),
+VALUE(SYMOPT_IGNORE_NT_SYMPATH),
+VALUE(SYMOPT_INCLUDE_32BIT_MODULES),
+VALUE(SYMOPT_PUBLICS_ONLY),
+VALUE(SYMOPT_NO_PUBLICS),
+VALUE(SYMOPT_AUTO_PUBLICS),
+VALUE(SYMOPT_NO_IMAGE_SEARCH),
+VALUE(SYMOPT_SECURE),
+VALUE(SYMOPT_NO_PROMPTS),
+VALUE(SYMOPT_OVERWRITE),
+VALUE(SYMOPT_IGNORE_IMAGEDIR),
+VALUE(SYMOPT_FLAT_DIRECTORY),
+VALUE(SYMOPT_FAVOR_COMPRESSED),
+VALUE(SYMOPT_ALLOW_ZERO_ADDRESS),
+VALUE(SYMOPT_DISABLE_SYMSRV_AUTODETECT),
+VALUE(SYMOPT_DEBUG),
+ENDTABLE
+};
+
+class tDumpParser : public DebugBaseEventCallbacks, public
IDebugOutputCallbacks
+{
+public:
+ tDumpParser() : refCount(0), Client(NULL), Control(NULL),
DataSpaces(NULL), DebugSymbols(NULL)
+ {
+ HRESULT hr;
+ hr = DebugCreate(__uuidof(IDebugClient), (void **)&Client);
+ if (Client) hr =
Client->QueryInterface(__uuidof(IDebugControl), (void **)&Control);
+ if (Client) hr =
Client->QueryInterface(__uuidof(IDebugDataSpaces3), (void **)&DataSpaces);
+ if (Client) hr =
Client->QueryInterface(__uuidof(DEBUG_SYMBOLS_IF), (void **)&DebugSymbols);
+ }
+ ~tDumpParser()
+ {
+ ULONG ul = 0;
+ if (DebugSymbols) DebugSymbols->Release();
+ if (Control) Control->Release();
+ if (DataSpaces) DataSpaces->Release();
+ if (Client) ul = Client->Release();
+ PRINT("finished (%d)", ul);
+ }
+ BOOL LoadFile(TCHAR *filename)
+ {
+ HRESULT hr = S_FALSE;
+ if (Client && Control && DataSpaces)
+ {
+ hr = Client->SetEventCallbacks(this);
+ if (S_OK == hr) hr = Client->SetOutputCallbacks(this);
+ DebugSymbols->AddSymbolOptions(SYMOPT_DEBUG);
+
//DebugSymbols->RemoveSymbolOptions(SYMOPT_DEFERRED_LOADS);
+ DebugSymbols->AppendSymbolPath(".");
+
//DebugSymbols->AppendSymbolPath("D:\\SVN\\Qumranet\\drivers\\Logs\\2009-4\\Install\\Vista\\x86");
+
+ }
+ else
+ {
+ CString sMessage = TEXT("Error: Not all required
interaces are up\n");
+ if (!Client) sMessage += TEXT("Client interface is not
initialized\n");
+ if (!Control) sMessage += TEXT("Control interface is
not initialized\n");
+ if (!DataSpaces) sMessage += TEXT("Data interface is
not initialized\n");
+ PRINT("%s", sMessage.GetBuffer());
+ }
+ if (hr == S_OK)
+ {
+ hr = Client->OpenDumpFile(filename);
+ }
+ if (hr == S_OK) Control->WaitForEvent(0, INFINITE);
+ return hr == S_OK;
+ }
+ void ProcessDumpFile();
+ void FindOurTaggedCrashData();
+ void CheckLoadedSymbols();
+ void ParseCrashData(tBugCheckStaticDataHeader *ph, ULONG64 databuffer,
ULONG bytesRead);
+ typedef enum _tageSystemProperty {espSymbolPath, espSystemVersion }
eSystemProperty;
+ CString GetProperty(eSystemProperty Prop);
+protected:
+ CString Parse(ULONG64 val, const tNamedValue *pt)
+ {
+ CString s;
+ while (pt->name) { if (pt->value == val) { s = pt->name; break;
} pt++; }
+ if (s.IsEmpty()) s.Format(TEXT("Unknown value 0x%I64X"), val);
+ return s;
+ }
+
+ CString Parse(ULONG64 val, const tNamedFlag *pt)
+ {
+ CString s;
+ while (pt->name && val)
+ {
+ if ((pt->flag & val) == pt->flag)
+ {
+ val &= ~pt->flag;
+ if (!s.IsEmpty()) s += ' ';
+ s += pt->name;
+ }
+ pt++;
+ }
+ if (val)
+ {
+ CString sv;
+ sv.Format(TEXT("0x%X"), val);
+ if (!s.IsEmpty()) s += ' ';
+ s += sv;
+ }
+ return s;
+ }
+protected:
+ STDMETHOD_(ULONG, AddRef)(
+ THIS
+ ) { return ++refCount; }
+ STDMETHOD_(ULONG, Release)(
+ THIS
+ ) { return --refCount; }
+ STDMETHOD(QueryInterface)(
+ THIS_
+ __in REFIID InterfaceId,
+ __out PVOID* Interface
+ )
+ {
+ *Interface = NULL;
+ if (IsEqualIID(InterfaceId, __uuidof(IUnknown)) ||
+ IsEqualIID(InterfaceId, __uuidof(IDebugEventCallbacks)))
+ {
+ *Interface = (IDebugEventCallbacks *)this;
+ }
+ else if (IsEqualIID(InterfaceId, __uuidof(IDebugOutputCallbacks)))
+ {
+ *Interface = (IDebugOutputCallbacks *)this;
+ }
+ if (*Interface) AddRef();
+ return (*Interface) ? S_OK : E_NOINTERFACE;
+ }
+ STDMETHOD(GetInterestMask)(
+ THIS_
+ __out PULONG Mask
+ )
+ {
+ *Mask =
+DEBUG_EVENT_BREAKPOINT |
+DEBUG_EVENT_EXCEPTION |
+DEBUG_EVENT_LOAD_MODULE |
+DEBUG_EVENT_UNLOAD_MODULE |
+DEBUG_EVENT_SYSTEM_ERROR |
+DEBUG_EVENT_SESSION_STATUS |
+DEBUG_EVENT_CHANGE_DEBUGGEE_STATE |
+DEBUG_EVENT_CHANGE_ENGINE_STATE |
+DEBUG_EVENT_CHANGE_SYMBOL_STATE ;
+ return S_OK;
+ }
+ STDMETHOD(Breakpoint)(
+ THIS_
+ __in PDEBUG_BREAKPOINT Bp
+ )
+ {
+ PRINT("");
+ return DEBUG_STATUS_BREAK;
+ }
+ STDMETHOD(Exception)(
+ THIS_
+ __in PEXCEPTION_RECORD64 Exception,
+ __in ULONG FirstChance
+ )
+ {
+ PRINT("");
+ return DEBUG_STATUS_NO_CHANGE;
+ }
+
+ STDMETHOD(LoadModule)(
+ THIS_
+ __in ULONG64 ImageFileHandle,
+ __in ULONG64 BaseOffset,
+ __in ULONG ModuleSize,
+ __in PCSTR ModuleName,
+ __in PCSTR ImageName,
+ __in ULONG CheckSum,
+ __in ULONG TimeDateStamp
+ )
+ {
+ PRINT("%s", ImageName);
+ return DEBUG_STATUS_NO_CHANGE;
+ }
+ STDMETHOD(UnloadModule)(
+ THIS_
+ __in PCSTR ImageBaseName,
+ __in ULONG64 BaseOffset
+ )
+ {
+ PRINT("%s", ImageBaseName);
+ return DEBUG_STATUS_NO_CHANGE;
+ }
+ STDMETHOD(SystemError)(
+ THIS_
+ __in ULONG Error,
+ __in ULONG Level
+ )
+ {
+ PRINT("%s");
+ return DEBUG_STATUS_NO_CHANGE;
+ }
+ STDMETHOD(SessionStatus)(
+ THIS_
+ __in ULONG Status
+ )
+ {
+ CString s = Parse(Status, SessionStatusValues);
+ PRINT("%s", s.GetBuffer());
+ return DEBUG_STATUS_NO_CHANGE;
+ }
+ STDMETHOD(ChangeDebuggeeState)(
+ THIS_
+ __in ULONG Flags,
+ __in ULONG64 Argument
+ )
+ {
+ CString sf = Parse(Flags, DebuggeeStateValues);
+ CString sarg;
+ if (Flags == DEBUG_CDS_DATA) sarg = Parse(Argument,
DebuggeeStateArgValues);
+ else sarg.Format(TEXT("0x%I64X"), Argument);
+ PRINT("%s(%s)", sf.GetBuffer(), sarg.GetBuffer());
+ return DEBUG_STATUS_NO_CHANGE;
+ return S_OK;
+ }
+ STDMETHOD(ChangeEngineState)(
+ THIS_
+ __in ULONG Flags,
+ __in ULONG64 Argument
+ )
+ {
+ CString s = Parse(Flags, EngineStateFlags);
+ CString sArg;
+ if (Flags == DEBUG_CES_EXECUTION_STATUS)
+ {
+ CString sWait = Parse(Argument & ~DEBUG_STATUS_MASK,
EngineExecutionStatusFlags);
+ sArg = Parse(Argument & DEBUG_STATUS_MASK,
EngineExecutionStatus);
+ sArg += ' ';
+ sArg += sWait;
+ }
+ else
+ sArg.Format(TEXT("arg 0x%I64X"), Argument);
+ PRINT("%s(%s)", s.GetBuffer(), sArg.GetBuffer());
+ if (Flags == DEBUG_CES_EXECUTION_STATUS && (Argument &
DEBUG_STATUS_MASK) == DEBUG_STATUS_BREAK
+ && !(Argument & ~DEBUG_STATUS_MASK))
+ {
+ ProcessDumpFile();
+ }
+ return S_OK;
+ }
+ STDMETHOD(ChangeSymbolState)(
+ THIS_
+ __in ULONG Flags,
+ __in ULONG64 Argument
+ )
+ {
+ CString s = Parse(Flags, SymbolStateFlags);
+ PRINT("%s(arg 0x%I64X)", s.GetBuffer(), Argument);
+ return S_OK;
+ }
+ // IDebugOutputCallbacks.
+ STDMETHOD(Output)(
+ THIS_
+ __in ULONG Mask,
+ __in PCSTR Text
+ )
+ {
+ //printf("%s", Text);
+ //OutputDebugString(Text);
+ return S_OK;
+ }
+ ULONG refCount;
+ IDebugClient *Client;
+ IDebugControl *Control;
+ IDebugDataSpaces3 *DataSpaces;
+ DEBUG_SYMBOLS_IF *DebugSymbols;
+};
+
+#define CHECK_INTERFACE(xf) { \
+xf *p; HRESULT hr = Client->QueryInterface(__uuidof(xf), (void **)&p); \
+PRINT("Interface " TEXT(STRINGER(xf)) TEXT(" %spresent"), p ? "" : "NOT "); \
+if (p) p->Release(); }
+
+
+static void ParseHistoryEntry(LONGLONG basetime, tBugCheckHistoryDataEntry
*phist, LONG Index)
+{
+ if (!phist)
+ {
+ PRINT("Op Ctx Time Params");
+ }
+ else if (phist[Index].Context)
+ {
+ LONGLONG diffInt = (basetime - phist[Index].TimeStamp.QuadPart)
/ 10;
+ CString sOp = HistoryOperationName(phist[Index].operation);
+
+#if (PARANDIS_DEBUG_HISTORY_DATA_VERSION == 0)
+ PRINT("%s %I64X [-%09I64d] x%08X x%08X x%08X %I64X",
sOp.GetBuffer(), phist[Index].Context, diffInt, phist[Index].lParam2,
phist[Index].lParam3, phist[Index].lParam4, phist[Index].pParam1 );
+#elif (PARANDIS_DEBUG_HISTORY_DATA_VERSION == 1)
+ PRINT("CPU[%d] IRQL[%d] %s %I64X [-%09I64d] x%08X x%08X x%08X
%I64X", phist[Index].uProcessor, phist[Index].uIRQL, sOp.GetBuffer(),
phist[Index].Context, diffInt, phist[Index].lParam2, phist[Index].lParam3,
phist[Index].lParam4, phist[Index].pParam1 );
+#endif
+ }
+}
+
+void tDumpParser::ParseCrashData(tBugCheckStaticDataHeader *ph, ULONG64
databuffer, ULONG bytesRead)
+{
+ UINT i;
+ for (i = 0; i < ph->ulMaxContexts; ++i)
+ {
+ tBugCheckPerNicDataContent_V0 *pndc =
(tBugCheckPerNicDataContent_V0 *)(ph->PerNicData - databuffer + (PUCHAR)ph);
+ pndc += i;
+ if (pndc->Context)
+ {
+ LONGLONG diffInt = (ph->qCrashTime.QuadPart -
pndc->LastInterruptTimeStamp.QuadPart) / 10;
+ LONGLONG diffTx = (ph->qCrashTime.QuadPart -
pndc->LastTxCompletionTimeStamp.QuadPart) / 10;
+ PRINT("Context %I64X:", pndc->Context);
+ PRINT("\tLastInterrupt %I64d us before crash", diffInt);
+ PRINT("\tLast Tx complete %I64d us before crash",
diffTx);
+ PRINT("\tWaiting %d packets, %d free buffers",
pndc->nofPacketsToComplete, pndc->nofReadyTxBuffers);
+ }
+ }
+ tBugCheckStaticDataContent_V0 *pd = (tBugCheckStaticDataContent_V0
*)(ph->DataArea - databuffer + (PUCHAR)ph);
+ tBugCheckHistoryDataEntry *phist = (tBugCheckHistoryDataEntry
*)(pd->HistoryData - databuffer + (PUCHAR)ph);
+ PRINT("History: version %d, %d entries of %d, current at %d",
pd->HistoryDataVersion, pd->SizeOfHistory, pd->SizeOfHistoryEntry,
pd->CurrentHistoryIndex);
+ LONG Index = pd->CurrentHistoryIndex % pd->SizeOfHistory;
+ LONG EndIndex = Index;
+ ParseHistoryEntry(NULL, NULL, 0);
+ for (; Index < (LONG)pd->SizeOfHistory; Index++)
+ {
+ ParseHistoryEntry(ph->qCrashTime.QuadPart, phist, Index);
+ }
+ for (Index = 0; Index < EndIndex; Index++)
+ {
+ ParseHistoryEntry(ph->qCrashTime.QuadPart, phist, Index);
+ }
+}
+
+
+
+void tDumpParser::FindOurTaggedCrashData()
+{
+ ULONG64 h;
+ if (S_OK == DataSpaces->StartEnumTagged(&h))
+ {
+ UCHAR ourBuffer[16];
+ ULONG size;
+ GUID guid;
+ while (S_OK == DataSpaces->GetNextTagged(h, &guid, &size))
+ {
+ WCHAR string[64];
+ StringFromGUID2(guid, string,
sizeof(string)/sizeof(string[0]));
+ //PRINT("Found %S(size %d)", string, size);
+ if (IsEqualGUID(ParaNdis_CrashGuid, guid))
+ {
+ PRINT("Found NetKVM GUID");
+ if (S_OK == DataSpaces->ReadTagged(&guid, 0,
ourBuffer, size, &size))
+ {
+ if (size >=
sizeof(tBugCheckDataLocation))
+ {
+ tBugCheckDataLocation *bcdl =
(tBugCheckDataLocation *)ourBuffer;
+ PRINT("Found NetKVM data at
%I64X, size %d", bcdl->Address, bcdl->Size);
+ ULONG bufferSize=
(ULONG)bcdl->Size;
+ ULONG bytesRead;
+ PVOID databuffer =
malloc(bufferSize);
+ if (databuffer)
+ {
+ if (S_OK ==
DataSpaces->ReadVirtual(bcdl->Address, databuffer, bufferSize, &bytesRead))
+ {
+
tBugCheckStaticDataHeader *ph = (tBugCheckStaticDataHeader *)databuffer;
+
PRINT("Retrieved %d bytes of data", bytesRead);
+ if (bytesRead
>= sizeof(tBugCheckStaticDataHeader))
+ {
+
PRINT("Versions: status data %d, pre-NIC data %d, ptr size %d, %d contexts,
crash time %I64X",
+
ph->StaticDataVersion, ph->PerNicDataVersion, ph->SizeOfPointer,
ph->ulMaxContexts, ph->qCrashTime);
+
PRINT("Per-NIC data at %I64X, Static data at %I64X(%d bytes)", ph->PerNicData,
ph->DataArea, ph->DataAreaSize);
+
ParseCrashData(ph, bcdl->Address, bytesRead);
+ }
+ }
+ free(databuffer);
+ }
+ }
+ }
+ break;
+ }
+ }
+ DataSpaces->EndEnumTagged(h);
+
+ }
+}
+
+static BOOL GetModuleName(ULONG Which, ULONG64 Base, DEBUG_SYMBOLS_IF
*DebugSymbols, CString& s)
+{
+ HRESULT hr;
+ ULONG bufsize = 1024;
+ char *buf = (char *)malloc(bufsize);
+ *buf = 0;
+ hr = DebugSymbols->GetModuleNameString(
+ Which,
+ DEBUG_ANY_ID,
+ Base,
+ buf,
+ bufsize,
+ NULL);
+ s = buf;
+ free(buf);
+ return S_OK == hr;
+}
+
+static BOOL TryMatchingSymbols(DEBUG_SYMBOLS_IF *DebugSymbols, PCSTR name)
+{
+ UINT n = 0;
+ CString s;
+ s.Format("%s!*", name);
+ ULONG64 matchHandle;
+ if (S_OK == DebugSymbols->StartSymbolMatch(s.GetBuffer(), &matchHandle))
+ {
+ ULONG size = 1024;
+ char *buf = (char *)malloc(size);
+ *buf = 0;
+ while (S_OK == DebugSymbols->GetNextSymbolMatch(
+ matchHandle, buf, size, NULL, NULL))
+ {
+ n++;
+ break;
+ }
+ DebugSymbols->EndSymbolMatch(matchHandle);
+ free(buf);
+ }
+ return n != 0;
+}
+
+void tDumpParser::CheckLoadedSymbols()
+{
+ ULONG index;
+ ULONG bufferSize = 2048, bufferUsage;
+ UNREFERENCED_PARAMETER(bufferUsage);
+ ULONG64 Base;
+ char *buffer = (char *)malloc(bufferSize);
+ DEBUG_MODULE_PARAMETERS ModuleParams;
+ PCSTR name = "netkvm";
+ HRESULT hr = DebugSymbols->GetModuleByModuleName(name, 0, &index,
&Base);
+ if (S_OK == hr)
+ {
+ CString s;
+ PRINT("Found %s at %I64X", name, Base);
+ if (GetModuleName(DEBUG_MODNAME_MODULE, Base, DebugSymbols, s))
+ PRINT("\tModule Name:%s", s.GetBuffer());
+ if (GetModuleName(DEBUG_MODNAME_IMAGE, Base, DebugSymbols, s))
+ PRINT("\tImage Name:%s", s.GetBuffer());
+ if (GetModuleName(DEBUG_MODNAME_SYMBOL_FILE, Base,
DebugSymbols, s))
+ PRINT("\tSymbol file:%s", s.GetBuffer());
+
+
+
+#if 0
+ {
+ // this does not retrive information, produces error
D0000147
+ hr = DebugSymbols->GetModuleVersionInformation(
+ index, Base, "\\", buffer, bufferSize,
&bufferUsage);
+ if (S_OK == hr)
+ {
+ VS_FIXEDFILEINFO *ffi = (VS_FIXEDFILEINFO
*)buffer;
+ PRINT("File version:%d.%d.%d.%d",
HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS));
+ }
+ else
+ {
+ CString sError = ErrorToString(hr & 0xffff);
+ PRINT("Error %08X loading symbols: %s", hr,
sError.GetBuffer());
+ }
+ // this does not improve clearness of loading
+ // gives the wrong OK status when the PDB is not loaded
+ CString sLoadFor = s;
+ PRINT("Trying to load symbols for %s...", sLoadFor);
+ hr = DebugSymbols->Reload(sLoadFor);
+ if (S_OK == hr)
+ {
+ PRINT("Symbols for %s loaded successfully",
name);
+ if (GetModuleName(DEBUG_MODNAME_SYMBOL_FILE,
Base, DebugSymbols, s))
+ PRINT("\tSymbol file:%s",
s.GetBuffer());
+ }
+ else
+ {
+ CString sError = ErrorToString(hr);
+ PRINT("Error %08X loading symbols: %s", hr,
sError.GetBuffer());
+ }
+ }
+#endif
+ BOOL bLoaded = 0 != TryMatchingSymbols(DebugSymbols, name);
+ PRINT("Symbols for %s %sLOADED", name, bLoaded ? "" : "NOT ");
+
+
+ if (S_OK == DebugSymbols->GetModuleParameters(1, &Base, 0,
&ModuleParams))
+ {
+ CString sSymbolType = Parse(ModuleParams.SymbolType,
SymbolTypeValues);
+ CString sFlags = Parse(ModuleParams.Flags, ModuleFlags);
+ PRINT("Symbol Type %s, Flags %s",
sSymbolType.GetBuffer(), sFlags.GetBuffer());
+ // timestamp from 1.1.1970
+ __time32_t timestamp = ModuleParams.TimeDateStamp;
+ tm *timer = _gmtime32(×tamp);
+ strftime(buffer, bufferSize, "%d %b %Y %H:%M:%S UTC",
timer);
+ //PRINT("Checksum: %X", ModuleParams.Checksum);
+ PRINT("Time Stamp: %s(%X)", buffer,
ModuleParams.TimeDateStamp);
+ }
+ }
+ free(buffer);
+}
+
+void ExtractKernelLog(IDebugDataSpaces3 *DataSpaces)
+{
+ // does not work
+ ULONG SizeUsed;
+ ULONG64 KdBufferAddr = 0, KdSizeAddr = 0;
+ HRESULT hr = DataSpaces->ReadDebuggerData(
+ DEBUG_DATA_KdPrintCircularBufferPtrAddr,
+ &KdBufferAddr,
+ sizeof(KdBufferAddr),
+ &SizeUsed);
+ if (S_OK == hr) hr = DataSpaces->ReadDebuggerData(
+ DEBUG_DATA_KdPrintBufferSizeAddr,
+ &KdSizeAddr,
+ sizeof(KdSizeAddr),
+ &SizeUsed);
+ if (S_OK == hr) hr = DataSpaces->ReadDebuggerData(
+ DEBUG_DATA_KdPrintBufferSizeAddr,
+ &KdSizeAddr,
+ sizeof(KdSizeAddr),
+ &SizeUsed);
+
+}
+
+void tDumpParser::ProcessDumpFile()
+{
+ ULONG SymbolOptions;
+ CString s;
+ if (S_OK == DebugSymbols->GetSymbolOptions(&SymbolOptions))
+ {
+ s = Parse(SymbolOptions, SymbolOptionsFlags);
+ PRINT("Symbol options %s", s.GetBuffer());
+ }
+
+ s = GetProperty(espSymbolPath);
+ PRINT("Symbol path:%s", s.GetBuffer());
+ s = GetProperty(espSystemVersion);
+ PRINT("System version:%s", s.GetBuffer());
+
+ FindOurTaggedCrashData();
+ CheckLoadedSymbols();
+ //ExtractKernelLog();
+}
+
+CString tDumpParser::GetProperty(eSystemProperty Prop)
+{
+ CString s;
+ switch (Prop)
+ {
+ case espSymbolPath:
+ if (DebugSymbols)
+ {
+ ULONG maxlen = 1024, len;
+ char *buf = (char *)malloc(maxlen);
+ *buf = 0;
+ DebugSymbols->GetSymbolPath(buf, maxlen, &len);
+ s = buf;
+ free(buf);
+ }
+ break;
+ case espSystemVersion:
+ if (Control)
+ {
+ ULONG platform, major, minor, sp, buildsize =
128, buildused, procs = 0;
+ char *buf = (char *)malloc(buildsize);
+ *buf = 0;
+ BOOL Is64 = Control->IsPointer64Bit() == S_OK;
+ CString sSP;
+ Control->GetNumberProcessors(&procs);
+ Control->GetSystemVersion(&platform, &major,
&minor, NULL, 0, NULL, &sp, buf, buildsize, &buildused);
+ if (sp) sSP.Format("(SP%d.%d)", sp >> 8, sp &
0xff);
+ s.Format("(%X)%d%s%s,%s,%d CPU",
+ major, minor, sSP.GetBuffer(), Is64 ?
"(64-bit)" : "", buf, procs);
+ free(buf);
+ }
+ break;
+ default:
+ break;
+ }
+ return s;
+}
+
+
+int ParseDumpFile(int argc, TCHAR* argv[])
+{
+ if (1)
+ {
+ tDumpParser Parser;
+ if (argc == 2)
+ {
+ if (!Parser.LoadFile(argv[1])) PRINT("Failed to load
dump file %s", argv[1]);
+ }
+ }
+ else
+ {
+ PRINT("%s", SessionStatusValues[0].name);
+ }
+ return 0;
+}
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.h
b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.h
new file mode 100644
index 0000000..96eeb14
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.h
@@ -0,0 +1,17 @@
+#pragma once
+/**********************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ *
+ * File: NetKVMDumpParser.h
+ *
+ * This file contains ParseDumpFile function declaration
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+**********************************************************************/
+
+
+#include "resource.h"
+
+extern int ParseDumpFile(int argc, TCHAR* argv[]);
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.rc
b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.rc
new file mode 100644
index 0000000..b156127
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.rc
@@ -0,0 +1,69 @@
+//Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+LANGUAGE 25, 1
+#pragma code_page(1251)
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_APP_TITLE "NetKVMDumpParser"
+END
+
+#endif
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#ifndef _AFXDLL
+#include "afxres.rc"
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.sln
b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.sln
new file mode 100644
index 0000000..7de5f5a
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetKVMDumpParser",
"NetKVMDumpParser.vcproj", "{EE008D99-FE23-46E6-A4DE-43259E2F2614}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EE008D99-FE23-46E6-A4DE-43259E2F2614}.Debug|Win32.ActiveCfg =
Debug|Win32
+ {EE008D99-FE23-46E6-A4DE-43259E2F2614}.Debug|Win32.Build.0 =
Debug|Win32
+ {EE008D99-FE23-46E6-A4DE-43259E2F2614}.Release|Win32.ActiveCfg
= Release|Win32
+ {EE008D99-FE23-46E6-A4DE-43259E2F2614}.Release|Win32.Build.0 =
Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.vcproj
b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.vcproj
new file mode 100644
index 0000000..2f662bd
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/NetKVMDumpParser.vcproj
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="NetKVMDumpParser"
+ ProjectGUID="{EE008D99-FE23-46E6-A4DE-43259E2F2614}"
+ RootNamespace="NetKVMDumpParser"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\DebugSdk.vsprops"
+ UseOfMFC="1"
+ CharacterSet="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(DEBUGSDK)\inc"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="dbgeng.lib dbghelp.lib"
+ LinkIncremental="2"
+
AdditionalLibraryDirectories="$(DEBUGSDK)\lib\i386"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\DebugSdk.vsprops"
+ UseOfMFC="1"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(DEBUGSDK)\inc"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+
AdditionalLibraryDirectories="$(DEBUGSDK)\lib\i386"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\NetKVMDumpParser.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\NetKVMDumpParser.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\NetKVMDumpParser.rc"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="NetKVMDumpParser.rc"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/ReadMe.txt
b/NetKVM/DebugTools/NetKVMDumpParser/ReadMe.txt
new file mode 100644
index 0000000..20b37da
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/ReadMe.txt
@@ -0,0 +1,21 @@
+========================================================================
+ CONSOLE APPLICATION : NetKVMDumpParser Project Overview
+========================================================================
+
+Usage currently is trivial:
+NetKVMDumpParser dump-file
+
+To be useful, must process dumps from latest version of NETKVM,
+in future - from any version supporting crash callback.
+
+Currently there is no advantage of having correct PDB file available.
+It will be loaded if available at native path (where it was built) or in
current directory.
+(NetKVMDumpParser now does not use it, just checks whether symbols are loaded).
+
+(of course, when analyzing the dump in WinDBG, there is AN ADVANTAGE).
+
+In order to compile the tool please make sure that WinDBG SDK is installed.
+Point include and libraries paths to appropriate locations.
+
+
+
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/Resource.h
b/NetKVM/DebugTools/NetKVMDumpParser/Resource.h
new file mode 100644
index 0000000..4547b44
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/Resource.h
@@ -0,0 +1,17 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by NetKVMDumpParser.rc
+//
+
+#define IDS_APP_TITLE 103
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/debug.cmd
b/NetKVM/DebugTools/NetKVMDumpParser/debug.cmd
new file mode 100644
index 0000000..d40fb00
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/debug.cmd
@@ -0,0 +1,2 @@
+debug\NetKVMDumpParser.exe
D:\SVN\Qumranet\drivers\Logs\CrashHandler\memory.dmp > log.txt
+
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/main.cpp
b/NetKVM/DebugTools/NetKVMDumpParser/main.cpp
new file mode 100644
index 0000000..7f5ccd3
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/main.cpp
@@ -0,0 +1,47 @@
+// NetKVMDumpParser.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+/**********************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ *
+ * File: main.cpp
+ *
+ * Contains entry point to console application
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+**********************************************************************/
+
+#include "NetKVMDumpParser.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// The one and only application object
+
+CWinApp theApp;
+
+using namespace std;
+
+int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
+{
+ int nRetCode = 0;
+
+ // initialize MFC and print and error on failure
+ if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
+ {
+ // TODO: change error code to suit your needs
+ _tprintf(_T("Fatal Error: MFC initialization failed\n"));
+ nRetCode = 1;
+ }
+ else
+ {
+ nRetCode = ParseDumpFile(argc, argv);
+ }
+
+ return nRetCode;
+}
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/stdafx.cpp
b/NetKVM/DebugTools/NetKVMDumpParser/stdafx.cpp
new file mode 100644
index 0000000..01c3277
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// NetKVMDumpParser.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/NetKVM/DebugTools/NetKVMDumpParser/stdafx.h
b/NetKVM/DebugTools/NetKVMDumpParser/stdafx.h
new file mode 100644
index 0000000..58ae859
--- /dev/null
+++ b/NetKVM/DebugTools/NetKVMDumpParser/stdafx.h
@@ -0,0 +1,52 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define _CRT_SECURE_NO_WARNINGS
+
+// Modify the following defines if you have to target a platform prior to the
ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different
platforms.
+#ifndef WINVER // Allow use of features specific to
Windows XP or later.
+#define WINVER 0x0501 // Change this to the appropriate value to
target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP
or later.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to
target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98
or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to
target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE
6.0 or later.
+#define _WIN32_IE 0x0600 // Change this to the appropriate value to
target other versions of IE.
+#endif
+
+#include <stdio.h>
+#include <tchar.h>
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors
will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows
headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common
Controls
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common
Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <iostream>
+
+
+
+// TODO: reference additional headers your program requires here
+#include <dbgeng.h>
+#include <dbghelp.h>
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html