Skip to content

Commit b3fef6c

Browse files
committed
Fix crash when the debugger events are opened before starting debugging
1 parent fb56b60 commit b3fef6c

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

core/debuggercontroller.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,7 +2874,7 @@ std::vector<TTDMemoryEvent> DebuggerController::GetTTDMemoryAccessForAddress(uin
28742874
{
28752875
std::vector<TTDMemoryEvent> events;
28762876

2877-
if (!IsTTD())
2877+
if (!m_state->IsConnected() || !IsTTD())
28782878
{
28792879
LogError("Current adapter does not support TTD");
28802880
return events;
@@ -2892,9 +2892,9 @@ std::vector<TTDCallEvent> DebuggerController::GetTTDCallsForSymbols(const std::s
28922892
{
28932893
std::vector<TTDCallEvent> events;
28942894

2895-
if (!IsTTD())
2895+
if (!m_state->IsConnected() || !IsTTD())
28962896
{
2897-
LogError("Current adapter does not support TTD");
2897+
LogWarn("Current adapter does not support TTD");
28982898
return events;
28992899
}
29002900

@@ -2906,9 +2906,9 @@ std::vector<TTDEvent> DebuggerController::GetTTDEvents(TTDEventType eventType)
29062906
{
29072907
std::vector<TTDEvent> events;
29082908

2909-
if (!IsTTD())
2909+
if (!m_state->IsConnected() || !IsTTD())
29102910
{
2911-
LogError("Current adapter does not support TTD");
2911+
LogWarn("Current adapter does not support TTD");
29122912
return events;
29132913
}
29142914

@@ -2920,9 +2920,9 @@ std::vector<TTDEvent> DebuggerController::GetAllTTDEvents()
29202920
{
29212921
std::vector<TTDEvent> events;
29222922

2923-
if (!IsTTD())
2923+
if (!m_state->IsConnected() || !IsTTD())
29242924
{
2925-
LogError("Current adapter does not support TTD");
2925+
LogWarn("Current adapter does not support TTD");
29262926
return events;
29272927
}
29282928

@@ -2934,9 +2934,9 @@ TTDPosition DebuggerController::GetCurrentTTDPosition()
29342934
{
29352935
TTDPosition position;
29362936

2937-
if (!IsTTD())
2937+
if (!m_state->IsConnected() || !IsTTD())
29382938
{
2939-
LogError("Current adapter does not support TTD");
2939+
LogWarn("Current adapter does not support TTD");
29402940
return position;
29412941
}
29422942

@@ -2950,9 +2950,9 @@ TTDPosition DebuggerController::GetCurrentTTDPosition()
29502950

29512951
bool DebuggerController::SetTTDPosition(const TTDPosition& position)
29522952
{
2953-
if (!IsTTD())
2953+
if (!m_state->IsConnected() || !IsTTD())
29542954
{
2955-
LogError("Current adapter does not support TTD");
2955+
LogWarn("Current adapter does not support TTD");
29562956
return false;
29572957
}
29582958

@@ -2967,7 +2967,7 @@ bool DebuggerController::SetTTDPosition(const TTDPosition& position)
29672967

29682968
bool DebuggerController::IsInstructionExecuted(uint64_t address)
29692969
{
2970-
if (!IsTTD())
2970+
if (!m_state->IsConnected() || !IsTTD())
29712971
{
29722972
return false;
29732973
}
@@ -2983,9 +2983,9 @@ bool DebuggerController::IsInstructionExecuted(uint64_t address)
29832983

29842984
bool DebuggerController::RunCodeCoverageAnalysis(uint64_t startAddress, uint64_t endAddress)
29852985
{
2986-
if (!IsTTD())
2986+
if (!m_state->IsConnected() || !IsTTD())
29872987
{
2988-
LogError("Current adapter does not support TTD");
2988+
LogWarn("Current adapter does not support TTD");
29892989
return false;
29902990
}
29912991

ui/ttdeventswidget.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,18 @@ void TTDEventsQueryWidget::performQuery()
368368
return;
369369
}
370370

371+
if (!m_controller->IsConnected())
372+
{
373+
updateStatus("No active debugging session.");
374+
return;
375+
}
376+
377+
if (!m_controller->IsTTD())
378+
{
379+
updateStatus("No a TTD debugging session.");
380+
return;
381+
}
382+
371383
updateStatus("Querying all TTD events...");
372384

373385
// Only disable button if it exists (AllEvents widgets have buttons, specialized don't)

0 commit comments

Comments
 (0)