From c45f44d85635a1d16a93c00cd8cb17f60dfa6336 Mon Sep 17 00:00:00 2001 From: Blazej Floch Date: Sun, 11 Feb 2018 06:08:37 -0500 Subject: Local debugger fixes and extensions - Adds q/quit option to console debugging - Adds options (variable_prefix) - Breaks into debugger with Ctrl-C in local debug mode (Unix/Windows) - Added option to list all breakpoints - Fixes add/remove breakpoint bug (invalid path parsing) - Minor cleanup --- platform/windows/os_windows.cpp | 19 +++++++++++++++++++ platform/windows/os_windows.h | 1 + 2 files changed, 20 insertions(+) (limited to 'platform/windows') diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index bed5781ae4..7b46608c55 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -152,6 +152,25 @@ void RedirectIOToConsole() { // point to console as well } +BOOL WINAPI HandlerRoutine(_In_ DWORD dwCtrlType) { + if (ScriptDebugger::get_singleton() == NULL) + return FALSE; + + switch (dwCtrlType) { + case CTRL_C_EVENT: + ScriptDebugger::get_singleton()->set_depth(-1); + ScriptDebugger::get_singleton()->set_lines_left(1); + return TRUE; + default: + return FALSE; + } +} + +void OS_Windows::initialize_debugging() { + + SetConsoleCtrlHandler(HandlerRoutine, TRUE); +} + void OS_Windows::initialize_core() { crash_handler.initialize(); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 3d13627bfa..584f6fb334 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -294,6 +294,7 @@ public: void disable_crash_handler(); bool is_disable_crash_handler() const; + virtual void initialize_debugging(); void force_process_input(); -- cgit v1.2.3