mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[+] pyDia: bit-fields + tests
git-svn-id: https://pykd.svn.codeplex.com/svn@69948 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
394dfb7816
commit
9d7ed7cb4d
@ -157,6 +157,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Retrieves a flag of basic type for symbol")
|
"Retrieves a flag of basic type for symbol")
|
||||||
.def( "baseType", &pyDia::Symbol::getBaseType,
|
.def( "baseType", &pyDia::Symbol::getBaseType,
|
||||||
"Retrieves the base type for this symbol")
|
"Retrieves the base type for this symbol")
|
||||||
|
.def( "bitPos", &pyDia::Symbol::getBitPosition,
|
||||||
|
"Retrieves the base type for this symbol")
|
||||||
.def( "__str__", &pyDia::Symbol::print)
|
.def( "__str__", &pyDia::Symbol::print)
|
||||||
.def("__getitem__", &pyDia::Symbol::getChildByName)
|
.def("__getitem__", &pyDia::Symbol::getChildByName)
|
||||||
.def("__len__", &pyDia::Symbol::getChildCount )
|
.def("__len__", &pyDia::Symbol::getChildCount )
|
||||||
|
@ -59,4 +59,18 @@ class DiaTest( unittest.TestCase ):
|
|||||||
self.assertEqual(pykd.btBool, globalScope["g_constBoolValue"].type().baseType())
|
self.assertEqual(pykd.btBool, globalScope["g_constBoolValue"].type().baseType())
|
||||||
self.assertEqual(pykd.btULong, globalScope["g_ulongValue"].type().baseType())
|
self.assertEqual(pykd.btULong, globalScope["g_ulongValue"].type().baseType())
|
||||||
|
|
||||||
|
def testBits(self):
|
||||||
|
globalScope = pykd.diaOpenPdb( str(target.module.pdb()) )
|
||||||
|
structWithBits = globalScope["structWithBits"]
|
||||||
|
bitField = structWithBits["m_bit0_4"]
|
||||||
|
self.assertEqual(pykd.LocIsBitField, bitField.locType())
|
||||||
|
self.assertEqual(0, bitField.bitPos())
|
||||||
|
self.assertEqual(5, bitField.size())
|
||||||
|
bitField = structWithBits["m_bit5"]
|
||||||
|
self.assertEqual(pykd.LocIsBitField, bitField.locType())
|
||||||
|
self.assertEqual(5, bitField.bitPos())
|
||||||
|
self.assertEqual(1, bitField.size())
|
||||||
|
bitField = structWithBits["m_bit6_7"]
|
||||||
|
self.assertEqual(pykd.LocIsBitField, bitField.locType())
|
||||||
|
self.assertEqual(6, bitField.bitPos())
|
||||||
|
self.assertEqual(2, bitField.size())
|
||||||
|
@ -17,6 +17,13 @@ ULONGLONG g_ulonglongValue = 8;
|
|||||||
|
|
||||||
std::string g_string;
|
std::string g_string;
|
||||||
|
|
||||||
|
struct structWithBits {
|
||||||
|
ULONG m_bit0_4 : 5;
|
||||||
|
ULONG m_bit5 : 1;
|
||||||
|
ULONG m_bit6_7 : 2;
|
||||||
|
};
|
||||||
|
structWithBits g_structWithBits = {0};
|
||||||
|
|
||||||
void FuncWithName0()
|
void FuncWithName0()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user