diff --git a/GleeBug/Debugger.Process.cpp b/GleeBug/Debugger.Process.cpp index 4afcb62..aecaf82 100644 --- a/GleeBug/Debugger.Process.cpp +++ b/GleeBug/Debugger.Process.cpp @@ -13,4 +13,23 @@ namespace GleeBug for (int i = 0; i < HWBP_COUNT; i++) hardwareBreakpoints[i].enabled = false; } + + void Process::StepOver(const StepCallback & cbStep) + { + auto gip = thread->registers.Gip(); + unsigned char data[16]; + if (MemReadSafe(gip, data, sizeof(data))) + { + mCapstone.Disassemble(gip, data); + if(mCapstone.GetId() == X86_INS_CALL) + { + SetBreakpoint(gip + mCapstone.Size(), [cbStep](const BreakpointInfo & info) + { + cbStep(); + }, true, SoftwareType::ShortInt3); + return; + } + } + thread->StepInto(cbStep); + } }; \ No newline at end of file diff --git a/GleeBug/Debugger.Process.h b/GleeBug/Debugger.Process.h index 2bf69f3..9881bc2 100644 --- a/GleeBug/Debugger.Process.h +++ b/GleeBug/Debugger.Process.h @@ -6,6 +6,7 @@ #include "Debugger.Dll.h" #include "Debugger.Breakpoint.h" #include "Static.Pattern.h" +#include namespace GleeBug { @@ -305,6 +306,28 @@ namespace GleeBug \return true if the breakpoint was deleted, false otherwise. */ bool DeleteGenericBreakpoint(const BreakpointInfo & info); + + /** + \brief Step over. + \param cbStep Step callback. Can be written using BIND(this, MyDebugger::cb). + */ + void StepOver(const StepCallback & cbStep); + + /** + \brief Step over. + \tparam T Generic type parameter. Must be a subclass of Debugger. + \param debugger This pointer to a subclass of Debugger. + \param callback Pointer to the callback. Written like: &MyDebugger::cb + */ + template + void StepOver(T* debugger, void(T::*callback)()) + { + static_cast(static_cast(debugger)); + StepOver(std::bind(callback, debugger)); + } + + private: + Capstone mCapstone; }; }; diff --git a/MyDebugger/MyDebugger.vcxproj b/MyDebugger/MyDebugger.vcxproj index 280b0a7..f8d5704 100644 --- a/MyDebugger/MyDebugger.vcxproj +++ b/MyDebugger/MyDebugger.vcxproj @@ -26,26 +26,26 @@ Application true - v120 + v120_xp MultiByte Application true - v120 + v120_xp MultiByte Application false - v120 + v120_xp true MultiByte Application false - v120 + v120_xp true MultiByte diff --git a/TitanEngineEmulator/Emulator.h b/TitanEngineEmulator/Emulator.h index 33e4490..7c0c54d 100644 --- a/TitanEngineEmulator/Emulator.h +++ b/TitanEngineEmulator/Emulator.h @@ -175,8 +175,9 @@ public: //Stepping void StepOver(LPVOID CallBack) { - //TODO - StepInto(CallBack); + if (!mProcess || !CallBack) + return; + mProcess->StepOver(STEPCALLBACK(CallBack)); } void SingleStep(DWORD StepCount, LPVOID CallBack) diff --git a/TitanEngineEmulator/TitanEngineEmulator.vcxproj b/TitanEngineEmulator/TitanEngineEmulator.vcxproj index c968016..aa7c507 100644 --- a/TitanEngineEmulator/TitanEngineEmulator.vcxproj +++ b/TitanEngineEmulator/TitanEngineEmulator.vcxproj @@ -26,26 +26,26 @@ DynamicLibrary true - v120 + v120_xp MultiByte DynamicLibrary true - v120 + v120_xp MultiByte DynamicLibrary false - v120 + v120_xp true MultiByte DynamicLibrary false - v120 + v120_xp true MultiByte diff --git a/capstone_wrapper b/capstone_wrapper index dc48a11..5a37f7c 160000 --- a/capstone_wrapper +++ b/capstone_wrapper @@ -1 +1 @@ -Subproject commit dc48a11d3fb8f476c9f4d7639984a74e8a9d9336 +Subproject commit 5a37f7cfaf4a1b1050890c244348fa6f7cfd109b