[0.1.x] added : getPdbFile routine

git-svn-id: https://pykd.svn.codeplex.com/svn@72299 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2011-12-13 14:49:11 +00:00 committed by Mikhail I. Izmestev
parent ef857b33d8
commit e44a8c41f1
4 changed files with 44 additions and 0 deletions

View File

@ -285,6 +285,39 @@ ULONG64 getOffset( const std::wstring symbolname )
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
std::string DebugClient::getPdbFile( ULONG64 moduleBase )
{
HRESULT hres;
IMAGEHLP_MODULEW64 imageHelpInfo = { 0 };
hres =
m_advanced->GetSymbolInformation(
DEBUG_SYMINFO_IMAGEHLP_MODULEW64,
moduleBase,
0,
&imageHelpInfo,
sizeof( imageHelpInfo ),
NULL,
NULL,
0,
NULL );
if ( FAILED( hres ) )
throw DbgException( "IDebugAdvanced2::GetSymbolInformation failed" );
char fileName[ 256 ];
WideCharToMultiByte( CP_ACP, 0, imageHelpInfo.LoadedPdbName, 256, fileName, 256, NULL, NULL );
return std::string( fileName );
}
std::string getPdbFile( ULONG64 moduleBase )
{
return g_dbgClient->getPdbFile( moduleBase );
}
///////////////////////////////////////////////////////////////////////////////////
void DebugClient::setExecutionStatus( ULONG status ) void DebugClient::setExecutionStatus( ULONG status )
{ {
HRESULT hres; HRESULT hres;

View File

@ -95,6 +95,8 @@ public:
ULONG64 getOffset( const std::wstring symbolname ); ULONG64 getOffset( const std::wstring symbolname );
std::string getPdbFile( ULONG64 moduleBase );
template<ULONG status> template<ULONG status>
void changeDebuggerStatus(); void changeDebuggerStatus();
@ -271,6 +273,8 @@ ULONG getExecutionStatus();
ULONG64 getOffset( const std::wstring symbolname ); ULONG64 getOffset( const std::wstring symbolname );
std::string getPdbFile( ULONG64 moduleBase );
bool is64bitSystem(); bool is64bitSystem();
bool isKernelDebugging(); bool isKernelDebugging();

View File

@ -164,6 +164,8 @@ BOOST_PYTHON_MODULE( pykd )
"Return information about the execution status of the debugger" ) "Return information about the execution status of the debugger" )
.def( "getOffset", &DebugClient::getOffset, .def( "getOffset", &DebugClient::getOffset,
"Return traget virtual address for specified symbol" ) "Return traget virtual address for specified symbol" )
.def( "getPdbFile", &DebugClient::getPdbFile,
"Return full path to PDB (Program DataBase, debug information) file" )
.def( "go", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_GO>, .def( "go", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_GO>,
"Change debugger status to DEBUG_STATUS_GO" ) "Change debugger status to DEBUG_STATUS_GO" )
.def( "is64bitSystem", &DebugClient::is64bitSystem, .def( "is64bitSystem", &DebugClient::is64bitSystem,
@ -287,6 +289,8 @@ BOOST_PYTHON_MODULE( pykd )
"Return information about the execution status of the debugger" ); "Return information about the execution status of the debugger" );
python::def( "getOffset", &getOffset, python::def( "getOffset", &getOffset,
"Return traget virtual address for specified symbol" ); "Return traget virtual address for specified symbol" );
python::def( "getPdbFile", &getPdbFile,
"Return full path to PDB (Program DataBase, debug information) file" );
python::def( "go", &changeDebuggerStatus<DEBUG_STATUS_GO>, python::def( "go", &changeDebuggerStatus<DEBUG_STATUS_GO>,
"Change debugger status to DEBUG_STATUS_GO" ); "Change debugger status to DEBUG_STATUS_GO" );
python::def( "is64bitSystem", &is64bitSystem, python::def( "is64bitSystem", &is64bitSystem,

View File

@ -22,6 +22,9 @@ class DbgClientTest( unittest.TestCase ):
pykd.waitForEvent() pykd.waitForEvent()
self.assertEqual( pykd.DEBUG_STATUS_BREAK, pykd.getExecutionStatus() ) self.assertEqual( pykd.DEBUG_STATUS_BREAK, pykd.getExecutionStatus() )
def testPdbFile( self ):
self.assertNotEqual( '', target.module )