mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 19:53:22 +08:00
[0.2.x] fixed : issue #12353 ( typedVar for bit field returns a wrong result for width >= 32 bits )
git-svn-id: https://pykd.svn.codeplex.com/svn@85967 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
5cb3fc858b
commit
81fe97052f
@ -470,7 +470,7 @@ BaseTypeVariant BitFieldVar::getValue()
|
||||
else
|
||||
{
|
||||
val >>= m_typeInfo->getBitOffset();
|
||||
val &= ( 1 << m_typeInfo->getBitWidth() ) - 1;
|
||||
val &= ( 1LL << m_typeInfo->getBitWidth() ) - 1LL;
|
||||
|
||||
switch ( m_typeInfo->getSize() )
|
||||
{
|
||||
|
@ -78,11 +78,11 @@ class ModuleTest( unittest.TestCase ):
|
||||
fileName = pykd.getSourceFile(target.module.FuncWithName0 )
|
||||
self.assertTrue( re.search('targetapp\\.cpp', fileName ) )
|
||||
fileName, lineNo, displacement = pykd.getSourceLine( target.module.FuncWithName0 + 2)
|
||||
self.assertEqual( 421, lineNo )
|
||||
self.assertEqual( 423, lineNo )
|
||||
self.assertTrue( re.search('targetapp\\.cpp', fileName ) )
|
||||
self.assertEqual( 2, displacement )
|
||||
fileName, lineNo, displacement = pykd.getSourceLine()
|
||||
self.assertEqual( 698, lineNo )
|
||||
self.assertEqual( 700, lineNo )
|
||||
|
||||
def testEnumSymbols( self ):
|
||||
lst = target.module.enumSymbols()
|
||||
|
@ -144,10 +144,12 @@ class TypedVarTest( unittest.TestCase ):
|
||||
self.assertEqual( 4, tv.m_bit0_4 )
|
||||
self.assertEqual( 1, tv.m_bit5 )
|
||||
self.assertEqual( 5, tv.m_bit6_8 )
|
||||
self.assertEqual( 0xFF00000000, tv.m_bit0_60 )
|
||||
tv = target.module.typedVar("g_structWithSignBits")
|
||||
self.assertEqual( 4, tv.m_bit0_4 )
|
||||
self.assertEqual( -1, tv.m_bit5 )
|
||||
self.assertEqual( -3, tv.m_bit6_8 )
|
||||
self.assertEqual( -1, tv.m_bit0_60 )
|
||||
|
||||
def testTypedVarList(self):
|
||||
tvl = target.module.typedVarList( target.module.g_listHead, "listStruct", "listEntry" )
|
||||
|
@ -147,7 +147,7 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
ti = target.module.type("unionTest")
|
||||
self.assertEqual( 0, ti.fieldOffset("m_doubleValue") )
|
||||
self.assertEqual( 0, ti.fieldOffset("m_bits") )
|
||||
self.assertEqual( ti.size(), ti.m_doubleValue.size() )
|
||||
self.assertEqual( 12, ti.size() )
|
||||
|
||||
def testAsMap(self):
|
||||
ti = target.module.type("enumType")
|
||||
|
@ -45,12 +45,14 @@ struct structWithBits {
|
||||
ULONG m_bit0_4 : 5;
|
||||
ULONG m_bit5 : 1;
|
||||
ULONG m_bit6_8 : 3;
|
||||
ULONG64 m_bit0_60 : 60;
|
||||
};
|
||||
|
||||
struct structWitSignBits {
|
||||
LONG m_bit0_4 : 5;
|
||||
LONG m_bit5 : 1;
|
||||
LONG m_bit6_8 : 3;
|
||||
LONG64 m_bit0_60 : 60;
|
||||
};
|
||||
|
||||
|
||||
@ -104,8 +106,8 @@ typedef struct structAbstract *pstructAbstract;
|
||||
|
||||
pstructAbstract g_structAbstract = 0;
|
||||
|
||||
structWithBits g_structWithBits = { 4, 1, 5};
|
||||
structWitSignBits g_structWithSignBits = { 4, 1, 5 };
|
||||
structWithBits g_structWithBits = { 4, 1, 5, 0xFF00000000 };
|
||||
structWitSignBits g_structWithSignBits = { 4, 1, 5, -1LL };
|
||||
|
||||
structTest g_structTest = { 0, 500, true, 1, NULL };
|
||||
structTest g_structTest1 = { 0, 500, true, 1, &g_structTest };
|
||||
|
Loading…
Reference in New Issue
Block a user