Debugger: Make LldbEngine stack handling more similar to GdbEngine

This also addresses the remaining issues of QTCREATORBUG-13803.

Task-number: QTCREATORBUG-13803
Change-Id: Iceb123279236d98961d15fe7421acc7c10d1b1c7
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
hjk
2015-02-27 16:53:48 +01:00
parent bdbe119dbe
commit fb785895f2
3 changed files with 8 additions and 53 deletions

View File

@@ -893,20 +893,6 @@ class Dumper(DumperBase):
if "continuation" in args: if "continuation" in args:
self.report('continuation=\"%s\"' % args["continuation"]) self.report('continuation=\"%s\"' % args["continuation"])
def reportStackPosition(self):
thread = self.currentThread()
if not thread:
self.report('msg="No thread"')
return
frame = thread.GetSelectedFrame()
if frame:
self.report('stack-position={id="%s"}' % frame.GetFrameID())
else:
self.report('stack-position={id="-1"}')
def reportStackTop(self):
self.report('stack-top={}')
def extractBlob(self, base, size): def extractBlob(self, base, size):
if size == 0: if size == 0:
return Blob("") return Blob("")
@@ -1220,7 +1206,6 @@ class Dumper(DumperBase):
else: else:
state = self.process.GetState() state = self.process.GetState()
if state == lldb.eStateStopped: if state == lldb.eStateStopped:
self.reportStackPosition()
self.reportThreads() self.reportThreads()
self.reportVariables() self.reportVariables()
@@ -1340,7 +1325,6 @@ class Dumper(DumperBase):
stoppedThread = self.firstStoppedThread() stoppedThread = self.firstStoppedThread()
if stoppedThread: if stoppedThread:
self.process.SetSelectedThread(stoppedThread) self.process.SetSelectedThread(stoppedThread)
self.reportStackTop()
self.reportThreads() self.reportThreads()
if stoppedThread: if stoppedThread:
self.reportLocation(stoppedThread.GetSelectedFrame()) self.reportLocation(stoppedThread.GetSelectedFrame())
@@ -1605,9 +1589,7 @@ class Dumper(DumperBase):
def activateFrame(self, args): def activateFrame(self, args):
thread = args['thread'] thread = args['thread']
self.currentThread().SetSelectedFrame(args['index']) self.currentThread().SetSelectedFrame(args['index'])
state = self.process.GetState() self.reportContinuation(args)
if state == lldb.eStateStopped:
self.reportStackPosition()
def selectThread(self, args): def selectThread(self, args):
self.process.SetSelectedThreadByID(args['id']) self.process.SetSelectedThreadByID(args['id'])

View File

@@ -434,10 +434,6 @@ void LldbEngine::handleResponse(const QByteArray &response)
watchHandler()->addDumpers(item); watchHandler()->addDumpers(item);
else if (name == "stack") else if (name == "stack")
refreshStack(item); refreshStack(item);
else if (name == "stack-position")
refreshStackPosition(item);
else if (name == "stack-top")
refreshStackTop(item);
else if (name == "registers") else if (name == "registers")
refreshRegisters(item); refreshRegisters(item);
else if (name == "threads") else if (name == "threads")
@@ -526,11 +522,12 @@ void LldbEngine::executeJumpToLine(const ContextData &data)
void LldbEngine::activateFrame(int frameIndex) void LldbEngine::activateFrame(int frameIndex)
{ {
resetLocation();
if (state() != InferiorStopOk && state() != InferiorUnrunnable) if (state() != InferiorStopOk && state() != InferiorUnrunnable)
return; return;
const int n = stackHandler()->stackSize(); StackHandler *handler = stackHandler();
const int n = handler->stackSize();
if (frameIndex == n) { if (frameIndex == n) {
DebuggerCommand cmd("reportStack"); DebuggerCommand cmd("reportStack");
cmd.arg("nativeMixed", isNativeMixedActive()); cmd.arg("nativeMixed", isNativeMixedActive());
@@ -539,6 +536,10 @@ void LldbEngine::activateFrame(int frameIndex)
return; return;
} }
QTC_ASSERT(frameIndex < handler->stackSize(), return);
handler->setCurrentIndex(frameIndex);
gotoLocation(handler->currentFrame());
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());
@@ -786,11 +787,6 @@ void LldbEngine::refreshSymbols(const GdbMi &symbols)
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
void LldbEngine::resetLocation()
{
DebuggerEngine::resetLocation();
}
bool LldbEngine::setToolTipExpression(TextEditor::TextEditorWidget *editorWidget, const DebuggerToolTipContext &context) bool LldbEngine::setToolTipExpression(TextEditor::TextEditorWidget *editorWidget, const DebuggerToolTipContext &context)
{ {
if (state() != InferiorStopOk || !isCppEditor(editorWidget)) { if (state() != InferiorStopOk || !isCppEditor(editorWidget)) {
@@ -1030,25 +1026,6 @@ void LldbEngine::refreshStack(const GdbMi &stack)
handler->setFrames(frames, canExpand); handler->setFrames(frames, canExpand);
} }
void LldbEngine::refreshStackPosition(const GdbMi &position)
{
setStackPosition(position["id"].toInt());
}
void LldbEngine::refreshStackTop(const GdbMi &)
{
setStackPosition(stackHandler()->firstUsableIndex());
}
void LldbEngine::setStackPosition(int index)
{
StackHandler *handler = stackHandler();
handler->setFrames(handler->frames());
handler->setCurrentIndex(index);
if (index >= 0 && index < handler->stackSize())
gotoLocation(handler->frameAt(index));
}
void LldbEngine::refreshRegisters(const GdbMi &registers) void LldbEngine::refreshRegisters(const GdbMi &registers)
{ {
RegisterHandler *handler = registerHandler(); RegisterHandler *handler = registerHandler();

View File

@@ -81,7 +81,6 @@ private:
void shutdownInferior(); void shutdownInferior();
void shutdownEngine(); void shutdownEngine();
void abortDebugger(); void abortDebugger();
void resetLocation();
bool setToolTipExpression(TextEditor::TextEditorWidget *editorWidget, bool setToolTipExpression(TextEditor::TextEditorWidget *editorWidget,
const DebuggerToolTipContext &); const DebuggerToolTipContext &);
@@ -147,9 +146,6 @@ private:
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);
void refreshStackPosition(const GdbMi &position);
void refreshStackTop(const GdbMi &position);
void setStackPosition(int index);
void refreshRegisters(const GdbMi &registers); void refreshRegisters(const GdbMi &registers);
void refreshLocals(const GdbMi &vars); void refreshLocals(const GdbMi &vars);
void refreshTypeInfo(const GdbMi &typeInfo); void refreshTypeInfo(const GdbMi &typeInfo);