From c2a15c276965f9697ab7b3619802154d832663ed Mon Sep 17 00:00:00 2001 From: "SND\\ussrhero_cp" Date: Tue, 13 Sep 2016 19:39:55 +0000 Subject: [PATCH] [0.3.x] added : stackAlloc routine ( allocate bytes of space in the stack in the target process ) [0.3.x] added : stackFree routine ( free space in the stack previously allocated by stackAlloc ) git-svn-id: https://pykd.svn.codeplex.com/svn@91043 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pycpucontext.h | 10 ++++++++++ pykd/pymod.cpp | 4 ++++ 2 files changed, 14 insertions(+) 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,