Dont break if there's no debuggers attached.

This commit is contained in:
Deukhoofd 2021-10-03 13:31:56 +02:00
parent 0094a5937f
commit a2d8293c04
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 6 additions and 1 deletions

View File

@ -5,7 +5,6 @@
#include "DebugAdapterProtocol/Requests.hpp" #include "DebugAdapterProtocol/Requests.hpp"
void AngelscriptDebugger::Run(uint16_t port) { void AngelscriptDebugger::Run(uint16_t port) {
// Listen on port 9012
_server = new asio::ip::tcp::acceptor(_ioContext, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), port)); _server = new asio::ip::tcp::acceptor(_ioContext, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), port));
std::thread([this]() { AcceptLoop(); }).detach(); std::thread([this]() { AcceptLoop(); }).detach();
} }
@ -32,6 +31,9 @@ void AngelscriptDebugger::on_line_callback(asIScriptContext* ctx, AngelscriptDeb
if (ctx->GetState() == asEXECUTION_SUSPENDED) { if (ctx->GetState() == asEXECUTION_SUSPENDED) {
return; return;
} }
if (!d->HasDebuggerAttached()) {
return;
}
const char* scriptSection = nullptr; const char* scriptSection = nullptr;
int column = 0; int column = 0;
int line = ctx->GetLineNumber(0, &column, &scriptSection); int line = ctx->GetLineNumber(0, &column, &scriptSection);
@ -56,6 +58,9 @@ size_t GetBreakpointHash(const std::string& section, size_t line) {
} }
void AngelscriptDebugger::on_exception_callback(asIScriptContext* ctx, AngelscriptDebugger* d) { void AngelscriptDebugger::on_exception_callback(asIScriptContext* ctx, AngelscriptDebugger* d) {
if (!d->HasDebuggerAttached()) {
return;
}
ctx->Suspend(); ctx->Suspend();
d->_pausedContexts.push_back(ctx); d->_pausedContexts.push_back(ctx);