mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.1.x] added : loadPtrList routine ( instead of loadLinkedList )
[0.1.x] added : loadPtrArray routine ( intead of loadPtrs ) git-svn-id: https://pykd.svn.codeplex.com/svn@72618 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
8c1103f19b
commit
5b45c22301
@ -156,6 +156,10 @@ public:
|
||||
|
||||
std::wstring loadUnicodeStr( ULONG64 address );
|
||||
|
||||
python::list loadPtrList( ULONG64 address );
|
||||
|
||||
python::list loadPtrArray( ULONG64 address, ULONG number );
|
||||
|
||||
ULONG ptrSize();
|
||||
|
||||
ULONG64 ptrByte( ULONG64 offset );
|
||||
|
@ -210,7 +210,11 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
.def( "loadUnicodeString", &DebugClient::loadUnicodeStr,
|
||||
"Return string represention of windows UNICODE_STRING type" )
|
||||
.def( "loadAnsiString", &DebugClient::loadAnsiStr,
|
||||
"Return string represention of windows ANSU_STRING type" )
|
||||
"Return string represention of windows ANSI_STRING type" )
|
||||
.def( "loadPtrList", &DebugClient::loadPtrList,
|
||||
"Return list of pointers, each points to next" )
|
||||
.def( "loadPtrArray", &DebugClient::loadPtrArray,
|
||||
"Read the block of the target's memory and return it as a list of pointers" )
|
||||
.def( "ptrByte", &DebugClient::ptrByte,
|
||||
"Read an unsigned 1-byte integer from the target memory" )
|
||||
.def( "ptrWord", &DebugClient::ptrWord,
|
||||
@ -350,6 +354,10 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return string represention of windows UNICODE_STRING type" );
|
||||
python::def( "loadAnsiString", &loadAnsiStr,
|
||||
"Return string represention of windows ANSU_STRING type" );
|
||||
python::def( "loadPtrList", &loadPtrList,
|
||||
"Return list of pointers, each points to next" );
|
||||
python::def( "loadPtrArray", &loadPtrArray,
|
||||
"Read the block of the target's memory and return it as a list of pointers" );
|
||||
python::def( "ptrByte", &ptrByte,
|
||||
"Read an unsigned 1-byte integer from the target memory" );
|
||||
python::def( "ptrWord", &ptrWord,
|
||||
|
@ -623,5 +623,36 @@ std::string loadAnsiStr( ULONG64 address )
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
python::list DebugClient::loadPtrList( ULONG64 address )
|
||||
{
|
||||
ULONG64 entryAddress = 0;
|
||||
|
||||
python::list lst;
|
||||
|
||||
for( entryAddress = ptrPtr( address ); entryAddress != address && entryAddress != 0; entryAddress = ptrPtr( entryAddress ) )
|
||||
lst.append( entryAddress );
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
python::list loadPtrList( ULONG64 address )
|
||||
{
|
||||
return g_dbgClient->loadPtrList( address );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
python::list DebugClient::loadPtrArray( ULONG64 address, ULONG number )
|
||||
{
|
||||
return ptrSize() == 8 ? loadQWords( address, number ) : loadDWords( address, number );
|
||||
}
|
||||
|
||||
python::list loadPtrArray( ULONG64 address, ULONG number )
|
||||
{
|
||||
return g_dbgClient->loadPtrArray( address, number );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}; // end of pykd
|
||||
|
||||
|
@ -86,6 +86,10 @@ std::wstring loadUnicodeStr( ULONG64 address );
|
||||
|
||||
std::string loadAnsiStr( ULONG64 address );
|
||||
|
||||
python::list loadPtrList( ULONG64 address );
|
||||
|
||||
python::list loadPtrArray( ULONG64 address, ULONG number );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
};
|
||||
|
@ -46,9 +46,7 @@ class BaseTest( unittest.TestCase ):
|
||||
self.assertTrue( hasattr(pykd, 'loadChars') )
|
||||
self.assertTrue( hasattr(pykd, 'loadDWords') )
|
||||
self.assertTrue( hasattr(pykd, 'loadDump') )
|
||||
self.assertTrue( hasattr(pykd, 'loadLinkedList') )
|
||||
self.assertTrue( hasattr(pykd, 'loadModule') )
|
||||
self.assertTrue( hasattr(pykd, 'loadPtrs') )
|
||||
self.assertTrue( hasattr(pykd, 'loadQWords') )
|
||||
self.assertTrue( hasattr(pykd, 'loadSignBytes') )
|
||||
self.assertTrue( hasattr(pykd, 'loadSignDWords') )
|
||||
@ -108,6 +106,8 @@ class BaseTest( unittest.TestCase ):
|
||||
self.assertFalse( hasattr(pykd, 'dbgStackFrameClass') )
|
||||
self.assertFalse( hasattr(pykd, 'debugEvent') )
|
||||
self.assertFalse( hasattr(pykd, 'findModule') )
|
||||
self.assertFalse( hasattr(pykd, 'loadLinkedList') )
|
||||
self.assertFalse( hasattr(pykd, 'loadPtrs') )
|
||||
self.assertFalse( hasattr(pykd, 'windbgIn') )
|
||||
self.assertFalse( hasattr(pykd, 'windbgOut') )
|
||||
|
||||
@ -118,6 +118,8 @@ class BaseTest( unittest.TestCase ):
|
||||
self.assertTrue( hasattr(pykd, 'getDebuggeeType' ) )
|
||||
self.assertTrue( hasattr(pykd, 'getExecutionStatus' ) )
|
||||
self.assertTrue( hasattr(pykd, 'loadExt') )
|
||||
self.assertTrue( hasattr(pykd, 'loadPtrList') )
|
||||
self.assertTrue( hasattr(pykd, 'loadPtrArray') )
|
||||
self.assertTrue( hasattr(pykd, 'setExecutionStatus') )
|
||||
self.assertTrue( hasattr(pykd, 'waitForEvent') )
|
||||
|
||||
|
@ -87,3 +87,11 @@ class MemoryTest( unittest.TestCase ):
|
||||
self.assertFalse( pykd.isValid( 0 ) )
|
||||
self.assertFalse( pykd.isValid( 0xDEADBEAF ) )
|
||||
|
||||
def testPtrList( self ):
|
||||
lst = pykd.loadPtrList( target.module.g_listHead )
|
||||
self.assertEqual( 3, len( lst ) )
|
||||
|
||||
def testPtrArray( self ):
|
||||
lst = pykd.loadPtrArray( target.module.arrIntMatrixPtrs, 3 )
|
||||
self.assertEqual( 3, len( lst ) )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user