[pykd] added: debuggerPath routine ( Return full path to the process image that uses pykd )

git-svn-id: https://pykd.svn.codeplex.com/svn@70089 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2011-09-28 07:45:52 +00:00
parent 4dc9bba048
commit a7855ea4d1
5 changed files with 27 additions and 9 deletions

View File

@ -221,6 +221,8 @@ BOOST_PYTHON_MODULE( pykd )
"Delete synthetic symbols by virtual address" ); "Delete synthetic symbols by virtual address" );
boost::python::def( "delSynSymbolsMask", &delSyntheticSymbolsMask, boost::python::def( "delSynSymbolsMask", &delSyntheticSymbolsMask,
"Delete synthetic symbols by mask of module and symbol name"); "Delete synthetic symbols by mask of module and symbol name");
boost::python::def( "debuggerPath", &getDebuggerImage,
"Return full path to the process image that uses pykd" );
boost::python::class_<TypeInfo>( "typeInfo", boost::python::class_<TypeInfo>( "typeInfo",
"Class representing non-primitive type info: structure, union, etc. attributes is a fields of non-primitive type" ) "Class representing non-primitive type info: structure, union, etc. attributes is a fields of non-primitive type" )
@ -253,7 +255,7 @@ BOOST_PYTHON_MODULE( pykd )
DEF_PY_GLOBAL( "ulong_t", TypeInfo("", "unsigned long") ); DEF_PY_GLOBAL( "ulong_t", TypeInfo("", "unsigned long") );
DEF_PY_GLOBAL( "int_t", TypeInfo("", "int") ); DEF_PY_GLOBAL( "int_t", TypeInfo("", "int") );
DEF_PY_GLOBAL( "uint_t", TypeInfo("", "unsigned int") ); DEF_PY_GLOBAL( "uint_t", TypeInfo("", "unsigned int") );
DEF_PY_GLOBAL( "ptr_t", TypeInfo("", "void*") ); //DEF_PY_GLOBAL( "ptr_t", TypeInfo("", "void*") );
DEF_PY_GLOBAL( "double_t", TypeInfo("", "double") ); DEF_PY_GLOBAL( "double_t", TypeInfo("", "double") );
DEF_PY_GLOBAL( "longlong_t", TypeInfo("", "int64") ); DEF_PY_GLOBAL( "longlong_t", TypeInfo("", "int64") );
DEF_PY_GLOBAL( "ulonglong_t", TypeInfo("", "unsigned int64") ); DEF_PY_GLOBAL( "ulonglong_t", TypeInfo("", "unsigned int64") );

View File

@ -1,5 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include <psapi.h>
#include "dbgext.h" #include "dbgext.h"
#include "dbgexcept.h" #include "dbgexcept.h"
#include "dbgsystem.h" #include "dbgsystem.h"
@ -124,3 +126,13 @@ isDumpAnalyzing()
} }
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
std::string
getDebuggerImage()
{
std::vector<char> buffer(MAX_PATH);
GetModuleFileNameExA( GetCurrentProcess(), NULL, &buffer[0], buffer.size() );
return std::string( &buffer[0] );
}
///////////////////////////////////////////////////////////////////////////////////

View File

@ -28,4 +28,8 @@ isKernelDebugging();
bool bool
isDumpAnalyzing(); isDumpAnalyzing();
std::string
getDebuggerImage();
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////

View File

@ -66,7 +66,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dbgeng.lib " AdditionalDependencies="dbgeng.lib dbghelp.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;"
@ -151,7 +151,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dbgeng.lib dbghelp.lib" AdditionalDependencies="dbgeng.lib dbghelp.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;"
@ -230,7 +230,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dbgeng.lib" AdditionalDependencies="dbgeng.lib dbghelp.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;"
@ -311,7 +311,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dbgeng.lib dbghelp.lib" AdditionalDependencies="dbgeng.lib dbghelp.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;"

View File

@ -70,7 +70,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dbgeng.lib " AdditionalDependencies="dbgeng.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;"
@ -151,7 +151,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dbgeng.lib" AdditionalDependencies="dbgeng.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;"
@ -227,7 +227,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/pdbpath:none" AdditionalOptions="/pdbpath:none"
AdditionalDependencies="dbgeng.lib" AdditionalDependencies="dbgeng.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\i386&quot;;&quot;$(PYTHON_ROOT)\x86\libs&quot;;&quot;$(BOOST_ROOT)\stage\lib&quot;"
@ -306,7 +306,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/pdbpath:none" AdditionalOptions="/pdbpath:none"
AdditionalDependencies="dbgeng.lib" AdditionalDependencies="dbgeng.lib psapi.lib"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;" AdditionalLibraryDirectories="&quot;$(DBG_SDK_ROOT)\lib\amd64&quot;;&quot;$(PYTHON_ROOT)\x64\libs&quot;;&quot;$(BOOST_ROOT)\stage64\lib&quot;"