Commit 3066162e authored by hjk's avatar hjk
Browse files

debugger: avoid a few watchmodel rebuilds, also reset location markers properly

parent 5e7c972a
......@@ -1382,6 +1382,7 @@ void DebuggerManager::executeRunToLine()
int lineNumber = textEditor->currentLine();
if (d->m_engine && !fileName.isEmpty()) {
STATE_DEBUG(fileName << lineNumber);
resetLocation();
d->m_engine->executeRunToLine(fileName, lineNumber);
}
}
......@@ -1414,8 +1415,10 @@ void DebuggerManager::executeRunToFunction()
}
STATE_DEBUG(functionName);
if (d->m_engine && !functionName.isEmpty())
if (d->m_engine && !functionName.isEmpty()) {
resetLocation();
d->m_engine->executeRunToFunction(functionName);
}
}
void DebuggerManager::executeJumpToLine()
......@@ -1434,7 +1437,6 @@ void DebuggerManager::resetLocation()
{
d->m_disassemblerViewAgent.resetLocation();
d->m_stackHandler->setCurrentIndex(-1);
// Connected to the plugin.
d->m_plugin->resetLocation();
}
......@@ -1445,7 +1447,6 @@ void DebuggerManager::gotoLocation(const StackFrame &frame, bool setMarker)
d->m_plugin->resetLocation();
d->m_disassemblerViewAgent.setFrame(frame);
} else {
// Connected to the plugin.
d->m_plugin->gotoLocation(frame.file, frame.line, setMarker);
}
}
......
......@@ -1406,8 +1406,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (m_gdbAdapter->isTrkAdapter())
m_gdbAdapter->trkReloadThreads();
else
postCommand("-thread-list-ids", WatchUpdate,
CB(handleStackListThreads), currentId);
postCommand("-thread-list-ids", CB(handleStackListThreads), currentId);
}
//
......@@ -1967,7 +1966,9 @@ void GdbEngine::setTokenBarrier()
{
foreach (const GdbCommand &cookie, m_cookieForToken) {
QTC_ASSERT(!cookie.callback || (cookie.flags & Discardable),
qDebug() << "CMD:" << cookie.command << " CALLBACK:" << cookie.callbackName;
qDebug() << "CMD:" << cookie.command
<< " FLAGS:" << cookie.flags
<< " CALLBACK:" << cookie.callbackName;
return
);
}
......@@ -2600,7 +2601,7 @@ void GdbEngine::handleStackSelectThread(const GdbResponse &)
void GdbEngine::reloadFullStack()
{
PENDING_DEBUG("RELOAD FULL STACK");
postCommand("-stack-list-frames", WatchUpdate, CB(handleStackListFrames),
postCommand("-stack-list-frames", CB(handleStackListFrames),
QVariant::fromValue<StackCookie>(StackCookie(true, true)));
}
......@@ -2619,8 +2620,8 @@ void GdbEngine::reloadStack(bool forceGotoLocation)
// of waiting for the first request to fail.
// FIXME: Seems to work with 6.8.
if (m_gdbAdapter->isTrkAdapter() && m_gdbVersion < 6.8)
postCommand(cmd, WatchUpdate);
postCommand(cmd, WatchUpdate, CB(handleStackListFrames),
postCommand(cmd);
postCommand(cmd, CB(handleStackListFrames),
QVariant::fromValue<StackCookie>(StackCookie(false, forceGotoLocation)));
}
......@@ -2720,11 +2721,8 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
bool jump = (m_isMacGdb || targetFrame != 0);
manager()->stackHandler()->setCurrentIndex(targetFrame);
if (jump || cookie.gotoLocation) {
const StackFrame &frame = manager()->stackHandler()->currentFrame();
//qDebug() << "GOTO, 2ND ATTEMPT: " << frame.toString() << targetFrame;
gotoLocation(frame, true);
}
if (jump || cookie.gotoLocation)
activateFrame(targetFrame);
}
void GdbEngine::activateFrame(int frameIndex)
......@@ -2744,21 +2742,23 @@ void GdbEngine::activateFrame(int frameIndex)
QTC_ASSERT(frameIndex < stackHandler->stackSize(), return);
if (oldIndex != frameIndex) {
setTokenBarrier();
// Assuming the command always succeeds this saves a roundtrip.
// Otherwise the lines below would need to get triggered
// after a response to this -stack-select-frame here.
postCommand("-stack-select-frame " + QByteArray::number(frameIndex));
stackHandler->setCurrentIndex(frameIndex);
updateLocals();
reloadRegisters();
postCommand("-stack-select-frame " + QByteArray::number(frameIndex),
CB(handleStackSelectFrame));
}
gotoLocation(stackHandler->currentFrame(), true);
}
void GdbEngine::handleStackSelectFrame(const GdbResponse &response)
{
Q_UNUSED(response);
updateLocals();
reloadRegisters();
}
void GdbEngine::handleStackListThreads(const GdbResponse &response)
{
int id = response.cookie.toInt();
......
......@@ -424,6 +424,7 @@ private: ////////// View & Data Stuff //////////
void updateAllPython();
void handleStackListFrames(const GdbResponse &response);
void handleStackSelectThread(const GdbResponse &response);
void handleStackSelectFrame(const GdbResponse &response);
void handleStackListThreads(const GdbResponse &response);
Q_SLOT void reloadStack(bool forceGotoLocation);
Q_SLOT virtual void reloadFullStack();
......
......@@ -197,14 +197,13 @@ void GdbEngine::updateAllPython()
//PENDING_DEBUG("UPDATING ALL\n");
QTC_ASSERT(state() == InferiorUnrunnable || state() == InferiorStopped, /**/);
reloadModulesInternal();
postCommand("-stack-list-frames", WatchUpdate, CB(handleStackListFrames),
postCommand("-stack-list-frames", CB(handleStackListFrames),
QVariant::fromValue<StackCookie>(StackCookie(false, true)));
manager()->stackHandler()->setCurrentIndex(0);
qDebug() << "IS TRK: " << m_gdbAdapter->isTrkAdapter();
if (m_gdbAdapter->isTrkAdapter())
m_gdbAdapter->trkReloadThreads();
else
postCommand("-thread-list-ids", WatchUpdate, CB(handleStackListThreads), 0);
postCommand("-thread-list-ids", CB(handleStackListThreads), 0);
manager()->reloadRegisters();
updateLocals();
}
......
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