mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 11:43:23 +08:00

[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
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
#include "stdafx.h"
|
|
#include "dbgengine.h"
|
|
#include "disasmengine.h"
|
|
#include "disasm.h"
|
|
#include "dbgexcept.h"
|
|
|
|
|
|
namespace pykd {
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
Disasm::Disasm( ULONG64 offset )
|
|
: m_ea(0)
|
|
{
|
|
m_beginOffset = addr64(offset);
|
|
|
|
if ( m_beginOffset == 0 )
|
|
m_beginOffset = getRegInstructionPointer();
|
|
|
|
m_currentOffset = m_beginOffset;
|
|
|
|
doDisasm();
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void Disasm::doDisasm()
|
|
{
|
|
ULONG64 endOffset = 0;
|
|
|
|
disasmDisassembly( m_currentOffset, m_disasm, endOffset, m_ea );
|
|
|
|
m_length = (ULONG)(endOffset - m_currentOffset);
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
std::string
|
|
Disasm::assembly( const std::string &instr )
|
|
{
|
|
ULONG64 endOffset = 0;
|
|
disasmAssemblay( m_currentOffset, instr, endOffset );
|
|
|
|
m_currentOffset = endOffset;
|
|
|
|
doDisasm();
|
|
|
|
return m_disasm;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
ULONG64 Disasm::getNearInstruction( LONG delta ) {
|
|
return pykd::getNearInstruction( m_currentOffset, delta );
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}; // end pykd namespace
|