Skip to content

Commit

Permalink
Print the current state after the target stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 committed Jun 19, 2023
1 parent 077654d commit 0676f00
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/adapters/dbgengadapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ bool DbgEngAdapter::ExecuteWithArgsInternal(const std::string& path, const std::

void DbgEngAdapter::EngineLoop()
{
auto settings = Settings::Instance();
bool outputStateOnStop = settings->Get<bool>("debugger.dbgEngOutputStateOnStop");

m_lastExecutionStatus = DEBUG_STATUS_NO_DEBUGGEE;
bool finished = false;
while (true)
Expand All @@ -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();
Expand Down
9 changes: 9 additions & 0 deletions core/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 0676f00

Please sign in to comment.