aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-24 16:17:27 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-12-02 14:11:25 +0000
commitc3f03bbff1db14dc5b5436d8aef834512207d498 (patch)
tree279d2fdf57c1155392c31ba31a6291c68cb8d71c /src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
parentec5a886d4b92a18669d5bbd01b43a57f7d81b856 (diff)
Support multiple QML engines in V4 debugger
Whenever the debugger is paused, there is exactly one engine that caused the debuggerPaused() slot to be called. We can only interact with that engine in any meaningful way. Of course you can shoot yourself in the foot with this tool. You can, for example, set a breakpoint that will be hit by multiple engines and then get confused about which engine just hit the breakpoint. Similar things are also possible with other kinds of debuggers, though. If this becomes a problem we can add an engine ID to the responses. Also, this does not fix the other debug services. So you might still not see the "correct" locals and expressions from the QQmlEngineDebugService while the debugger is not paused. Task-number: QTBUG-49615 Change-Id: Ie044f0aedb51481c4cf851635d7c12839251cbd0 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp')
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
index da43257b24..8bd9547032 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
@@ -44,22 +44,19 @@ QV4DebuggerAgent::QV4DebuggerAgent(QV4DebugServiceImpl *debugService)
: m_breakOnThrow(false), m_debugService(debugService)
{}
-QV4Debugger *QV4DebuggerAgent::firstDebugger() const
+QV4Debugger *QV4DebuggerAgent::pausedDebugger() const
{
- // Currently only 1 single engine is supported, so:
- if (m_debuggers.isEmpty())
- return 0;
- else
- return m_debuggers.first();
+ foreach (QV4Debugger *debugger, m_debuggers) {
+ if (debugger->state() == QV4Debugger::Paused)
+ return debugger;
+ }
+ return 0;
}
bool QV4DebuggerAgent::isRunning() const
{
- // Currently only 1 single engine is supported, so:
- if (QV4Debugger *debugger = firstDebugger())
- return debugger->state() == QV4Debugger::Running;
- else
- return false;
+ // "running" means none of the engines are paused.
+ return pausedDebugger() == 0;
}
void QV4DebuggerAgent::debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseReason reason)
@@ -221,4 +218,10 @@ void QV4DebuggerAgent::setBreakOnThrow(bool onoff)
}
}
+void QV4DebuggerAgent::clearAllPauseRequests()
+{
+ foreach (QV4Debugger *debugger, m_debuggers)
+ debugger->clearPauseRequest();
+}
+
QT_END_NAMESPACE