From f0ef6ed929e3a3e4a75639796dfb79d88956702f Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Sun, 5 Apr 2015 05:32:26 +0200 Subject: [PATCH] template function for simpler callbacks --- GleeBug/Debugger.Thread.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/GleeBug/Debugger.Thread.h b/GleeBug/Debugger.Thread.h index cfc6a76..7243595 100644 --- a/GleeBug/Debugger.Thread.h +++ b/GleeBug/Debugger.Thread.h @@ -46,9 +46,32 @@ namespace GleeBug */ bool RegWriteContext(); + /** + \brief Step into. + */ + void StepInto(); + + /** + \brief Step into. + \param cbStep StepCallback. Can be written using BIND(this, MyDebugger::cb). + */ void StepInto(StepCallback cbStep); - void StepInto(); + /** + \brief Step into. + \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 StepInto(T* debugger, void(T::*callback)()) + { + static_cast(static_cast(debugger)); + StepInto(std::bind([](void (T::*callback)(), T* debugger) + { + (debugger->*callback)(); + }, callback, debugger)); + } private: CONTEXT _oldContext;