WINTERMUTE: Add post instruction hook to DebuggableScript

This commit is contained in:
Tobia Tesan 2016-02-28 20:56:53 +01:00
parent 19267e0c5e
commit 06021d1aab

View File

@ -21,8 +21,11 @@
*/
#include "debuggable_script.h"
#include "debuggable_script_engine.h"
#include "engines/wintermute/base/scriptables/debuggable/debuggable_script_engine.h"
#include "engines/wintermute/base/scriptables/script_stack.h"
#include "engines/wintermute/base/scriptables/script_value.h"
#include "engines/wintermute/debugger/breakpoint.h"
#include "engines/wintermute/debugger/script_monitor.h"
namespace Wintermute {
@ -32,7 +35,17 @@ DebuggableScript::~DebuggableScript() {}
void DebuggableScript::preInstHook(uint32 inst) {}
void DebuggableScript::postInstHook(uint32 inst) {}
void DebuggableScript::postInstHook(uint32 inst) {
if (inst == II_DBG_LINE) {
for (uint j = 0; j < _engine->_breakpoints.size(); j++) {
_engine->_breakpoints[j]->evaluate(this);
}
if (_callStack->_sP <= _stepDepth) {
_engine->_monitor->notifyStep(this);
}
}
}
void DebuggableScript::setStepDepth(int depth) {
_stepDepth = depth;