mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[+] added: loadTypedVarList routine
[!] fixed: typedVar git-svn-id: https://pykd.svn.codeplex.com/svn@53270 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
ea92b6e472
commit
4f95f0e722
@ -42,6 +42,7 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
boost::python::def( "is64bitSystem", is64bitSystem );
|
||||
boost::python::def( "reg", &loadRegister );
|
||||
boost::python::def( "typedVar", &loadTypedVar );
|
||||
boost::python::def( "typedVarList", &loadTypedVarList );
|
||||
boost::python::def( "containingRecord", &containingRecord );
|
||||
boost::python::def( "loadModule", &loadModule );
|
||||
boost::python::def( "findSymbol", &findSymbolForAddress );
|
||||
|
@ -137,27 +137,20 @@ loadPtrArray( ULONG64 address, ULONG number )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
boost::python::object
|
||||
ULONG64
|
||||
loadPtrByPtr( ULONG64 address )
|
||||
{
|
||||
ULONG64 value = 0;
|
||||
|
||||
if ( is64bitSystem() )
|
||||
{
|
||||
ULONG64 value;
|
||||
|
||||
if ( loadMemory( address, &value, sizeof(ULONG64) ) )
|
||||
return boost::python::object( value );
|
||||
|
||||
return boost::python::object();
|
||||
}
|
||||
loadMemory( address, &value, sizeof(ULONG64) );
|
||||
else
|
||||
{
|
||||
ULONG value;
|
||||
|
||||
if ( loadMemory( address, &value, sizeof(ULONG) ) )
|
||||
return boost::python::object( addr64( value ) );
|
||||
|
||||
return boost::python::object();
|
||||
value = addr64( value );
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -9,6 +9,10 @@
|
||||
bool
|
||||
loadMemory( ULONG64 address, PVOID dest, ULONG length );
|
||||
|
||||
ULONG64
|
||||
loadPtrByPtr( ULONG64 address );
|
||||
|
||||
|
||||
template<typename T>
|
||||
boost::python::object
|
||||
loadArray( ULONG64 address, ULONG number )
|
||||
@ -46,9 +50,6 @@ loadByPtr( ULONG64 address )
|
||||
return boost::python::object();
|
||||
}
|
||||
|
||||
boost::python::object
|
||||
loadPtrByPtr( ULONG64 address );
|
||||
|
||||
boost::python::object
|
||||
loadPtrArray( ULONG64 address, ULONG number );
|
||||
|
||||
|
@ -47,9 +47,13 @@ basicTypeNames[] = {
|
||||
"short",
|
||||
"unsigned long",
|
||||
"long",
|
||||
"int",
|
||||
"unsigned int",
|
||||
"<function>",
|
||||
"void",
|
||||
"double"
|
||||
"double",
|
||||
"int64",
|
||||
"unsigned int64"
|
||||
};
|
||||
|
||||
basicTypeLoader basicTypeLoaders[] = {
|
||||
@ -59,9 +63,14 @@ basicTypeLoader basicTypeLoaders[] = {
|
||||
valueLoader<short>,
|
||||
valueLoader<unsigned long>,
|
||||
valueLoader<long>,
|
||||
valueLoader<int>,
|
||||
valueLoader<unsigned int>,
|
||||
valueLoader<void*>,
|
||||
voidLoader,
|
||||
valueLoader<double> };
|
||||
valueLoader<double>,
|
||||
valueLoader<__int64>,
|
||||
valueLoader<unsigned __int64>
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -104,6 +113,10 @@ loadTypedVar( const std::string &moduleName, const std::string &typeName, ULONG6
|
||||
char fieldTypeName[100];
|
||||
hres = dbgExt->symbols->GetTypeName( moduleBase, fieldTypeId, fieldTypeName, sizeof(fieldTypeName), NULL );
|
||||
|
||||
std::string fieldTypeNameStr( fieldTypeName );
|
||||
if ( fieldTypeNameStr == "__unnamed" || fieldTypeNameStr == "<unnamed-tag>" )
|
||||
continue;
|
||||
|
||||
ULONG fieldSize;
|
||||
hres = dbgExt->symbols->GetTypeSize( moduleBase, fieldTypeId, &fieldSize );
|
||||
|
||||
@ -185,6 +198,23 @@ containingRecord( ULONG64 address, const std::string &moduleName, const std::str
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
boost::python::object
|
||||
loadTypedVarList( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &listEntryName )
|
||||
{
|
||||
ULONG64 entryAddress = 0;
|
||||
|
||||
boost::python::list objList;
|
||||
|
||||
for( entryAddress = loadPtrByPtr( address ); entryAddress != address; entryAddress = loadPtrByPtr( entryAddress ) )
|
||||
{
|
||||
objList.append( containingRecord( entryAddress, moduleName, typeName, listEntryName ) );
|
||||
}
|
||||
|
||||
return objList;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool
|
||||
isBaseType( const std::string &typeName )
|
||||
{
|
||||
|
@ -34,6 +34,9 @@ private:
|
||||
boost::python::object
|
||||
loadTypedVar( const std::string &moduleName, const std::string &typeName, ULONG64 address );
|
||||
|
||||
boost::python::object
|
||||
loadTypedVarList( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &listEntryName );
|
||||
|
||||
boost::python::object
|
||||
containingRecord( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &fieldName );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user