Commit fb785895 authored by hjk's avatar hjk

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: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent bdbe119d
......@@ -893,20 +893,6 @@ class Dumper(DumperBase):
if "continuation" in args:
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):
if size == 0:
return Blob("")
......@@ -1220,7 +1206,6 @@ class Dumper(DumperBase):
else:
state = self.process.GetState()
if state == lldb.eStateStopped:
self.reportStackPosition()
self.reportThreads()
self.reportVariables()
......@@ -1340,7 +1325,6 @@ class Dumper(DumperBase):
stoppedThread = self.firstStoppedThread()
if stoppedThread:
self.process.SetSelectedThread(stoppedThread)
self.reportStackTop()
self.reportThreads()
if stoppedThread:
self.reportLocation(stoppedThread.GetSelectedFrame())
......@@ -1605,9 +1589,7 @@ class Dumper(DumperBase):
def activateFrame(self, args):
thread = args['thread']
self.currentThread().SetSelectedFrame(args['index'])
state = self.process.GetState()
if state == lldb.eStateStopped:
self.reportStackPosition()
self.reportContinuation(args)
def selectThread(self, args):
self.process.SetSelectedThreadByID(args['id'])
......
......@@ -434,10 +434,6 @@ void LldbEngine::handleResponse(const QByteArray &response)
watchHandler()->addDumpers(item);
else if (name == "stack")
refreshStack(item);
else if (name == "stack-position")
refreshStackPosition(item);
else if (name == "stack-top")
refreshStackTop(item);
else if (name == "registers")
refreshRegisters(item);
else if (name == "threads")
......@@ -526,11 +522,12 @@ void LldbEngine::executeJumpToLine(const ContextData &data)
void LldbEngine::activateFrame(int frameIndex)
{
resetLocation();
if (state() != InferiorStopOk && state() != InferiorUnrunnable)
return;
const int n = stackHandler()->stackSize();
StackHandler *handler = stackHandler();
const int n = handler->stackSize();
if (frameIndex == n) {
DebuggerCommand cmd("reportStack");
cmd.arg("nativeMixed", isNativeMixedActive());
......@@ -539,6 +536,10 @@ void LldbEngine::activateFrame(int frameIndex)
return;
}
QTC_ASSERT(frameIndex < handler->stackSize(), return);
handler->setCurrentIndex(frameIndex);
gotoLocation(handler->currentFrame());
DebuggerCommand cmd("activateFrame");
cmd.arg("index", frameIndex);
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)
{
if (state() != InferiorStopOk || !isCppEditor(editorWidget)) {
......@@ -1030,25 +1026,6 @@ void LldbEngine::refreshStack(const GdbMi &stack)
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)
{
RegisterHandler *handler = registerHandler();
......
......@@ -81,7 +81,6 @@ private:
void shutdownInferior();
void shutdownEngine();
void abortDebugger();
void resetLocation();
bool setToolTipExpression(TextEditor::TextEditorWidget *editorWidget,
const DebuggerToolTipContext &);
......@@ -147,9 +146,6 @@ private:
void refreshAll(const GdbMi &all);
void refreshThreads(const GdbMi &threads);
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 refreshLocals(const GdbMi &vars);
void refreshTypeInfo(const GdbMi &typeInfo);
......
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