mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[0.1.x] added : method asMap for typeInfo ( only for enumerators )
git-svn-id: https://pykd.svn.codeplex.com/svn@72763 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
670659121b
commit
c465d4c110
@ -468,7 +468,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
.def( "bitOffset", &TypeInfo::getBitOffset )
|
||||
.def( "bitWidth", &TypeInfo::getBitWidth )
|
||||
.def( "field", &TypeInfo::getField )
|
||||
.def( "__getattr__", &TypeInfo::getField );
|
||||
.def( "__getattr__", &TypeInfo::getField )
|
||||
.def( "asMap", &TypeInfo::asMap );
|
||||
|
||||
python::class_<TypedVar, TypedVarPtr, python::bases<intBase>, boost::noncopyable >("typedVar",
|
||||
"Class of non-primitive type object, child class of typeClass. Data from target is copied into object instance",
|
||||
|
@ -66,12 +66,26 @@ std::list< SymbolPtr > Symbol::findChildrenImpl(
|
||||
)
|
||||
{
|
||||
DiaEnumSymbolsPtr symbols;
|
||||
HRESULT hres =
|
||||
m_symbol->findChildren(
|
||||
HRESULT hres;
|
||||
|
||||
if ( name.empty() )
|
||||
{
|
||||
hres = m_symbol->findChildren(
|
||||
static_cast<enum SymTagEnum>(symTag),
|
||||
NULL,
|
||||
nameCmpFlags,
|
||||
&symbols);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
hres = m_symbol->findChildren(
|
||||
static_cast<enum SymTagEnum>(symTag),
|
||||
toWStr(name),
|
||||
nameCmpFlags,
|
||||
&symbols);
|
||||
}
|
||||
|
||||
if (S_OK != hres)
|
||||
throw Exception("Call IDiaSymbol::findChildren", hres);
|
||||
|
||||
|
@ -53,8 +53,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,1,0,3
|
||||
PRODUCTVERSION 0,1,0,3
|
||||
FILEVERSION 0,1,0,4
|
||||
PRODUCTVERSION 0,1,0,4
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -70,11 +70,11 @@ BEGIN
|
||||
BLOCK "041904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "pykd - python extension for windbg"
|
||||
VALUE "FileVersion", "0, 1, 0, 3"
|
||||
VALUE "FileVersion", "0, 1, 0, 4"
|
||||
VALUE "InternalName", "pykd"
|
||||
VALUE "OriginalFilename", "pykd.dll"
|
||||
VALUE "ProductName", "pykd - python extension for windbg"
|
||||
VALUE "ProductVersion", "0, 1, 0, 3"
|
||||
VALUE "ProductVersion", "0, 1, 0, 4"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -388,6 +388,27 @@ TypeInfoPtr TypeInfo::getRecurciveComplexType( TypeInfoPtr &lowestType, std::str
|
||||
return lowestType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
python::dict EnumTypeInfo::asMap()
|
||||
{
|
||||
python::dict dct;
|
||||
|
||||
std::list< pyDia::SymbolPtr > symbolsList = m_dia->findChildrenImpl(SymTagData, "", nsfCaseSensitive );
|
||||
|
||||
for ( std::list< pyDia::SymbolPtr >::iterator it = symbolsList.begin(); it != symbolsList.end(); it++ )
|
||||
{
|
||||
CComVariant val;
|
||||
|
||||
(*it)->getValue( val );
|
||||
|
||||
dct[val.ulVal] = (*it)->getName();
|
||||
}
|
||||
|
||||
return dct;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}; // end namespace pykd
|
@ -82,6 +82,9 @@ public:
|
||||
return 8 * getSize();
|
||||
}
|
||||
|
||||
virtual python::dict asMap() {
|
||||
throw DbgException( "there is no fields" );
|
||||
}
|
||||
|
||||
ULONG getOffset() {
|
||||
return m_offset;
|
||||
@ -243,6 +246,8 @@ protected:
|
||||
return ti;
|
||||
}
|
||||
|
||||
virtual python::dict asMap();
|
||||
|
||||
virtual bool isEnum() {
|
||||
return true;
|
||||
}
|
||||
|
@ -101,3 +101,7 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
self.assertEqual( 0, ti.m_doubleValue.offset() )
|
||||
self.assertEqual( 0, ti.m_bits.offset() )
|
||||
self.assertEqual( ti.size(), ti.m_doubleValue.size() )
|
||||
|
||||
def testAsMap(self):
|
||||
ti = target.module.type("enumType")
|
||||
self.assertEqual( { 1 : "ONE", 2 : "TWO", 3 : "THREE" }, ti.asMap() )
|
||||
|
Loading…
Reference in New Issue
Block a user