mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.2.x] fix: Hresult as ULong
git-svn-id: https://pykd.svn.codeplex.com/svn@85177 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
1f45804a5b
commit
ab92133f28
@ -149,7 +149,10 @@ BaseTypeVariant BasicTypedVar::getValue()
|
|||||||
|
|
||||||
if ( m_typeInfo->getName() == "Bool" )
|
if ( m_typeInfo->getName() == "Bool" )
|
||||||
return *(bool*)&val;
|
return *(bool*)&val;
|
||||||
|
|
||||||
|
if ( m_typeInfo->getName() == "Hresult" )
|
||||||
|
return *(PULONG)&val;
|
||||||
|
|
||||||
throw DbgException( "failed get value " );
|
throw DbgException( "failed get value " );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ TypeInfoPtr TypeInfo::getTypeInfo( SymbolPtr &symScope, const std::string &symN
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static const boost::regex baseMatch("^(Char)|(WChar)|(Int1B)|(UInt1B)|(Int2B)|(UInt2B)|(Int4B)|(UInt4B)|(Int8B)|(UInt8B)|(Long)|(ULong)|(Float)|(Bool)|(Double)$" );
|
static const boost::regex baseMatch("^(Char)|(WChar)|(Int1B)|(UInt1B)|(Int2B)|(UInt2B)|(Int4B)|(UInt4B)|(Int8B)|(UInt8B)|(Long)|(ULong)|(Float)|(Bool)|(Double)|(Hresult)$" );
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TypeInfo::isBaseType( const std::string &symName )
|
TypeInfo::isBaseType( const std::string &symName )
|
||||||
@ -313,6 +313,9 @@ TypeInfo::getBaseTypeInfo( const std::string &symName, ULONG pointerSize )
|
|||||||
|
|
||||||
if ( baseMatchResult[15].matched )
|
if ( baseMatchResult[15].matched )
|
||||||
return TypeInfoPtr( new TypeInfoWrapper<double>("Double", pointerSize) );
|
return TypeInfoPtr( new TypeInfoWrapper<double>("Double", pointerSize) );
|
||||||
|
|
||||||
|
if ( baseMatchResult[16].matched )
|
||||||
|
return TypeInfoPtr( new TypeInfoWrapper<unsigned long>("Hresult", pointerSize) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TypeInfoPtr();
|
return TypeInfoPtr();
|
||||||
|
@ -323,3 +323,7 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
self.assertRaises( pykd.BaseException, pykd.typedVarList, target.module.g_listHead1, None, "next" )
|
self.assertRaises( pykd.BaseException, pykd.typedVarList, target.module.g_listHead1, None, "next" )
|
||||||
self.assertRaises( pykd.BaseException, pykd.typedVarArray, target.module.g_testArray, None, 2 )
|
self.assertRaises( pykd.BaseException, pykd.typedVarArray, target.module.g_testArray, None, 2 )
|
||||||
self.assertRaises( pykd.BaseException, pykd.containingRecord, target.module.offset( "g_structTest" ), None, "m_field2" )
|
self.assertRaises( pykd.BaseException, pykd.containingRecord, target.module.offset( "g_structTest" ), None, "m_field2" )
|
||||||
|
|
||||||
|
def testHresult(self):
|
||||||
|
tv = pykd.typedVar( "g_atlException" )
|
||||||
|
self.assertEqual( tv.m_hr, 0x8000FFFF )
|
||||||
|
@ -192,7 +192,7 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
self.assertTrue( str(target.module.type( "g_voidPtr" ) ) )
|
self.assertTrue( str(target.module.type( "g_voidPtr" ) ) )
|
||||||
self.assertTrue( str(target.module.type( "g_arrOfPtrToFunc" ) ) )
|
self.assertTrue( str(target.module.type( "g_arrOfPtrToFunc" ) ) )
|
||||||
self.assertTrue( str(target.module.type( "g_unTypedPtrToFunction" ) ) )
|
self.assertTrue( str(target.module.type( "g_unTypedPtrToFunction" ) ) )
|
||||||
|
|
||||||
def testTypedef(self):
|
def testTypedef(self):
|
||||||
self.assertEqual( "structTest", pykd.typeInfo( "g_structTypeDef" ).name() )
|
self.assertEqual( "structTest", pykd.typeInfo( "g_structTypeDef" ).name() )
|
||||||
self.assertEqual( "structTest", pykd.typeInfo( "structTestTypeDef" ).name() )
|
self.assertEqual( "structTest", pykd.typeInfo( "structTestTypeDef" ).name() )
|
||||||
@ -213,21 +213,20 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
self.assertEqual( 5, len(ti) )
|
self.assertEqual( 5, len(ti) )
|
||||||
for field in ti:
|
for field in ti:
|
||||||
str( field )
|
str( field )
|
||||||
|
|
||||||
def testStructNullSize(self):
|
def testStructNullSize(self):
|
||||||
ti = target.module.type("structNullSize")
|
ti = target.module.type("structNullSize")
|
||||||
self.assertEqual( 0, len(ti) )
|
self.assertEqual( 0, len(ti) )
|
||||||
|
|
||||||
def testDerefName(self):
|
def testDerefName(self):
|
||||||
entry = pykd.typedVar("entry1").Flink
|
entry = pykd.typedVar("entry1").Flink
|
||||||
self.assertEqual( "_LIST_ENTRY*", entry.type().name() )
|
self.assertEqual( "_LIST_ENTRY*", entry.type().name() )
|
||||||
|
|
||||||
def testPtrTo(self):
|
def testPtrTo(self):
|
||||||
ti = pykd.typeInfo("UInt8B").ptrTo()
|
ti = pykd.typeInfo("UInt8B").ptrTo()
|
||||||
self.assertTrue( "UInt8B*", ti.name() )
|
self.assertTrue( "UInt8B*", ti.name() )
|
||||||
self.assertNotEqual( 0, ti.size() )
|
self.assertNotEqual( 0, ti.size() )
|
||||||
|
|
||||||
def testArrayOf(self):
|
def testArrayOf(self):
|
||||||
ti = pykd.typeInfo("UInt8B").arrayOf(10)
|
ti = pykd.typeInfo("UInt8B").arrayOf(10)
|
||||||
self.assertTrue( "UInt8B[10]", ti.name() )
|
self.assertTrue( "UInt8B[10]", ti.name() )
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
|
#include <atlexcept.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ struct struct3 {
|
|||||||
struct3 g_struct3 = { { 0, 2 }, 3 };
|
struct3 g_struct3 = { { 0, 2 }, 3 };
|
||||||
|
|
||||||
__int64 g_bigValue = 0x8080808080808080;
|
__int64 g_bigValue = 0x8080808080808080;
|
||||||
|
volatile ATL::CAtlException g_atlException(E_UNEXPECTED);
|
||||||
|
|
||||||
static LIST_ENTRY g_listHead;
|
static LIST_ENTRY g_listHead;
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ void FuncWithName0()
|
|||||||
std::cout << g_charValue;
|
std::cout << g_charValue;
|
||||||
std::cout << g_shortValue;
|
std::cout << g_shortValue;
|
||||||
std::cout << g_longValue;
|
std::cout << g_longValue;
|
||||||
std::cout << g_longlongValue;
|
std::cout << g_longlongValue << g_atlException.m_hr;
|
||||||
|
|
||||||
std::cout << g_structTest.m_field0;
|
std::cout << g_structTest.m_field0;
|
||||||
std::cout << g_testArray[1].m_field3;
|
std::cout << g_testArray[1].m_field3;
|
||||||
|
Loading…
Reference in New Issue
Block a user