2011-10-26 14:54:15 +08:00
|
|
|
#pragma once
|
|
|
|
|
2011-10-26 15:10:44 +08:00
|
|
|
#include "dbgobj.h"
|
|
|
|
|
|
|
|
namespace pykd {
|
2011-10-26 14:54:15 +08:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-10-26 15:10:44 +08:00
|
|
|
class Disasm : private DbgObject {
|
2011-10-26 14:54:15 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2011-10-26 15:10:44 +08:00
|
|
|
Disasm( IDebugClient4 *client, ULONG64 offset = 0 );
|
|
|
|
|
|
|
|
Disasm( ULONG64 offset = 0);
|
2011-10-26 14:54:15 +08:00
|
|
|
|
|
|
|
std::string disassemble() {
|
|
|
|
std::string s = m_disasm;
|
|
|
|
m_currentOffset += m_length;
|
|
|
|
doDisasm();
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2012-05-30 17:39:53 +08:00
|
|
|
std::string jump(ULONG64 offset) {
|
|
|
|
m_currentOffset = offset;
|
|
|
|
doDisasm();
|
|
|
|
return disassemble();
|
|
|
|
}
|
2011-10-26 14:54:15 +08:00
|
|
|
|
2012-05-30 17:39:53 +08:00
|
|
|
std::string reset() {
|
2011-10-26 14:54:15 +08:00
|
|
|
m_currentOffset = m_beginOffset;
|
|
|
|
doDisasm();
|
2012-05-30 17:39:53 +08:00
|
|
|
return disassemble();
|
2011-10-26 14:54:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string
|
|
|
|
assembly( const std::string &instr );
|
|
|
|
|
|
|
|
std::string instruction() const {
|
|
|
|
return m_disasm;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG64 begin() const {
|
|
|
|
return m_beginOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG64 current() const {
|
|
|
|
return m_currentOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG length() const {
|
|
|
|
return m_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
ULONG64 ea() const {
|
|
|
|
return m_ea;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void doDisasm();
|
|
|
|
|
|
|
|
ULONG64 m_beginOffset;
|
|
|
|
ULONG64 m_currentOffset;
|
|
|
|
ULONG64 m_ea;
|
|
|
|
ULONG m_length;
|
|
|
|
|
|
|
|
std::string m_disasm;
|
|
|
|
};
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2011-10-26 15:10:44 +08:00
|
|
|
|
|
|
|
} ; // end pykd namespace
|
|
|
|
|