From 62baab28778e1ff46bcddc291bb71b632eaaed1e Mon Sep 17 00:00:00 2001 From: shygoo Date: Sun, 20 Jan 2019 17:38:34 -0600 Subject: [PATCH] [Debugger] JS: Make debug.breakhere stable --- Source/Project64/UserInterface/API.js | 3 +-- Source/Project64/UserInterface/Debugger/ScriptInstance.cpp | 6 ++++++ Source/Project64/UserInterface/Debugger/ScriptInstance.h | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Project64/UserInterface/API.js b/Source/Project64/UserInterface/API.js index 96b7af4502..9fea578db4 100644 --- a/Source/Project64/UserInterface/API.js +++ b/Source/Project64/UserInterface/API.js @@ -289,8 +289,7 @@ const debug = { }, breakhere: function() { - debug.showcommands(gpr.pc) - system.pause() + _native.breakHere() }, disasm: function() { diff --git a/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp b/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp index 9cb3116650..967f070739 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp +++ b/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp @@ -1470,6 +1470,12 @@ duk_ret_t CScriptInstance::js_ConsoleClear(duk_context* ctx) return 1; } +duk_ret_t CScriptInstance::js_BreakHere(duk_context* /*ctx*/) +{ + g_Settings->SaveBool(Debugger_SteppingOps, true); + return 1; +} + duk_ret_t CScriptInstance::js_Pause(duk_context* /*ctx*/) { g_System->Pause(); diff --git a/Source/Project64/UserInterface/Debugger/ScriptInstance.h b/Source/Project64/UserInterface/Debugger/ScriptInstance.h index afc926daa5..6c2294e3e0 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptInstance.h +++ b/Source/Project64/UserInterface/Debugger/ScriptInstance.h @@ -170,6 +170,7 @@ class CScriptInstance static duk_ret_t js_ConsolePrint(duk_context*); static duk_ret_t js_ConsoleClear(duk_context*); + static duk_ret_t js_BreakHere(duk_context*); static duk_ret_t js_Pause(duk_context*); // () ; pauses emulation static duk_ret_t js_ShowCommands(duk_context*); // ([address]) ; shows commands window @@ -227,6 +228,8 @@ class CScriptInstance { "pause", js_Pause, DUK_VARARGS }, { "showCommands", js_ShowCommands, DUK_VARARGS }, + { "breakHere", js_BreakHere, DUK_VARARGS }, + { "screenPrint", js_ScreenPrint, DUK_VARARGS }, { "fsOpen", js_FSOpen, DUK_VARARGS },