mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.2.x] added : startProcess routine extra parameter debugChildren
[0.2.x] fixed : killProcess correctly detaching from target now git-svn-id: https://pykd.svn.codeplex.com/svn@86120 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
0b80b37258
commit
976e43a31a
@ -6,7 +6,7 @@
|
||||
namespace pykd {
|
||||
|
||||
// manage debug target
|
||||
ULONG startProcess( const std::wstring &processName );
|
||||
ULONG startProcess( const std::wstring &processName, bool debugChildren = false );
|
||||
ULONG attachProcess( ULONG pid );
|
||||
void attachKernel( const std::string &connectOptions = "" );
|
||||
bool isLocalKernelDebuggerEnabled();
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define PYKD_VERSION_MAJOR 0
|
||||
#define PYKD_VERSION_MINOR 2
|
||||
#define PYKD_VERSION_SUBVERSION 0
|
||||
#define PYKD_VERSION_BUILDNO 25
|
||||
#define PYKD_VERSION_BUILDNO 26
|
||||
|
||||
|
||||
#define __VER_STR2__(x) #x
|
||||
|
@ -38,6 +38,7 @@ static const std::string pykdVersion = PYKD_VERSION_BUILD_STR
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( startProcess_, startProcess, 1, 2 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( attachKernel_, attachKernel, 0, 1 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( detachProcess_, detachProcess, 0, 1 );
|
||||
|
||||
@ -90,8 +91,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
|
||||
// Manage debug target
|
||||
|
||||
python::def( "startProcess", &startProcess,
|
||||
"Start process for debugging" );
|
||||
python::def( "startProcess", &startProcess, startProcess_( boost::python::args( "commandline", "debugChildren" ),
|
||||
"Start process for debugging" ) );
|
||||
python::def( "attachProcess", &attachProcess,
|
||||
"Attach debugger to a exsisting process" );
|
||||
python::def( "attachKernel", &attachKernel, attachKernel_( boost::python::args( "connectOptions" ),
|
||||
|
@ -13,7 +13,7 @@ namespace pykd {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ULONG startProcess( const std::wstring &processName )
|
||||
ULONG startProcess( const std::wstring &processName, bool debugChildren )
|
||||
{
|
||||
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||
|
||||
@ -32,7 +32,12 @@ ULONG startProcess( const std::wstring &processName )
|
||||
std::vector< std::wstring::value_type > cmdLine( processName.size() + 1 );
|
||||
wcscpy_s( &cmdLine[0], cmdLine.size(), processName.c_str() );
|
||||
|
||||
hres = g_dbgEng->client->CreateProcessWide( 0, &cmdLine[0], DEBUG_PROCESS | DETACHED_PROCESS );
|
||||
hres = g_dbgEng->client->CreateProcessWide(
|
||||
0,
|
||||
&cmdLine[0],
|
||||
( debugChildren ? DEBUG_PROCESS : DEBUG_ONLY_THIS_PROCESS) | DETACHED_PROCESS
|
||||
);
|
||||
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugClient4::CreateProcessWide failed" );
|
||||
|
||||
@ -159,6 +164,10 @@ void terminateProcess( ULONG processId )
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugClient::TerminateCurrentProcess", hres );
|
||||
|
||||
hres = g_dbgEng->client->DetachCurrentProcess();
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugClient::DetachCurrentProcess failed" );
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -7,7 +7,7 @@ class PykdMagic (Magics):
|
||||
|
||||
@line_magic
|
||||
def kd(self,line):
|
||||
"any windbg command"
|
||||
"magic for calling any windbg command"
|
||||
try:
|
||||
pykd.dprintln( pykd.dbgCommand(line) )
|
||||
except pykd.BaseException:
|
||||
@ -20,4 +20,3 @@ def load_ipython_extension(ipython):
|
||||
def unload_ipython_extension(ipython):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -37,7 +37,6 @@ class StartProcessWithoutParamsTest(unittest.TestCase):
|
||||
class TerminateProcessTest(unittest.TestCase):
|
||||
def testKill(self):
|
||||
pykd.killProcess( target.processId )
|
||||
pykd.detachProcess( target.processId )
|
||||
|
||||
def getTestSuite( singleName = "" ):
|
||||
if singleName == "":
|
||||
|
Loading…
Reference in New Issue
Block a user