mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 21:03:23 +08:00
[0.3.2] added : getTypeFromSource ( create typeInfo class from C/C++ source code )
[0.3.2] added : getTypeInfoProviderFromSource ( create typeInfo provider from C/C++ source code ) git-svn-id: https://pykd.svn.codeplex.com/svn@91182 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
2049c751a0
commit
307abc3405
@ -108,8 +108,8 @@ Global
|
||||
{D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_3.5|x64.ActiveCfg = Release|Any CPU
|
||||
{D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_3.6|Win32.ActiveCfg = Release|Any CPU
|
||||
{D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_3.6|x64.ActiveCfg = Release|Any CPU
|
||||
{3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.ActiveCfg = Debug_Static|Win32
|
||||
{3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.Build.0 = Debug_Static|Win32
|
||||
{3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.ActiveCfg = Debug|Win32
|
||||
{3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.Build.0 = Debug|Win32
|
||||
{3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.ActiveCfg = Debug|x64
|
||||
{3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.Build.0 = Debug|x64
|
||||
{3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_3.5|Win32.ActiveCfg = Debug|Win32
|
||||
|
@ -9,4 +9,6 @@
|
||||
<package id="Python27" version="2.7.6" targetFramework="Native" />
|
||||
<package id="Python35" version="3.5.1.1" targetFramework="Native" />
|
||||
<package id="Python36" version="3.6.0" targetFramework="Native" />
|
||||
<package id="clang-cmake" version="3.9.0.1" targetFramework="Native" />
|
||||
<package id="llvm-cmake" version="3.9.0.1" targetFramework="Native" />
|
||||
</packages>
|
||||
|
@ -65,6 +65,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>2.7</PythonVersion>
|
||||
<LLVM_USE_CRT_DEBUG>MDd</LLVM_USE_CRT_DEBUG>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_3.5|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -72,6 +73,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.5</PythonVersion>
|
||||
<LLVM_USE_CRT_DEBUG>MDd</LLVM_USE_CRT_DEBUG>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_3.6|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -79,6 +81,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.6</PythonVersion>
|
||||
<LLVM_USE_CRT_DEBUG>MDd</LLVM_USE_CRT_DEBUG>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -86,6 +89,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>2.7</PythonVersion>
|
||||
<LLVM_USE_CRT_DEBUG>MDd</LLVM_USE_CRT_DEBUG>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_3.5|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -93,6 +97,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.5</PythonVersion>
|
||||
<LLVM_USE_CRT_DEBUG>MDd</LLVM_USE_CRT_DEBUG>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_3.6|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -100,6 +105,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.6</PythonVersion>
|
||||
<LLVM_USE_CRT_DEBUG>MDd</LLVM_USE_CRT_DEBUG>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -108,6 +114,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>2.7</PythonVersion>
|
||||
<LLVM_USE_CRT_RELEASE>MT</LLVM_USE_CRT_RELEASE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.5|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -116,6 +123,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.5</PythonVersion>
|
||||
<LLVM_USE_CRT_RELEASE>MT</LLVM_USE_CRT_RELEASE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.6|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -124,6 +132,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.6</PythonVersion>
|
||||
<LLVM_USE_CRT_RELEASE>MT</LLVM_USE_CRT_RELEASE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -132,6 +141,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>2.7</PythonVersion>
|
||||
<LLVM_USE_CRT_RELEASE>MT</LLVM_USE_CRT_RELEASE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.5|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -140,6 +150,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.5</PythonVersion>
|
||||
<LLVM_USE_CRT_RELEASE>MT</LLVM_USE_CRT_RELEASE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.6|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@ -148,6 +159,7 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PythonVersion>3.6</PythonVersion>
|
||||
<LLVM_USE_CRT_RELEASE>MT</LLVM_USE_CRT_RELEASE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release_3.5|x64'">
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
@ -201,7 +213,7 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<NuGetPackageImportStamp>67fda795</NuGetPackageImportStamp>
|
||||
<NuGetPackageImportStamp>bb9fbdf7</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
@ -300,7 +312,7 @@
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PYKD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\kdlibcpp\include;</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -654,6 +666,8 @@
|
||||
<Import Project="..\packages\boost_system.1.57.0.0\build\native\boost_system.targets" Condition="Exists('..\packages\boost_system.1.57.0.0\build\native\boost_system.targets')" />
|
||||
<Import Project="..\packages\boost_date_time.1.57.0.0\build\native\boost_date_time.targets" Condition="Exists('..\packages\boost_date_time.1.57.0.0\build\native\boost_date_time.targets')" />
|
||||
<Import Project="..\packages\boost_chrono.1.57.0.0\build\native\boost_chrono.targets" Condition="Exists('..\packages\boost_chrono.1.57.0.0\build\native\boost_chrono.targets')" />
|
||||
<Import Project="..\packages\llvm-cmake.3.9.0.1\build\native\llvm-cmake.targets" Condition="Exists('..\packages\llvm-cmake.3.9.0.1\build\native\llvm-cmake.targets')" />
|
||||
<Import Project="..\packages\clang-cmake.3.9.0.1\build\native\clang-cmake.targets" Condition="Exists('..\packages\clang-cmake.3.9.0.1\build\native\clang-cmake.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
@ -669,5 +683,7 @@
|
||||
<Error Condition="!Exists('..\packages\boost_date_time.1.57.0.0\build\native\boost_date_time.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_date_time.1.57.0.0\build\native\boost_date_time.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\boost_chrono.1.57.0.0\build\native\boost_chrono.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_chrono.1.57.0.0\build\native\boost_chrono.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Python36.3.6.0\build\python36.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Python36.3.6.0\build\python36.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\llvm-cmake.3.9.0.1\build\native\llvm-cmake.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\llvm-cmake.3.9.0.1\build\native\llvm-cmake.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\clang-cmake.3.9.0.1\build\native\clang-cmake.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\clang-cmake.3.9.0.1\build\native\clang-cmake.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
@ -1,8 +1,8 @@
|
||||
|
||||
#define PYKD_VERSION_MAJOR 0
|
||||
#define PYKD_VERSION_MINOR 3
|
||||
#define PYKD_VERSION_SUBVERSION 1
|
||||
#define PYKD_VERSION_BUILDNO 10
|
||||
#define PYKD_VERSION_SUBVERSION 2
|
||||
#define PYKD_VERSION_BUILDNO 0
|
||||
|
||||
#define __VER_STR2__(x) #x
|
||||
#define __VER_STR1__(x) __VER_STR2__(x)
|
||||
|
@ -100,6 +100,8 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( Module_enumTypes, ModuleAdapter::enumTypes, 1,
|
||||
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( TypeInfo_ptrTo, TypeInfoAdapter::ptrTo, 1, 2 );
|
||||
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( getTypeFromSource_, pykd::getTypeFromSource, 2, 3 );
|
||||
|
||||
|
||||
namespace pykd {
|
||||
|
||||
@ -416,6 +418,11 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
python::def( "callFunctionByPtr", python::raw_function(pykd::callFunctionByVar, 1) );
|
||||
python::def( "callFunctionByAddr", python::raw_function(pykd::callFunctionByOffset, 2) );
|
||||
|
||||
python::def( "getTypeFromSource", &pykd::getTypeFromSource, getTypeFromSource_( python::args("sourceCode", "typeName", "compileOptions"),
|
||||
"Create typeInfo class from C/C++ source code") );
|
||||
python::def( "getTypeInfoProviderFromSource", &pykd::getTypeInfoProviderFromSource,
|
||||
"Create typeInfo provider from C/C++ source code");
|
||||
|
||||
// CPU registers
|
||||
python::def( "reg", pykd::getRegisterByName,
|
||||
"Return a CPU regsiter value by the register's name" );
|
||||
@ -1160,6 +1167,11 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Change the current instruction" )
|
||||
.def( "__str__", DisasmAdapter::instruction );
|
||||
|
||||
python::class_<kdlib::TypeInfoProvider, kdlib::TypeInfoProviderPtr, boost::noncopyable>("typeInfoProvider",
|
||||
"Get abstaract access to different type info sources", python::no_init)
|
||||
.def( "getTypeByName", TypeInfoProviderAdapter::getTypeByName,
|
||||
"Get type info by it's name" )
|
||||
;
|
||||
|
||||
python::enum_<kdlib::DebugCallbackResult>("eventResult", "Return value of event handler")
|
||||
.value("Proceed", kdlib::DebugCallbackProceed)
|
||||
|
@ -55,6 +55,18 @@ inline kdlib::TypeInfoPtr getTypeInfoByName( const std::wstring &name )
|
||||
return kdlib::loadType( name );
|
||||
}
|
||||
|
||||
inline kdlib::TypeInfoPtr getTypeFromSource( const std::wstring& sourceCode, const std::wstring& typeName, const std::wstring& compileOptions=L"")
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return kdlib::compileType( sourceCode, typeName, compileOptions);
|
||||
}
|
||||
|
||||
inline kdlib::TypeInfoProviderPtr getTypeInfoProviderFromSource(const std::wstring& sourceCode, const std::wstring& compileOptions=L"")
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return kdlib::getTypeInfoProviderFromSource(sourceCode, compileOptions);
|
||||
}
|
||||
|
||||
struct TypeInfoAdapter : public kdlib::TypeInfo {
|
||||
|
||||
static std::wstring getName( kdlib::TypeInfo &typeInfo )
|
||||
@ -286,6 +298,17 @@ struct TypeInfoAdapter : public kdlib::TypeInfo {
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct TypeInfoProviderAdapter : public kdlib::TypeInfoProvider
|
||||
{
|
||||
|
||||
static kdlib::TypeInfoPtr getTypeByName( kdlib::TypeInfoProvider &typeInfoProvider, const std::wstring& name)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return typeInfoProvider.getTypeByName(name);
|
||||
}
|
||||
};
|
||||
|
||||
struct BaseTypesEnum {
|
||||
static kdlib::TypeInfoPtr getUInt1B() { return pykd::getTypeInfoByName(L"UInt1B"); }
|
||||
static kdlib::TypeInfoPtr getUInt2B() { return pykd::getTypeInfoByName(L"UInt2B"); }
|
||||
|
@ -8,7 +8,7 @@ import sys
|
||||
|
||||
_name = "pykd"
|
||||
_desc = "python windbg extension"
|
||||
_version = '0.3.1.8'
|
||||
_version = '0.3.2.0'
|
||||
|
||||
def getReleaseSrc():
|
||||
return 'Release_%d.%d' % sys.version_info[0:2]
|
||||
|
Loading…
Reference in New Issue
Block a user