diff --git a/pykd/pycpucontext.h b/pykd/pycpucontext.h index d3e9f75..48dc7c2 100644 --- a/pykd/pycpucontext.h +++ b/pykd/pycpucontext.h @@ -194,6 +194,16 @@ inline python::list getLocals() { return StackFrameAdapter::getLocalsList( getCurrentFrame() ); } +inline kdlib::MEMOFFSET_64 stackAlloc(unsigned short byteCount) { + AutoRestorePyState pystate; + return kdlib::stackAlloc(byteCount); +} + +inline kdlib::MEMOFFSET_64 stackFree(unsigned short byteCount) { + AutoRestorePyState pystate; + return kdlib::stackFree(byteCount); +} + class CPUContextAdapter { diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 463786d..f1e4d15 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -470,6 +470,10 @@ BOOST_PYTHON_MODULE( pykd ) "Get list of function arguments as list of tuple (name, value ) " ); python::def( "getParam", pykd::getParam, "Get the function argument by name" ); + python::def( "stackAlloc", pykd::stackAlloc, + "Allocate bytes of space in the stack in the target process" ); + python::def( "stackFree", pykd::stackFree, + "Free space in the stack previously allocated by stackAlloc" ); // breakpoints python::def( "setBp", &Breakpoint::setSoftwareBreakpoint,