| 117 | } |
| 118 | |
| 119 | void ConsoleCommand::BreakpointHandler(ScriptFrame& frame, ScriptError *ex, const DebugInfo& di) |
| 120 | { |
| 121 | static std::mutex mutex; |
| 122 | std::unique_lock<std::mutex> lock(mutex); |
| 123 | |
| 124 | if (!Application::GetScriptDebuggerEnabled()) |
| 125 | return; |
| 126 | |
| 127 | if (ex && ex->IsHandledByDebugger()) |
| 128 | return; |
| 129 | |
| 130 | std::cout << "Breakpoint encountered.\n"; |
| 131 | |
| 132 | if (ex) { |
| 133 | std::cout << "Exception: " << DiagnosticInformation(*ex) << "\n"; |
| 134 | ex->SetHandledByDebugger(true); |
| 135 | } else |
| 136 | ShowCodeLocation(std::cout, di); |
| 137 | |
| 138 | std::cout << "You can inspect expressions (such as variables) by entering them at the prompt.\n" |
| 139 | << "To leave the debugger and continue the program use \"$continue\".\n" |
| 140 | << "For further commands see \"$help\".\n"; |
| 141 | |
| 142 | #ifdef HAVE_EDITLINE |
| 143 | rl_completion_entry_function = ConsoleCommand::ConsoleCompleteHelper; |
| 144 | rl_completion_append_character = '\0'; |
| 145 | #endif /* HAVE_EDITLINE */ |
| 146 | |
| 147 | ConsoleCommand::RunScriptConsole(frame); |
| 148 | } |
| 149 | |
| 150 | void ConsoleCommand::StaticInitialize() |
| 151 | { |
nothing calls this directly
no test coverage detected