diff options
author | hjk <hjk@theqtcompany.com> | 2015-10-09 15:00:20 +0200 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-10-13 06:49:00 +0000 |
commit | ec2e01faec87e273486b81d0c3bf8ded2619c047 (patch) | |
tree | 0ae4ae25224bad3b8da9a4dd5c64656e8cbd8899 /src/plugins/debugger/stackhandler.cpp | |
parent | d6ef70573d205ab9ac4491ec18c90c60373127a3 (diff) |
Debugger: Make basic native-mixed debugging work with LLDB
Change-Id: I4d55c6a486d5adbccaa93eaa1ee461238fecfea3
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger/stackhandler.cpp')
-rw-r--r-- | src/plugins/debugger/stackhandler.cpp | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index 39bbae9a20..a792718d96 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -33,6 +33,7 @@ #include "debuggeractions.h" #include "debuggercore.h" #include "debuggerengine.h" +#include "debuggerprotocol.h" #include "simplifytype.h" #include <utils/fileutils.h> @@ -168,12 +169,6 @@ StackFrame StackHandler::currentFrame() const return m_stackFrames.at(m_currentIndex); } -void StackHandler::setAllFrames(const GdbMi &frames, bool canExpand) -{ - action(ExpandStack)->setEnabled(canExpand); - setFrames(StackFrame::parseFrames(frames, m_engine->runParameters()), canExpand); -} - void StackHandler::setCurrentIndex(int level) { if (level == -1 || level == m_currentIndex) @@ -214,6 +209,45 @@ void StackHandler::setFrames(const StackFrames &frames, bool canExpand) emit stackChanged(); } +void StackHandler::setFramesAndCurrentIndex(const GdbMi &frames, bool isFull) +{ + int targetFrame = -1; + + StackFrames stackFrames; + const int n = frames.childCount(); + for (int i = 0; i != n; ++i) { + stackFrames.append(StackFrame::parseFrame(frames.childAt(i), m_engine->runParameters())); + const StackFrame &frame = stackFrames.back(); + + // Initialize top frame to the first valid frame. + const bool isValid = frame.isUsable() && !frame.function.isEmpty(); + if (isValid && targetFrame == -1) + targetFrame = i; + } + + bool canExpand = !isFull && (n >= action(MaximalStackDepth)->value().toInt()); + action(ExpandStack)->setEnabled(canExpand); + setFrames(stackFrames, canExpand); + + // We can't jump to any file if we don't have any frames. + if (stackFrames.isEmpty()) + return; + + // targetFrame contains the top most frame for which we have source + // information. That's typically the frame we'd like to jump to, with + // a few exceptions: + + // Always jump to frame #0 when stepping by instruction. + if (boolSetting(OperateByInstruction)) + targetFrame = 0; + + // If there is no frame with source, jump to frame #0. + if (targetFrame == -1) + targetFrame = 0; + + setCurrentIndex(targetFrame); +} + void StackHandler::prependFrames(const StackFrames &frames) { if (frames.isEmpty()) |