Commit 939e5e3b authored by hjk's avatar hjk

Debugger: Fix stack display on interrupt with LLDB

Recent regression, stack data was only pulled when hitting
a breakpoint, not on interrupt.

Change-Id: I3de29fceadd4c5492f4edaffca7577dae7ae3d11
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent db9558cb
......@@ -782,7 +782,8 @@ class Dumper(DumperBase):
return thread
return None
def reportThreads(self):
def reportThreads(self, args):
self.reportToken(args)
result = 'threads={threads=['
for i in xrange(0, self.process.GetNumThreads()):
thread = self.process.GetThreadAtIndex(i)
......@@ -810,9 +811,13 @@ class Dumper(DumperBase):
result += ',file="%s"' % fileName(frame.line_entry.file)
result += '}},'
result += '],current-thread-id="%s"},' % self.currentThread().id
result += ']},'
self.report(result)
def reportCurrentThread(self, args):
self.reportToken(args)
self.report('current-thread={id="%s"}' % self.currentThread().id)
def firstUsableFrame(self, thread):
for i in xrange(10):
frame = thread.GetFrameAtIndex(i)
......@@ -1210,7 +1215,6 @@ class Dumper(DumperBase):
else:
state = self.process.GetState()
if state == lldb.eStateStopped:
self.reportThreads()
self.reportVariables()
def reportRegisters(self, _ = None):
......@@ -1329,7 +1333,6 @@ class Dumper(DumperBase):
stoppedThread = self.firstStoppedThread()
if stoppedThread:
self.process.SetSelectedThread(stoppedThread)
self.reportThreads()
elif eventType == lldb.SBProcess.eBroadcastBitInterrupt: # 2
pass
elif eventType == lldb.SBProcess.eBroadcastBitSTDOUT:
......
......@@ -456,6 +456,8 @@ void LldbEngine::handleResponse(const QByteArray &response)
refreshRegisters(item);
else if (name == "threads")
refreshThreads(item);
else if (name == "current-thread")
refreshCurrentThread(item);
else if (name == "typeinfo")
refreshTypeInfo(item);
else if (name == "state")
......@@ -567,10 +569,15 @@ void LldbEngine::activateFrame(int frameIndex)
void LldbEngine::selectThread(ThreadId threadId)
{
DebuggerCommand cmd("selectThread");
cmd.arg("id", threadId.raw());
DebuggerCommand cmd1("selectThread");
cmd1.arg("id", threadId.raw());
runCommand(cmd1);
DebuggerCommand cmd("reportStack");
cmd.arg("nativeMixed", isNativeMixedActive());
cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt());
cmd.arg("continuation", "updateLocals");
runCommand(cmd);
updateAll();
}
bool LldbEngine::stateAcceptsBreakpointChanges() const
......@@ -823,6 +830,12 @@ bool LldbEngine::setToolTipExpression(const DebuggerToolTipContext &context)
void LldbEngine::updateAll()
{
DebuggerCommand cmd1("reportThreads");
runCommand(cmd1);
DebuggerCommand cmd2("reportCurrentThread");
runCommand(cmd2);
DebuggerCommand cmd("reportStack");
cmd.arg("nativeMixed", isNativeMixedActive());
cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt());
......@@ -1061,11 +1074,14 @@ void LldbEngine::refreshThreads(const GdbMi &threads)
{
ThreadsHandler *handler = threadsHandler();
handler->updateThreads(threads);
if (!handler->currentThread().isValid()) {
ThreadId other = handler->threadAt(0);
if (other.isValid())
selectThread(other);
}
updateViews(); // Adjust Threads combobox.
}
void LldbEngine::refreshCurrentThread(const GdbMi &data)
{
ThreadsHandler *handler = threadsHandler();
ThreadId id(data["id"].toInt());
handler->setCurrentThread(id);
updateViews(); // Adjust Threads combobox.
}
......@@ -1102,9 +1118,10 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
} else {
updateAll();
}
} else if (newState == "inferiorstopok")
} else if (newState == "inferiorstopok") {
notifyInferiorStopOk();
else if (newState == "inferiorstopfailed")
updateAll();
} else if (newState == "inferiorstopfailed")
notifyInferiorStopFailed();
else if (newState == "inferiorill")
notifyInferiorIll();
......
......@@ -148,6 +148,7 @@ private:
void refreshAll(const GdbMi &all);
void refreshThreads(const GdbMi &threads);
void refreshCurrentThread(const GdbMi &data);
void refreshStack(const GdbMi &stack);
void refreshRegisters(const GdbMi &registers);
void refreshLocals(const GdbMi &vars);
......
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