diff --git a/pykd/dbgext.cpp b/pykd/dbgext.cpp index 26befd6..7ab0a0d 100644 --- a/pykd/dbgext.cpp +++ b/pykd/dbgext.cpp @@ -221,7 +221,7 @@ BOOST_PYTHON_MODULE( pykd ) "Delete synthetic symbols by virtual address" ); boost::python::def( "delSynSymbolsMask", &delSyntheticSymbolsMask, "Delete synthetic symbols by mask of module and symbol name"); - + boost::python::def( "assembly", &assembly, "Assemble a single processor instruction" ); boost::python::class_( "typeInfo", "Class representing non-primitive type info: structure, union, etc. attributes is a fields of non-primitive type" ) diff --git a/pykd/disasm.cpp b/pykd/disasm.cpp index b2b3b5f..52498fb 100644 --- a/pykd/disasm.cpp +++ b/pykd/disasm.cpp @@ -46,4 +46,19 @@ void disasm::doDisasm() m_disasm = std::string( buffer, disasmSize - 2); } +///////////////////////////////////////////////////////////////////////////////// + +ULONG64 +assembly( ULONG64 offset, const std::string &instr ) +{ + HRESULT hres; + + ULONG64 endOffset = 0; + hres = dbgExt->control->Assemble( offset, instr.c_str(), &endOffset ); + if ( FAILED( hres ) ) + throw DbgException( "IDebugControl::Assemble failed" ); + + return endOffset; +} + ///////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/pykd/disasm.h b/pykd/disasm.h index 95ba472..890e672 100644 --- a/pykd/disasm.h +++ b/pykd/disasm.h @@ -51,4 +51,7 @@ private: std::string m_disasm; }; +ULONG64 +assembly( ULONG64 offset, const std::string &instr ); + /////////////////////////////////////////////////////////////////////////////////