From e66c64ea54bafaaa0fca446dfbb8d5055cd337cd Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Tue, 10 Apr 2012 16:48:51 +0000 Subject: [PATCH] [0.1.x] fixed : issue #10628 ( typedef is not supported ) git-svn-id: https://pykd.svn.codeplex.com/svn@75424 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/typeinfo.cpp | 3 +++ test/scripts/typeinfo.py | 4 ++++ test/targetapp/targetapp.cpp | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/pykd/typeinfo.cpp b/pykd/typeinfo.cpp index 3196af4..e413424 100644 --- a/pykd/typeinfo.cpp +++ b/pykd/typeinfo.cpp @@ -36,6 +36,9 @@ TypeInfoPtr TypeInfo::getTypeInfo( pyDia::SymbolPtr &typeSym ) case SymTagEnum: return TypeInfoPtr( new EnumTypeInfo( typeSym ) ); + + case SymTagTypedef: + return getTypeInfo( typeSym->getType() ); } throw TypeException( typeSym->getName(), "this type is not supported" ); diff --git a/test/scripts/typeinfo.py b/test/scripts/typeinfo.py index 15e62a8..9ca4712 100644 --- a/test/scripts/typeinfo.py +++ b/test/scripts/typeinfo.py @@ -175,3 +175,7 @@ class TypeInfoTest( unittest.TestCase ): self.assertTrue( str(target.module.type( "g_arrOfPtrToFunc" ) ) ) self.assertTrue( str(target.module.type( "g_unTypedPtrToFunction" ) ) ) + def testTypedef(self): + self.assertEqual( "structTest", pykd.typeInfo( "g_structTypeDef" ).name() ) + self.assertEqual( "structTest", pykd.typeInfo( "structTestTypeDef" ).name() ) + diff --git a/test/targetapp/targetapp.cpp b/test/targetapp/targetapp.cpp index 35cd8ad..a8eb5c6 100644 --- a/test/targetapp/targetapp.cpp +++ b/test/targetapp/targetapp.cpp @@ -240,6 +240,10 @@ WNDENUMPROC g_ptrToFunction; void *g_unTypedPtrToFunction = g_ptrToFunction; #pragma pack( pop ) +typedef struct structTest structTestTypeDef; + +structTestTypeDef g_structTypeDef = { 0 }; + //////////////////////////////////////////////////////////////////////////////// #define InitializeListHead(ListHead) (\ @@ -304,6 +308,8 @@ void FuncWithName0() std::cout << g_unNamedStruct.m_fieldNestedStruct; std::cout << g_structNested.m_nestedFiled; std::cout << g_unTypedPtrToFunction; + + std::cout << g_structTypeDef.m_field0; } ////////////////////////////////////////////////////////////////////////////////