diff --git a/pykd/dbgengine.h b/pykd/dbgengine.h index f9ddfb6..f59c0e9 100644 --- a/pykd/dbgengine.h +++ b/pykd/dbgengine.h @@ -132,6 +132,17 @@ enum EVENT_TYPE { EVENT_TYPE getLastEventType(); ExceptionInfoPtr getLastExceptionInfo(); + +struct BUG_CHECK_DATA +{ + ULONG code; + ULONG64 arg1; + ULONG64 arg2; + ULONG64 arg3; + ULONG64 arg4; +}; +void readBugCheckData(BUG_CHECK_DATA &bugCheckData); + void eventRegisterCallbacks( const DEBUG_EVENT_CALLBACK *callbacks ); void eventRemoveCallbacks( const DEBUG_EVENT_CALLBACK *callbacks ); diff --git a/pykd/python/pymod.cpp b/pykd/python/pymod.cpp index 5e5a109..3ed0d88 100644 --- a/pykd/python/pymod.cpp +++ b/pykd/python/pymod.cpp @@ -549,8 +549,13 @@ BOOST_PYTHON_MODULE( pykd ) .value("ChangeSymbolState", EventTypeChangeSymbolState) .export_values(); - python::def( "lastEvent", &getLastEventType, "Return type of last event: eventType" ); - python::def( "lastException", &getLastExceptionInfo, "Return data of last exception event: exceptionInfo" ); + python::def( "lastEvent", &getLastEventType, + "Return type of last event: eventType" ); + python::def( "lastException", &getLastExceptionInfo, + "Return data of last exception event: exceptionInfo" ); + python::def( "bugCheckData", &pysupport::getBugCheckData, + "Function reads the kernel bug check code and related parameters\n" + "And return tuple: (code, arg1, arg2, arg3, arg4)" ); python::class_("disasm", "Class disassemble a processor instructions" ) .def( python::init<>( "constructor" ) ) diff --git a/pykd/python/pysupport.cpp b/pykd/python/pysupport.cpp index e3b188c..0f6ed06 100644 --- a/pykd/python/pysupport.cpp +++ b/pykd/python/pysupport.cpp @@ -25,6 +25,13 @@ python::list getProcessThreads() return threadsLst; } +python::tuple getBugCheckData() +{ + BUG_CHECK_DATA bugCheckData; + readBugCheckData(bugCheckData); + return python::make_tuple(bugCheckData.code, bugCheckData.arg1, bugCheckData.arg2, bugCheckData.arg3, bugCheckData.arg4); +} + /////////////////////////////////////////////////////////////////////////////// } } //pykd::support namespace end \ No newline at end of file diff --git a/pykd/python/pysupport.h b/pykd/python/pysupport.h index f9a2139..0e90640 100644 --- a/pykd/python/pysupport.h +++ b/pykd/python/pysupport.h @@ -9,6 +9,8 @@ namespace pysupport { python::list getProcessThreads(); +python::tuple getBugCheckData(); + } } //pykd::support namespace end /////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/win/lastevent.cpp b/pykd/win/lastevent.cpp index e925a5e..1c1dc26 100644 --- a/pykd/win/lastevent.cpp +++ b/pykd/win/lastevent.cpp @@ -91,6 +91,19 @@ ExceptionInfoPtr getLastExceptionInfo() ); } +void readBugCheckData(BUG_CHECK_DATA &bugCheckData) +{ + HRESULT hres = + g_dbgEng->control->ReadBugCheckData( + &bugCheckData.code, + &bugCheckData.arg1, + &bugCheckData.arg2, + &bugCheckData.arg3, + &bugCheckData.arg4); + if (S_OK != hres) + throw DbgException("IDebugControl::GetLastEventInformation", hres); +} + } ////////////////////////////////////////////////////////////////////////////////