summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/cdb
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-08-15 17:28:00 +0200
committerhjk <hjk@qt.io>2018-08-21 07:25:57 +0000
commit9f9c72302f60a872d15c5dd1ffa900961dad9014 (patch)
treecd7f1819198eefcd03637e14688dea1deba32e11 /src/plugins/debugger/cdb
parent7dcfe86c34c18985b13717234369e2fe181dc089 (diff)
downloadqt-creator-9f9c72302f60a872d15c5dd1ffa900961dad9014.tar.gz
Debugger: Streamline ThreadHandler
- Use the TreeItem/data pattern recently introduced with Breakpoints to remove the need of keeping track of id/object mapping. Opens possibility to have thread groups as intermediate level. - Use the ThreadHandler directly as model for the thread combobox to remove the need of manual combo box updates. - Move setting current thread from individual engines to central code. Change-Id: I030e21a4aa5ab30b0efbc84528d9cecf29cbbe30 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/debugger/cdb')
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp17
-rw-r--r--src/plugins/debugger/cdb/cdbengine.h2
2 files changed, 7 insertions, 12 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index b3623f4286..05708c6ca4 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -1239,14 +1239,9 @@ void CdbEngine::updateAll()
updateLocals();
}
-void CdbEngine::selectThread(ThreadId threadId)
+void CdbEngine::selectThread(const Thread &thread)
{
- if (!threadId.isValid() || threadId == threadsHandler()->currentThread())
- return;
-
- threadsHandler()->setCurrentThread(threadId);
-
- runCommand({'~' + QString::number(threadId.raw()) + " s", BuiltinCommand,
+ runCommand({'~' + thread->id() + " s", BuiltinCommand,
[this](const DebuggerResponse &) { reloadFullStack(); }});
}
@@ -1809,7 +1804,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
// Further examine stop and report to user
QString message;
QString exceptionBoxMessage;
- ThreadId forcedThreadId;
+ Thread forcedThread;
const unsigned stopFlags = examineStopReason(stopReason, &message, &exceptionBoxMessage,
conditionalBreakPointTriggered);
m_stopMode = NoStopRequested;
@@ -1847,7 +1842,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
if (stopFlags & StopInArtificialThread) {
showMessage(tr("Switching to main thread..."), LogMisc);
runCommand({"~0 s", NoFlags});
- forcedThreadId = ThreadId(0);
+ forcedThread = Thread();
// Re-fetch stack again.
reloadFullStack();
} else {
@@ -1872,8 +1867,8 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
const GdbMi threads = stopReason["threads"];
if (threads.isValid()) {
threadsHandler()->updateThreads(threads);
- if (forcedThreadId.isValid())
- threadsHandler()->setCurrentThread(forcedThreadId);
+ if (forcedThread)
+ threadsHandler()->setCurrentThread(forcedThread);
} else {
showMessage(stopReason["threaderror"].data(), LogError);
}
diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h
index cfc822c658..e5b617eb43 100644
--- a/src/plugins/debugger/cdb/cdbengine.h
+++ b/src/plugins/debugger/cdb/cdbengine.h
@@ -80,7 +80,7 @@ public:
void executeDebuggerCommand(const QString &command) override;
void activateFrame(int index) override;
- void selectThread(ThreadId threadId) override;
+ void selectThread(const Thread &thread) override;
bool stateAcceptsBreakpointChanges() const override;
bool acceptsBreakpoint(const BreakpointParameters &params) const override;