forked from qt-creator/qt-creator
Debugger: Move cpp snapshot storage to cdbengine
It's the only one using it. Change-Id: I95dc4918c82653710a47cb8d0043bb3241e954ac Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -243,6 +243,9 @@ CdbEngine::CdbEngine() :
|
||||
this, &CdbEngine::readyReadStandardOut);
|
||||
connect(action(UseDebuggingHelpers), &SavedAction::valueChanged,
|
||||
this, &CdbEngine::updateLocals);
|
||||
|
||||
if (action(UseCodeModel)->isChecked())
|
||||
m_codeModelSnapshot = CppTools::CppModelManager::instance()->snapshot();
|
||||
}
|
||||
|
||||
void CdbEngine::init()
|
||||
@@ -1166,7 +1169,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
|
||||
|
||||
if (boolSetting(UseCodeModel)) {
|
||||
QStringList uninitializedVariables;
|
||||
getUninitializedVariables(Internal::cppCodeModelSnapshot(),
|
||||
getUninitializedVariables(m_codeModelSnapshot,
|
||||
frame.function, frame.file, frame.line, &uninitializedVariables);
|
||||
cmd.arg("uninitialized", uninitializedVariables);
|
||||
}
|
||||
@@ -1237,7 +1240,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
|
||||
// variables in case of errors in uninitializedVariables().
|
||||
if (boolSetting(UseCodeModel)) {
|
||||
QStringList uninitializedVariables;
|
||||
getUninitializedVariables(Internal::cppCodeModelSnapshot(),
|
||||
getUninitializedVariables(m_codeModelSnapshot,
|
||||
frame.function, frame.file, frame.line, &uninitializedVariables);
|
||||
if (!uninitializedVariables.isEmpty()) {
|
||||
str << blankSeparator << "-u \"";
|
||||
@@ -2634,7 +2637,7 @@ void CdbEngine::attemptBreakpointSynchronization()
|
||||
&& parameters.type == BreakpointByFileAndLine
|
||||
&& boolSetting(CdbBreakPointCorrection)) {
|
||||
if (lineCorrection.isNull())
|
||||
lineCorrection.reset(new BreakpointCorrectionContext(Internal::cppCodeModelSnapshot(),
|
||||
lineCorrection.reset(new BreakpointCorrectionContext(m_codeModelSnapshot,
|
||||
CppTools::CppModelManager::instance()->workingCopy()));
|
||||
response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber);
|
||||
QString cmd = cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false);
|
||||
|
@@ -28,6 +28,8 @@
|
||||
#include <debugger/debuggerengine.h>
|
||||
#include <debugger/breakhandler.h>
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
|
||||
#include <QTime>
|
||||
@@ -248,6 +250,7 @@ private:
|
||||
QScopedPointer<GdbMi> m_coreStopReason;
|
||||
int m_pythonVersion = 0; // 0xMMmmpp MM = major; mm = minor; pp = patch
|
||||
bool m_initialSessionIdleHandled = false;
|
||||
mutable CPlusPlus::Snapshot m_codeModelSnapshot;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -67,7 +67,6 @@ enum TestCases
|
||||
// Some convenience.
|
||||
void updateState(DebuggerRunTool *runTool);
|
||||
void updateLocalsWindow(bool showReturn);
|
||||
const CPlusPlus::Snapshot &cppCodeModelSnapshot();
|
||||
bool hasSnapshots();
|
||||
void openTextEditor(const QString &titlePattern, const QString &contents);
|
||||
|
||||
|
@@ -88,7 +88,6 @@
|
||||
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
#include <qmljseditor/qmljseditorconstants.h>
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
@@ -1042,7 +1041,6 @@ public:
|
||||
bool m_busy = false;
|
||||
QString m_lastPermanentStatusMessage;
|
||||
|
||||
mutable CPlusPlus::Snapshot m_codeModelSnapshot;
|
||||
DebuggerPlugin *m_plugin = nullptr;
|
||||
|
||||
SnapshotHandler *m_snapshotHandler = nullptr;
|
||||
@@ -2607,7 +2605,6 @@ void DebuggerPluginPrivate::updateState(DebuggerRunTool *runTool)
|
||||
m_debugWithoutDeployAction->setEnabled(canRun);
|
||||
setProxyAction(m_visibleStartAction, Id(Constants::DEBUG));
|
||||
m_hiddenStopAction->setAction(m_undisturbableAction);
|
||||
m_codeModelSnapshot = CPlusPlus::Snapshot();
|
||||
setBusyCursor(false);
|
||||
cleanupViews();
|
||||
} else if (state == InferiorUnrunnable) {
|
||||
@@ -2812,13 +2809,6 @@ void DebuggerPluginPrivate::aboutToShutdown()
|
||||
m_shutdownTimer.start();
|
||||
}
|
||||
|
||||
const CPlusPlus::Snapshot &cppCodeModelSnapshot()
|
||||
{
|
||||
if (dd->m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked())
|
||||
dd->m_codeModelSnapshot = CppTools::CppModelManager::instance()->snapshot();
|
||||
return dd->m_codeModelSnapshot;
|
||||
}
|
||||
|
||||
void setSessionValue(const QByteArray &key, const QVariant &value)
|
||||
{
|
||||
SessionManager::setValue(QString::fromUtf8(key), value);
|
||||
|
Reference in New Issue
Block a user