From 0676f008f7e0c6bb2d7d0528506c358b9482ef9e Mon Sep 17 00:00:00 2001 From: Xusheng Date: Fri, 2 Jun 2023 17:25:25 +0800 Subject: [PATCH] Print the current state after the target stopped --- core/adapters/dbgengadapter.cpp | 8 ++++++++ core/debugger.cpp | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/core/adapters/dbgengadapter.cpp b/core/adapters/dbgengadapter.cpp index b4ac7741..df668fe7 100644 --- a/core/adapters/dbgengadapter.cpp +++ b/core/adapters/dbgengadapter.cpp @@ -456,6 +456,9 @@ bool DbgEngAdapter::ExecuteWithArgsInternal(const std::string& path, const std:: void DbgEngAdapter::EngineLoop() { + auto settings = Settings::Instance(); + bool outputStateOnStop = settings->Get("debugger.dbgEngOutputStateOnStop"); + m_lastExecutionStatus = DEBUG_STATUS_NO_DEBUGGEE; bool finished = false; while (true) @@ -474,6 +477,11 @@ void DbgEngAdapter::EngineLoop() { if (m_lastExecutionStatus != DEBUG_STATUS_BREAK) { + if (outputStateOnStop) + { + // m_debugRegisters->OutputRegisters(DEBUG_OUTCTL_THIS_CLIENT, DEBUG_REGISTERS_DEFAULT); + m_debugControl->OutputCurrentState(DEBUG_OUTCTL_THIS_CLIENT, DEBUG_CURRENT_DEFAULT); + } DebuggerEvent event; event.type = AdapterStoppedEventType; event.data.targetStoppedData.reason = StopReason(); diff --git a/core/debugger.cpp b/core/debugger.cpp index d7c20e96..24028be4 100644 --- a/core/debugger.cpp +++ b/core/debugger.cpp @@ -122,6 +122,15 @@ static void RegisterSettings() "description" : "Asks the user to confirm the operation when the target is launched for the first time.", "ignore" : ["SettingsProjectScope", "SettingsResourceScope"] })"); + + settings->RegisterSetting("debugger.dbgEngOutputStateOnStop", + R"({ + "title" : "Output current state when the DbgEng engine stops", + "type" : "boolean", + "default" : true, + "description" : "Output the current state (e.g., register values, next instruction) in the debugger console when the target stops.", + "ignore" : ["SettingsProjectScope", "SettingsResourceScope"] + })"); } extern "C"