[+] added debug events defs

[~] addr64 conversion for module randge and get tread/process context

git-svn-id: https://pykd.svn.codeplex.com/svn@62774 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\EreTIk_cp 2011-03-17 09:04:28 +00:00
parent 7f2284ca99
commit 8e0ecc1733
4 changed files with 45 additions and 28 deletions

View File

@ -246,6 +246,21 @@ BOOST_PYTHON_MODULE( pykd )
// exception flags // exception flags
_DEF_PY_CONST(EXCEPTION_NONCONTINUABLE); _DEF_PY_CONST(EXCEPTION_NONCONTINUABLE);
// debug events
_DEF_PY_CONST(DEBUG_EVENT_BREAKPOINT);
_DEF_PY_CONST(DEBUG_EVENT_EXCEPTION);
_DEF_PY_CONST(DEBUG_EVENT_CREATE_THREAD);
_DEF_PY_CONST(DEBUG_EVENT_EXIT_THREAD);
_DEF_PY_CONST(DEBUG_EVENT_CREATE_PROCESS);
_DEF_PY_CONST(DEBUG_EVENT_EXIT_PROCESS);
_DEF_PY_CONST(DEBUG_EVENT_LOAD_MODULE);
_DEF_PY_CONST(DEBUG_EVENT_UNLOAD_MODULE);
_DEF_PY_CONST(DEBUG_EVENT_SYSTEM_ERROR);
_DEF_PY_CONST(DEBUG_EVENT_SESSION_STATUS);
_DEF_PY_CONST(DEBUG_EVENT_CHANGE_DEBUGGEE_STATE);
_DEF_PY_CONST(DEBUG_EVENT_CHANGE_ENGINE_STATE);
_DEF_PY_CONST(DEBUG_EVENT_CHANGE_SYMBOL_STATE);
} }
#undef _DEF_PY_CONST #undef _DEF_PY_CONST

View File

@ -108,8 +108,8 @@ findModule( ULONG64 addr )
dbgModuleClass::dbgModuleClass( const std::string &name, ULONG64 base, ULONG size ) : dbgModuleClass::dbgModuleClass( const std::string &name, ULONG64 base, ULONG size ) :
m_name( name ), m_name( name ),
m_base( base ), m_base( addr64(base) ),
m_end( base + size ) m_end( addr64(base) + size )
{ {
reloadSymbols(); reloadSymbols();
@ -130,7 +130,7 @@ dbgModuleClass::dbgModuleClass( const std::string &name, ULONG64 base, ULONG siz
sizeof( nameBuf ), sizeof( nameBuf ),
NULL, NULL,
&offset ); &offset );
if ( FAILED( hres ) ) if ( FAILED( hres ) )
break; break;

View File

@ -65,7 +65,7 @@ public:
{} {}
dbgModuleClass( const std::string &name, ULONG64 base, ULONG size ); dbgModuleClass( const std::string &name, ULONG64 base, ULONG size );
ULONG64 ULONG64
getBegin() const { getBegin() const {
return m_base; return m_base;

View File

@ -72,25 +72,26 @@ setImplicitThread(
HRESULT hres; HRESULT hres;
try { try {
newThreadAddr = addr64(newThreadAddr);
hres = dbgExt->system2->SetImplicitThreadDataOffset( newThreadAddr ); hres = dbgExt->system2->SetImplicitThreadDataOffset( newThreadAddr );
if ( FAILED( hres ) ) if ( FAILED( hres ) )
throw DbgException( "IDebugSystemObjects2::SetImplicitThreadDataOffset failed" ); throw DbgException( "IDebugSystemObjects2::SetImplicitThreadDataOffset failed" );
return true; return true;
} }
catch( std::exception &e ) catch( std::exception &e )
{ {
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() ); dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
} }
catch(...) catch(...)
{ {
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" ); dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
} }
return false; return false;
} }
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -292,22 +293,23 @@ VOID
setCurrentProcess( setCurrentProcess(
ULONG64 processAddr ) ULONG64 processAddr )
{ {
HRESULT hres; HRESULT hres;
try { try {
processAddr = addr64(processAddr);
hres = dbgExt->system2->SetImplicitProcessDataOffset( processAddr ); hres = dbgExt->system2->SetImplicitProcessDataOffset( processAddr );
if ( FAILED( hres ) ) if ( FAILED( hres ) )
throw DbgException( "IDebugSystemObjects2::SetImplicitProcessDataOffset failed" ); throw DbgException( "IDebugSystemObjects2::SetImplicitProcessDataOffset failed" );
} }
catch( std::exception &e ) catch( std::exception &e )
{ {
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() ); dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
} }
catch(...) catch(...)
{ {
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" ); dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
} }
} }
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////