mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.2.x] added : disasm::findOffset method ( Return the location of a processor instruction relative to a given location )
[0.2.x] added : disasm::jump method ( Change the current instruction ) [0.2.x] added : disasm::jumprel method ( Change the current instruction ) git-svn-id: https://pykd.svn.codeplex.com/svn@82501 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
78f733fb2d
commit
f5ee8b9a9a
@ -50,4 +50,10 @@ Disasm::assembly( const std::string &instr )
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ULONG64 Disasm::getNearInstruction( LONG delta ) {
|
||||
return pykd::getNearInstruction( m_currentOffset, delta );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}; // end pykd namespace
|
||||
|
@ -23,6 +23,14 @@ public:
|
||||
return disassemble();
|
||||
}
|
||||
|
||||
std::string jumprel(LONG delta) {
|
||||
m_currentOffset = getNearInstruction(delta);
|
||||
doDisasm();
|
||||
return disassemble();
|
||||
}
|
||||
|
||||
ULONG64 getNearInstruction( LONG delta );
|
||||
|
||||
std::string reset() {
|
||||
m_currentOffset = m_beginOffset;
|
||||
doDisasm();
|
||||
|
@ -4,5 +4,6 @@ namespace pykd {
|
||||
|
||||
void disasmAssemblay( ULONG64 offset, const std::string &instruction, ULONG64 &nextOffset );
|
||||
void disasmDisassembly( ULONG64 offset, std::string &instruction, ULONG64 &nextOffset, ULONG64 &ea );
|
||||
ULONG64 getNearInstruction( ULONG64 offset, LONG delta );
|
||||
|
||||
} // end pykd namespace
|
@ -563,7 +563,11 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
.def( "length", &Disasm::length, "Return current instruction length" )
|
||||
.def( "instruction", &Disasm::instruction, "Returm current disassembled instruction" )
|
||||
.def( "ea", &Disasm::ea, "Return effective address for last disassembled instruction or 0" )
|
||||
.def( "reset", &Disasm::reset, "Reset current offset to begin" );
|
||||
.def( "reset", &Disasm::reset, "Reset current offset to begin" )
|
||||
.def( "findOffset", &Disasm::getNearInstruction, "Return the location of a processor instruction relative to a given location" )
|
||||
.def( "jump", &Disasm::jump, "Change current instruction" )
|
||||
.def( "jumprel", &Disasm::jumprel, "Change current instruction" );
|
||||
|
||||
|
||||
python::enum_<DEBUG_CALLBACK_RESULT>("eventResult", "Return value of event handler")
|
||||
.value("Proceed", DebugCallbackProceed)
|
||||
|
@ -49,4 +49,20 @@ void disasmDisassembly( ULONG64 offset, std::string &instruction, ULONG64 &nextO
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ULONG64 getNearInstruction( ULONG64 offset, LONG delta )
|
||||
{
|
||||
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||
|
||||
HRESULT hres;
|
||||
ULONG64 nearOffset;
|
||||
|
||||
hres = g_dbgEng->control->GetNearInstruction( offset, delta, &nearOffset );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::GetNearInstruction", hres );
|
||||
|
||||
return nearOffset;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
} // end pykd namespace
|
||||
|
Loading…
Reference in New Issue
Block a user