mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.3.x] added : startProcess extra parameter debugChildren
git-svn-id: https://pykd.svn.codeplex.com/svn@86121 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
529794221e
commit
04e70471dc
@ -60,13 +60,13 @@ kdlib::ExecutionStatus targetStepIn()
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
kdlib::PROCESS_DEBUG_ID startProcess( const std::wstring &processName )
|
kdlib::PROCESS_DEBUG_ID startProcess( const std::wstring &processName, bool debugChildren )
|
||||||
{
|
{
|
||||||
kdlib::PROCESS_DEBUG_ID id;
|
kdlib::PROCESS_DEBUG_ID id;
|
||||||
|
|
||||||
AutoRestorePyState pystate;
|
AutoRestorePyState pystate;
|
||||||
|
|
||||||
id = kdlib::startProcess(processName);
|
id = kdlib::startProcess(processName, debugChildren);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ void targetBreak();
|
|||||||
kdlib::ExecutionStatus targetStep();
|
kdlib::ExecutionStatus targetStep();
|
||||||
kdlib::ExecutionStatus targetStepIn();
|
kdlib::ExecutionStatus targetStepIn();
|
||||||
|
|
||||||
kdlib::PROCESS_DEBUG_ID startProcess( const std::wstring &processName );
|
kdlib::PROCESS_DEBUG_ID startProcess( const std::wstring &processName, bool debugChildren = false );
|
||||||
kdlib::PROCESS_DEBUG_ID attachProcess( kdlib::PROCESS_ID pid );
|
kdlib::PROCESS_DEBUG_ID attachProcess( kdlib::PROCESS_ID pid );
|
||||||
void loadDump( const std::wstring &fileName );
|
void loadDump( const std::wstring &fileName );
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@ static const std::string pykdVersion = PYKD_VERSION_BUILD_STR
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( startProcess_, startProcess, 1, 2 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( detachProcess_, kdlib::detachProcess, 0, 1 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( detachProcess_, kdlib::detachProcess, 0, 1 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( terminateProcess_, kdlib::terminateProcess, 0, 1 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( terminateProcess_, kdlib::terminateProcess, 0, 1 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( attachKernel_, attachKernel, 0, 1 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( attachKernel_, attachKernel, 0, 1 );
|
||||||
@ -87,8 +89,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
|
|
||||||
// Manage debug target
|
// Manage debug target
|
||||||
|
|
||||||
python::def( "startProcess", &startProcess,
|
python::def( "startProcess", &startProcess, startProcess_( boost::python::args( "commandline", "debugChildren" ),
|
||||||
"Start process for debugging" );
|
"Start process for debugging" ) );
|
||||||
python::def( "attachProcess", &attachProcess,
|
python::def( "attachProcess", &attachProcess,
|
||||||
"Attach debugger to a exsisting process" );
|
"Attach debugger to a exsisting process" );
|
||||||
python::def( "detachProcess", &kdlib::detachProcess, detachProcess_( boost::python::args( "pid" ),
|
python::def( "detachProcess", &kdlib::detachProcess, detachProcess_( boost::python::args( "pid" ),
|
||||||
|
32
test/scripts/stacktest.py
Normal file
32
test/scripts/stacktest.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import unittest
|
||||||
|
import pykd
|
||||||
|
import target
|
||||||
|
|
||||||
|
class StackTest(unittest.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.processId = pykd.startProcess( target.appPath + " stacktest" )
|
||||||
|
pykd.go() # skip initial breakpoint
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pykd.killProcess( self.processId )
|
||||||
|
|
||||||
|
def testGetStack(self):
|
||||||
|
|
||||||
|
expectedStack = [ 'targetapp!stackTestRun2',
|
||||||
|
'targetapp!stackTestRun1',
|
||||||
|
'targetapp!stackTestRun',
|
||||||
|
'targetapp!wmain',
|
||||||
|
'targetapp!__tmainCRTStartup',
|
||||||
|
'targetapp!wmainCRTStartup',
|
||||||
|
'kernel32!BaseThreadInitThunk',
|
||||||
|
'ntdll!RtlUserThreadStart' ]
|
||||||
|
|
||||||
|
realStack = []
|
||||||
|
for frame in pykd.getStack():
|
||||||
|
moduleName, symbolName, disp = pykd.findSymbolAndDisp( frame.ip )
|
||||||
|
realStack.append( "%s!%s" % ( moduleName, symbolName ) )
|
||||||
|
|
||||||
|
self.assertEqual( expectedStack, realStack )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user