mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[pykd] updated: typedVarList can parse two type of linked list
[pykd] updated: typedVar builds array as python list git-svn-id: https://pykd.svn.codeplex.com/svn@62996 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
bc5876cd1a
commit
67901c6c49
@ -112,17 +112,34 @@ getTypeClass( const std::string &moduleName, const std::string &typeName )
|
|||||||
boost::python::object
|
boost::python::object
|
||||||
loadTypedVarList( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &listEntryName )
|
loadTypedVarList( ULONG64 address, const std::string &moduleName, const std::string &typeName, const std::string &listEntryName )
|
||||||
{
|
{
|
||||||
ULONG64 entryAddress = 0;
|
address = addr64(address);
|
||||||
|
|
||||||
boost::python::list objList;
|
ULONG64 entryAddress = 0;
|
||||||
|
|
||||||
address = addr64(address);
|
const TypeInfo& typeInfo = TypeInfo::get( moduleName, typeName );
|
||||||
for( entryAddress = loadPtrByPtr( address ); entryAddress != address && entryAddress != NULL; entryAddress = loadPtrByPtr( entryAddress ) )
|
|
||||||
|
boost::python::list objList;
|
||||||
|
|
||||||
|
for ( TypeInfo::TypeFieldList::const_iterator field = typeInfo.getFields().begin(); field != typeInfo.getFields().end(); field++ )
|
||||||
{
|
{
|
||||||
objList.append( containingRecord( entryAddress, moduleName, typeName, listEntryName ) );
|
if ( field->name == listEntryName )
|
||||||
|
{
|
||||||
|
if ( field->type.name() == ( typeName + "*" ) )
|
||||||
|
{
|
||||||
|
for( entryAddress = loadPtrByPtr( address ); entryAddress != address && entryAddress != NULL; entryAddress = loadPtrByPtr( entryAddress + field->offset ) )
|
||||||
|
objList.append( loadTypedVar( moduleName, typeName, entryAddress ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( entryAddress = loadPtrByPtr( address ); entryAddress != address && entryAddress != NULL; entryAddress = loadPtrByPtr( entryAddress ) )
|
||||||
|
objList.append( containingRecord( entryAddress, moduleName, typeName, listEntryName ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return objList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return objList;
|
return boost::python::object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -130,14 +147,14 @@ loadTypedVarList( ULONG64 address, const std::string &moduleName, const std::str
|
|||||||
boost::python::object
|
boost::python::object
|
||||||
loadTypedVarArray( ULONG64 address, const std::string &moduleName, const std::string &typeName, long number )
|
loadTypedVarArray( ULONG64 address, const std::string &moduleName, const std::string &typeName, long number )
|
||||||
{
|
{
|
||||||
boost::python::dict objArr;
|
boost::python::list objList;
|
||||||
|
|
||||||
const TypeInfo& typeInfo = TypeInfo::get( moduleName, typeName );
|
const TypeInfo& typeInfo = TypeInfo::get( moduleName, typeName );
|
||||||
|
|
||||||
for( long i = 0; i < number; ++i )
|
for( long i = 0; i < number; ++i )
|
||||||
objArr[i] = loadTypedVar( moduleName, typeName, address + i * typeInfo.size() );
|
objList.append( loadTypedVar( moduleName, typeName, address + i * typeInfo.size() ) );
|
||||||
|
|
||||||
return objArr;
|
return objList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -396,12 +413,12 @@ TypeInfo::load( ULONG64 addr, ULONG offset /* = 0 */ ) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::python::dict arr;
|
boost::python::list arr;
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < field->size / field->type.size(); ++i )
|
for ( unsigned int i = 0; i < field->size / field->type.size(); ++i )
|
||||||
{
|
{
|
||||||
const ULONG locOffset = field->offset + i * (ULONG)field->type.size();
|
const ULONG locOffset = field->offset + i * (ULONG)field->type.size();
|
||||||
arr[i] = field->type.load( addr + locOffset, offset + locOffset );
|
arr.append( field->type.load( addr + locOffset, offset + locOffset ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
var.attr( field->name.c_str() ) = arr;
|
var.attr( field->name.c_str() ) = arr;
|
||||||
|
Loading…
Reference in New Issue
Block a user