Commit 2ee4363d authored by hjk's avatar hjk
Browse files

Debugger: Force LLDB round trip between stack and locals update



The stack might produce data (such as as the QML context in
native mixed debugging) that is needed for locals display.
While this doesn't work yet with LLDB anyway, the change
suppresses one soft access when accessing the top frame of
an empty stack (the usual case on the first update).

Change-Id: If931fbe940b8cda01cc6cc34429a2fcb33cd8d19
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 37bd3eab
...@@ -871,6 +871,11 @@ class Dumper(DumperBase): ...@@ -871,6 +871,11 @@ class Dumper(DumperBase):
result += ',limit="%d"' % limit result += ',limit="%d"' % limit
result += '}' result += '}'
self.report(result) self.report(result)
self.reportContinuation(args)
def reportContinuation(self, args):
if "continuation" in args:
self.report('continuation=\"%s\"' % args["continuation"])
def reportStackPosition(self): def reportStackPosition(self):
thread = self.currentThread() thread = self.currentThread()
......
...@@ -460,6 +460,8 @@ void LldbEngine::handleResponse(const QByteArray &response) ...@@ -460,6 +460,8 @@ void LldbEngine::handleResponse(const QByteArray &response)
refreshMemory(item); refreshMemory(item);
else if (name == "full-backtrace") else if (name == "full-backtrace")
showFullBacktrace(item); showFullBacktrace(item);
else if (name == "continuation")
handleContinuation(item);
else if (name == "statusmessage") { else if (name == "statusmessage") {
QString msg = QString::fromUtf8(item.data()); QString msg = QString::fromUtf8(item.data());
if (msg.size()) if (msg.size())
...@@ -469,6 +471,15 @@ void LldbEngine::handleResponse(const QByteArray &response) ...@@ -469,6 +471,15 @@ void LldbEngine::handleResponse(const QByteArray &response)
} }
} }
void LldbEngine::handleContinuation(const GdbMi &data)
{
if (data.data() == "updateLocals") {
updateLocals();
return;
}
QTC_ASSERT(false, qDebug() << "Unknown continuation: " << data.data());
}
void LldbEngine::showFullBacktrace(const GdbMi &data) void LldbEngine::showFullBacktrace(const GdbMi &data)
{ {
Internal::openTextEditor(_("Backtrace $"), Internal::openTextEditor(_("Backtrace $"),
...@@ -524,10 +535,10 @@ void LldbEngine::activateFrame(int frameIndex) ...@@ -524,10 +535,10 @@ void LldbEngine::activateFrame(int frameIndex)
DebuggerCommand cmd("activateFrame"); DebuggerCommand cmd("activateFrame");
cmd.arg("index", frameIndex); cmd.arg("index", frameIndex);
cmd.arg("thread", threadsHandler()->currentThread().raw()); cmd.arg("thread", threadsHandler()->currentThread().raw());
cmd.arg("continuation", "updateLocals");
runCommand(cmd); runCommand(cmd);
reloadRegisters(); reloadRegisters();
updateLocals();
} }
void LldbEngine::selectThread(ThreadId threadId) void LldbEngine::selectThread(ThreadId threadId)
...@@ -793,23 +804,19 @@ bool LldbEngine::setToolTipExpression(TextEditor::TextEditorWidget *editorWidget ...@@ -793,23 +804,19 @@ bool LldbEngine::setToolTipExpression(TextEditor::TextEditorWidget *editorWidget
void LldbEngine::updateAll() void LldbEngine::updateAll()
{ {
reloadRegisters(); reloadRegisters();
updateStack();
updateLocals();
}
void LldbEngine::reloadFullStack()
{
DebuggerCommand cmd("reportStack"); DebuggerCommand cmd("reportStack");
cmd.arg("nativeMixed", isNativeMixedActive()); cmd.arg("nativeMixed", isNativeMixedActive());
cmd.arg("stacklimit", -1); cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt());
cmd.arg("continuation", "updateLocals");
runCommand(cmd); runCommand(cmd);
} }
void LldbEngine::updateStack() void LldbEngine::reloadFullStack()
{ {
DebuggerCommand cmd("reportStack"); DebuggerCommand cmd("reportStack");
cmd.arg("nativeMixed", isNativeMixedActive()); cmd.arg("nativeMixed", isNativeMixedActive());
cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt()); cmd.arg("stacklimit", -1);
runCommand(cmd); runCommand(cmd);
} }
......
...@@ -132,16 +132,17 @@ private: ...@@ -132,16 +132,17 @@ private:
QString errorMessage(QProcess::ProcessError error) const; QString errorMessage(QProcess::ProcessError error) const;
bool hasCapability(unsigned cap) const; bool hasCapability(unsigned cap) const;
Q_SLOT void handleLldbFinished(int, QProcess::ExitStatus status); void handleLldbFinished(int, QProcess::ExitStatus status);
Q_SLOT void handleLldbError(QProcess::ProcessError error); void handleLldbError(QProcess::ProcessError error);
Q_SLOT void readLldbStandardOutput(); void readLldbStandardOutput();
Q_SLOT void readLldbStandardError(); void readLldbStandardError();
Q_SLOT void handleResponse(const QByteArray &data); void handleResponse(const QByteArray &data);
Q_SLOT void updateAll(); void updateAll();
Q_SLOT void updateStack(); void updateLocals();
Q_SLOT void updateLocals(); void createFullBacktrace();
Q_SLOT void createFullBacktrace();
void doUpdateLocals(UpdateParameters params); void doUpdateLocals(UpdateParameters params);
void handleContinuation(const GdbMi &data);
void refreshAll(const GdbMi &all); void refreshAll(const GdbMi &all);
void refreshThreads(const GdbMi &threads); void refreshThreads(const GdbMi &threads);
void refreshStack(const GdbMi &stack); void refreshStack(const GdbMi &stack);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment