mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[+] added: loadLinkedList routine
[+] added: getPdbFile routine [+] added: reloadSymbols git-svn-id: https://pykd.svn.codeplex.com/svn@54138 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
f5286ff2e8
commit
d2e5dacb50
@ -86,7 +86,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
boost::python::def( "loadSignQWords", &loadArray<__int64> );
|
||||
boost::python::def( "loadPtrs", &loadPtrArray );
|
||||
boost::python::def( "loadUnicodeString", &loadUnicodeStr );
|
||||
boost::python::def( "loadAnsiString", &loadAnsiStr );
|
||||
boost::python::def( "loadAnsiString", &loadAnsiStr );
|
||||
boost::python::def( "loadLinkedList", &loadLinkedList );
|
||||
boost::python::def( "ptrByte", &loadByPtr<unsigned char> );
|
||||
boost::python::def( "ptrSignByte", &loadByPtr<char> );
|
||||
boost::python::def( "ptrWord", &loadByPtr<unsigned short> );
|
||||
@ -98,6 +99,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
boost::python::def( "ptrPtr", &loadPtrByPtr );
|
||||
boost::python::def( "compareMemory", &compareMemory );
|
||||
boost::python::def( "getStack", &getStack );
|
||||
boost::python::def( "reloadSymbols", &reloadSymbols );
|
||||
boost::python::def( "getPdbFile", &getPdbFile );
|
||||
boost::python::class_<typedVarClass>( "typedVarClass" )
|
||||
.def("getAddress", &typedVarClass::getAddress );
|
||||
boost::python::class_<dbgModuleClass>( "dbgModuleClass" )
|
||||
@ -163,6 +166,7 @@ SetupDebugEngine( IDebugClient4 *client, DbgExt *dbgExt )
|
||||
|
||||
client->QueryInterface( __uuidof(IDebugDataSpaces), (void **)&dbgExt->dataSpaces );
|
||||
|
||||
client->QueryInterface( __uuidof(IDebugAdvanced2), (void **)&dbgExt->advanced2 );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <dbgeng.h>
|
||||
#include <dbghelp.h>
|
||||
|
||||
struct DbgExt {
|
||||
|
||||
@ -16,6 +17,8 @@ struct DbgExt {
|
||||
IDebugSymbols3 *symbols3;
|
||||
|
||||
IDebugDataSpaces *dataSpaces;
|
||||
|
||||
IDebugAdvanced2 *advanced2;
|
||||
};
|
||||
|
||||
extern DbgExt *dbgExt;
|
||||
|
@ -296,4 +296,19 @@ loadAnsiStr( ULONG64 address )
|
||||
return boost::python::object( "" );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
boost::python::object
|
||||
loadLinkedList( ULONG64 address )
|
||||
{
|
||||
ULONG64 entryAddress = 0;
|
||||
|
||||
boost::python::list objList;
|
||||
|
||||
for( entryAddress = loadPtrByPtr( address ); entryAddress != address; entryAddress = loadPtrByPtr( entryAddress ) )
|
||||
objList.append( entryAddress );
|
||||
|
||||
return objList;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
@ -65,4 +65,7 @@ compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length );
|
||||
ULONG64
|
||||
addr64( ULONG64 addr );
|
||||
|
||||
boost::python::object
|
||||
loadLinkedList( ULONG64 address );
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
@ -70,3 +70,73 @@ dbgSymPath()
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string
|
||||
getPdbFile( ULONG64 moduleBase )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
IMAGEHLP_MODULEW64 imageHelpInfo = { 0 };
|
||||
|
||||
hres =
|
||||
dbgExt->advanced2->GetSymbolInformation(
|
||||
DEBUG_SYMINFO_IMAGEHLP_MODULEW64,
|
||||
moduleBase,
|
||||
0,
|
||||
&imageHelpInfo,
|
||||
sizeof( imageHelpInfo ),
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
NULL );
|
||||
|
||||
char fileName[ 256 ];
|
||||
WideCharToMultiByte( CP_ACP, 0, imageHelpInfo.LoadedPdbName, 256, fileName, 256, NULL, NULL );
|
||||
|
||||
return std::string( fileName );
|
||||
|
||||
}
|
||||
catch( std::exception &e )
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
reloadSymbols( const char * moduleName )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
try {
|
||||
|
||||
std::string reloadParam( "/f " );
|
||||
reloadParam += moduleName;
|
||||
|
||||
hres = dbgExt->symbols->Reload( reloadParam.c_str() );
|
||||
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugSymbol::Reload failed" );
|
||||
}
|
||||
catch( std::exception &e )
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -16,5 +16,13 @@ ptrSize() {
|
||||
std::string
|
||||
dbgSymPath();
|
||||
|
||||
std::string
|
||||
getPdbFile( ULONG64 moduleBase );
|
||||
|
||||
std::string
|
||||
getImageFile( ULONG64 moduleBase );
|
||||
|
||||
void
|
||||
reloadSymbols( const char * moduleName );
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
Loading…
Reference in New Issue
Block a user