From bd71caf62954c8af176e316e2a0ea25ab8256f33 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Mon, 17 Feb 2014 16:06:54 +0000 Subject: [PATCH] [0.3.x] added : bugCheckData ( Function reads the kernel bug check code and related parameters ) git-svn-id: https://pykd.svn.codeplex.com/svn@87300 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pydbgeng.cpp | 22 ++++++++++++++++++++++ pykd/pydbgeng.h | 4 +++- pykd/pymod.cpp | 9 +++------ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/pykd/pydbgeng.cpp b/pykd/pydbgeng.cpp index e6b9825..48ed44a 100644 --- a/pykd/pydbgeng.cpp +++ b/pykd/pydbgeng.cpp @@ -142,4 +142,26 @@ python::list getTargetProcesses() /////////////////////////////////////////////////////////////////////////////// +python::tuple getBugCheckData() +{ + kdlib::SystemCrashInfo crashInfo = {}; + + do { + + AutoRestorePyState pystate; + getSystemCrashInfo( crashInfo ); + + } while(false); + + python::list lst; + lst.append(crashInfo.code); + + for ( unsigned long i = 0; i < crashInfo.paramterCount; ++i) + lst.append(crashInfo.parameters[i]); + + return python::tuple(lst); +} + +/////////////////////////////////////////////////////////////////////////////// + } //end namespace pykd diff --git a/pykd/pydbgeng.h b/pykd/pydbgeng.h index eadf3a7..62c1e2a 100644 --- a/pykd/pydbgeng.h +++ b/pykd/pydbgeng.h @@ -350,6 +350,8 @@ python::list getExceptionInfoParameters( kdlib::ExceptionInfo& exceptionInfo ); std::wstring printExceptionInfo( kdlib::ExceptionInfo& exceptionInfo ); +python::tuple getBugCheckData(); + /////////////////////////////////////////////////////////////////////////////// -} //end namespace pykd \ No newline at end of file +} //end namespace pykd diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index b220136..4694a68 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -185,6 +185,9 @@ BOOST_PYTHON_MODULE( pykd ) "Return the number of seconds since the beginning of 1970" ); python::def("getSystemVersion", pykd::getSystemVersion, "Return systemVersion"); + python::def( "bugCheckData", pykd::getBugCheckData, + "Function reads the kernel bug check code and related parameters\n" + "And return tuple: (code, arg1, arg2, arg3, arg4)" ); // Manage target memory access python::def( "addr64", pykd::addr64, @@ -756,12 +759,6 @@ BOOST_PYTHON_MODULE( pykd ) .def_readonly("thread", &DebugEvent::thread) ; - // 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",python::no_init) .def( "__init__", python::make_constructor(pykd::loadDisasm ) ) .def( "__init__", python::make_constructor(pykd::loadDisasmWithOffset ) )