From 1bdfc6e278dd3d7fb2fba61bae01f244b15df42b Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Thu, 17 Nov 2011 15:32:28 +0000 Subject: [PATCH] [0.1.x] added : debuggerPath routine git-svn-id: https://pykd.svn.codeplex.com/svn@71441 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/dbgext.cpp | 22 +++++++++++++++++----- pykd/pykd_2008.vcproj | 8 ++++---- pykd/stdafx.h | 1 + 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/pykd/dbgext.cpp b/pykd/dbgext.cpp index 1728682..210e29e 100644 --- a/pykd/dbgext.cpp +++ b/pykd/dbgext.cpp @@ -53,6 +53,16 @@ static python::dict genDict(const pyDia::Symbol::ValueNameEntry srcValues[], siz //////////////////////////////////////////////////////////////////////////////// +std::string +getDebuggerImage() +{ + std::vector buffer(MAX_PATH); + GetModuleFileNameExA( GetCurrentProcess(), NULL, &buffer[0], buffer.size() ); + return std::string( &buffer[0] ); +} + +//////////////////////////////////////////////////////////////////////////////// + BOOST_PYTHON_FUNCTION_OVERLOADS( dprint_, dprint, 1, 2 ); BOOST_PYTHON_FUNCTION_OVERLOADS( dprintln_, dprintln, 1, 2 ); @@ -277,15 +287,17 @@ BOOST_PYTHON_MODULE( pykd ) "Attach debugger to a kernel target" ); python::def( "expr", &pykd::evaluate, "Evaluate windbg expression" ); - python::def( "getDebuggeeType", &pykd::getDebuggeeType, + python::def( "getDebuggeeType", &getDebuggeeType, "Return type of the debuggee" ); - python::def( "getExecutionStatus", &pykd::getExecutionStatus, + python::def( "debuggerPath", &getDebuggerImage, + "Return full path to the process image that uses pykd" ); + python::def( "getExecutionStatus", &getExecutionStatus, "Return information about the execution status of the debugger" ); - python::def( "go", &pykd::changeDebuggerStatus, + python::def( "go", &changeDebuggerStatus, "Change debugger status to DEBUG_STATUS_GO" ); - python::def( "isDumpAnalyzing", &pykd::isDumpAnalyzing, + python::def( "isDumpAnalyzing", &isDumpAnalyzing, "Check if it is a dump analyzing ( not living debuggee )" ); - python::def( "isKernelDebugging", &pykd::isKernelDebugging, + python::def( "isKernelDebugging", &isKernelDebugging, "Check if kernel dubugging is running" ); python::def( "loadBytes", &loadBytes, loadBytes_( python::args( "offset", "count", "phyAddr" ), "Read the block of the target's memory and return it as liat of unsigned bytes" ) ); diff --git a/pykd/pykd_2008.vcproj b/pykd/pykd_2008.vcproj index 57caf37..e96db3d 100644 --- a/pykd/pykd_2008.vcproj +++ b/pykd/pykd_2008.vcproj @@ -70,7 +70,7 @@ /> #include #include +#include #include