Debugger: Replace debuggerCore() by equivalent free functions

One indirection less on the user code side, and easier to export
if needed (partially addressing QTCREATORBUG-13187)

Change-Id: I13ab9f471a3a34da7a6331aefc83f6d02413bfab
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
hjk
2014-10-22 13:04:47 +02:00
parent 6b4c254bf3
commit 9ba17acc80
20 changed files with 255 additions and 244 deletions

View File

@@ -297,7 +297,6 @@ void BreakHandler::saveBreakpoints()
{ {
const QString one = _("1"); const QString one = _("1");
//qDebug() << "SAVING BREAKPOINTS..."; //qDebug() << "SAVING BREAKPOINTS...";
QTC_ASSERT(debuggerCore(), return);
QList<QVariant> list; QList<QVariant> list;
ConstIterator it = m_storage.constBegin(), et = m_storage.constEnd(); ConstIterator it = m_storage.constBegin(), et = m_storage.constEnd();
for ( ; it != et; ++it) { for ( ; it != et; ++it) {
@@ -1210,7 +1209,7 @@ void BreakHandler::timerEvent(QTimerEvent *event)
killTimer(m_syncTimerId); killTimer(m_syncTimerId);
m_syncTimerId = -1; m_syncTimerId = -1;
saveBreakpoints(); // FIXME: remove? saveBreakpoints(); // FIXME: remove?
debuggerCore()->synchronizeBreakpoints(); Internal::synchronizeBreakpoints();
} }
void BreakHandler::gotoLocation(BreakpointModelId id) const void BreakHandler::gotoLocation(BreakpointModelId id) const

View File

@@ -789,7 +789,7 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev)
QAction *synchronizeAction = QAction *synchronizeAction =
new QAction(tr("Synchronize Breakpoints"), &menu); new QAction(tr("Synchronize Breakpoints"), &menu);
synchronizeAction->setEnabled(debuggerCore()->hasSnapshots()); synchronizeAction->setEnabled(Internal::hasSnapshots());
bool enabled = selectedIds.isEmpty() || handler->isEnabled(selectedIds.at(0)); bool enabled = selectedIds.isEmpty() || handler->isEnabled(selectedIds.at(0));

View File

@@ -387,7 +387,7 @@ void CdbEngine::init()
// Create local list of mappings in native separators // Create local list of mappings in native separators
m_sourcePathMappings.clear(); m_sourcePathMappings.clear();
const QSharedPointer<GlobalDebuggerOptions> globalOptions = debuggerCore()->globalDebuggerOptions(); const QSharedPointer<GlobalDebuggerOptions> globalOptions = Internal::globalDebuggerOptions();
SourcePathMap sourcePathMap = globalOptions->sourcePathMap; SourcePathMap sourcePathMap = globalOptions->sourcePathMap;
if (!sourcePathMap.isEmpty()) { if (!sourcePathMap.isEmpty()) {
m_sourcePathMappings.reserve(sourcePathMap.size()); m_sourcePathMappings.reserve(sourcePathMap.size());
@@ -583,7 +583,7 @@ void CdbEngine::createFullBacktrace()
void CdbEngine::handleCreateFullBackTrace(const CdbEngine::CdbBuiltinCommandPtr &cmd) void CdbEngine::handleCreateFullBackTrace(const CdbEngine::CdbBuiltinCommandPtr &cmd)
{ {
debuggerCore()->openTextEditor(QLatin1String("Backtrace $"), QLatin1String(cmd->joinedReply())); Internal::openTextEditor(QLatin1String("Backtrace $"), QLatin1String(cmd->joinedReply()));
} }
void CdbEngine::setupEngine() void CdbEngine::setupEngine()
@@ -1529,7 +1529,7 @@ void CdbEngine::updateLocals(bool forNewStackFrame)
// variables in case of errors in uninitializedVariables(). // variables in case of errors in uninitializedVariables().
if (boolSetting(UseCodeModel)) { if (boolSetting(UseCodeModel)) {
QStringList uninitializedVariables; QStringList uninitializedVariables;
getUninitializedVariables(debuggerCore()->cppCodeModelSnapshot(), getUninitializedVariables(Internal::cppCodeModelSnapshot(),
frame.function, frame.file, frame.line, &uninitializedVariables); frame.function, frame.file, frame.line, &uninitializedVariables);
if (!uninitializedVariables.isEmpty()) { if (!uninitializedVariables.isEmpty()) {
str << blankSeparator << "-u \""; str << blankSeparator << "-u \"";
@@ -2296,9 +2296,9 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
// Fire off remaining commands asynchronously // Fire off remaining commands asynchronously
if (!m_pendingBreakpointMap.isEmpty() && !m_pendingSubBreakpointMap.isEmpty()) if (!m_pendingBreakpointMap.isEmpty() && !m_pendingSubBreakpointMap.isEmpty())
postCommandSequence(CommandListBreakPoints); postCommandSequence(CommandListBreakPoints);
if (debuggerCore()->isDockVisible(QLatin1String(DOCKWIDGET_REGISTER))) if (Internal::isDockVisible(QLatin1String(DOCKWIDGET_REGISTER)))
postCommandSequence(CommandListRegisters); postCommandSequence(CommandListRegisters);
if (debuggerCore()->isDockVisible(QLatin1String(DOCKWIDGET_MODULES))) if (Internal::isDockVisible(QLatin1String(DOCKWIDGET_MODULES)))
postCommandSequence(CommandListModules); postCommandSequence(CommandListModules);
} }
// After the sequence has been sent off and CDB is pondering the commands, // After the sequence has been sent off and CDB is pondering the commands,
@@ -2920,7 +2920,7 @@ void CdbEngine::attemptBreakpointSynchronization()
&& parameters.type == BreakpointByFileAndLine && parameters.type == BreakpointByFileAndLine
&& boolSetting(CdbBreakPointCorrection)) { && boolSetting(CdbBreakPointCorrection)) {
if (lineCorrection.isNull()) if (lineCorrection.isNull())
lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(), lineCorrection.reset(new BreakpointCorrectionContext(Internal::cppCodeModelSnapshot(),
CppTools::CppModelManager::instance()->workingCopy())); CppTools::CppModelManager::instance()->workingCopy()));
response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber); response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber);
postBuiltinCommand( postBuiltinCommand(

View File

@@ -49,8 +49,6 @@ namespace CPlusPlus { class Snapshot; }
namespace Utils { class SavedAction; } namespace Utils { class SavedAction; }
namespace ProjectExplorer { class RunControl; }
namespace Debugger { namespace Debugger {
class DebuggerEngine; class DebuggerEngine;
@@ -68,52 +66,36 @@ enum TestCases
TestNoBoundsOfCurrentFunction = 1 TestNoBoundsOfCurrentFunction = 1
}; };
class DebuggerCore : public QObject
{
Q_OBJECT
public:
DebuggerCore() {}
virtual void updateState(DebuggerEngine *engine) = 0;
virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0;
virtual QIcon locationMarkIcon() const = 0;
virtual const CPlusPlus::Snapshot &cppCodeModelSnapshot() const = 0;
virtual bool hasSnapshots() const = 0;
virtual void openTextEditor(const QString &titlePattern, const QString &contents) = 0;
virtual bool isActiveDebugLanguage(int language) const = 0;
// void runTest(const QString &fileName);
virtual void showMessage(const QString &msg, int channel, int timeout = -1) = 0;
virtual bool isReverseDebugging() const = 0;
virtual void runControlStarted(DebuggerEngine *engine) = 0;
virtual void runControlFinished(DebuggerEngine *engine) = 0;
virtual void displayDebugger(DebuggerEngine *engine, bool updateEngine) = 0;
virtual DebuggerLanguages activeLanguages() const = 0;
virtual void synchronizeBreakpoints() = 0;
virtual bool initialize(const QStringList &arguments, QString *errorMessage) = 0;
virtual QWidget *mainWindow() const = 0;
virtual bool isDockVisible(const QString &objectName) const = 0;
virtual void showModuleSymbols(const QString &moduleName,
const QVector<Symbol> &symbols) = 0;
virtual void showModuleSections(const QString &moduleName,
const QVector<Section> &sections) = 0;
virtual void openMemoryEditor() = 0;
virtual void languagesChanged() = 0;
virtual void setThreads(const QStringList &list, int index) = 0;
virtual QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const = 0;
static QTreeView *inspectorView();
public slots:
virtual void attachExternalApplication(ProjectExplorer::RunControl *rc) = 0;
};
// Some convenience. // Some convenience.
void updateState(DebuggerEngine *engine);
void updateWatchersWindow(bool showWatch, bool showReturn);
QIcon locationMarkIcon();
const CPlusPlus::Snapshot &cppCodeModelSnapshot();
bool hasSnapshots();
void openTextEditor(const QString &titlePattern, const QString &contents);
bool isActiveDebugLanguage(int language);
// void runTest(const QString &fileName);
void showMessage(const QString &msg, int channel, int timeout = -1);
bool isReverseDebugging();
void runControlStarted(DebuggerEngine *engine);
void runControlFinished(DebuggerEngine *engine);
void displayDebugger(DebuggerEngine *engine, bool updateEngine);
DebuggerLanguages activeLanguages();
void synchronizeBreakpoints();
QWidget *mainWindow();
bool isDockVisible(const QString &objectName);
void showModuleSymbols(const QString &moduleName, const QVector<Internal::Symbol> &symbols);
void showModuleSections(const QString &moduleName, const QVector<Internal::Section> &sections);
void openMemoryEditor();
void setThreads(const QStringList &list, int index);
QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions();
QTreeView *inspectorView();
QVariant sessionValue(const QByteArray &name); QVariant sessionValue(const QByteArray &name);
void setSessionValue(const QByteArray &name, const QVariant &value); void setSessionValue(const QByteArray &name, const QVariant &value);
QVariant configValue(const QByteArray &name); QVariant configValue(const QByteArray &name);
@@ -127,9 +109,6 @@ QStringList stringListSetting(int code);
BreakHandler *breakHandler(); BreakHandler *breakHandler();
DebuggerEngine *currentEngine(); DebuggerEngine *currentEngine();
// This is the only way to access the global object.
DebuggerCore *debuggerCore();
QMessageBox *showMessageBox(int icon, const QString &title, QMessageBox *showMessageBox(int icon, const QString &title,
const QString &text, int buttons = 0); const QString &text, int buttons = 0);

View File

@@ -493,7 +493,7 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c
if (channel == ConsoleOutput && consoleManager) if (channel == ConsoleOutput && consoleManager)
consoleManager->printToConsolePane(QmlJS::ConsoleItem::UndefinedType, msg); consoleManager->printToConsolePane(QmlJS::ConsoleItem::UndefinedType, msg);
debuggerCore()->showMessage(msg, channel, timeout); Internal::showMessage(msg, channel, timeout);
if (d->m_runControl) { if (d->m_runControl) {
switch (channel) { switch (channel) {
case AppOutput: case AppOutput:
@@ -577,7 +577,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
if (loc.needsMarker()) { if (loc.needsMarker()) {
d->m_locationMark.reset(new TextEditor::TextMark(file, line)); d->m_locationMark.reset(new TextEditor::TextMark(file, line));
d->m_locationMark->setIcon(debuggerCore()->locationMarkIcon()); d->m_locationMark->setIcon(Internal::locationMarkIcon());
d->m_locationMark->setPriority(TextEditor::TextMark::HighPriority); d->m_locationMark->setPriority(TextEditor::TextMark::HighPriority);
} }
@@ -971,7 +971,7 @@ void DebuggerEngine::notifyInferiorSpontaneousStop()
showStatusMessage(tr("Stopped.")); showStatusMessage(tr("Stopped."));
setState(InferiorStopOk); setState(InferiorStopOk);
if (boolSetting(RaiseOnInterrupt)) if (boolSetting(RaiseOnInterrupt))
ICore::raiseWindow(debuggerCore()->mainWindow()); ICore::raiseWindow(Internal::mainWindow());
} }
void DebuggerEngine::notifyInferiorStopFailed() void DebuggerEngine::notifyInferiorStopFailed()
@@ -1219,7 +1219,7 @@ void DebuggerEngine::updateViews()
// The slave engines are not entitled to change the view. Their wishes // The slave engines are not entitled to change the view. Their wishes
// should be coordinated by their master engine. // should be coordinated by their master engine.
if (isMasterEngine()) if (isMasterEngine())
debuggerCore()->updateState(this); Internal::updateState(this);
} }
bool DebuggerEngine::isSlaveEngine() const bool DebuggerEngine::isSlaveEngine() const
@@ -1312,7 +1312,7 @@ qint64 DebuggerEngine::inferiorPid() const
bool DebuggerEngine::isReverseDebugging() const bool DebuggerEngine::isReverseDebugging() const
{ {
return debuggerCore()->isReverseDebugging(); return Internal::isReverseDebugging();
} }
// Called by DebuggerRunControl. // Called by DebuggerRunControl.
@@ -1799,7 +1799,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
Utils::ElfData elfData = reader.readHeaders(); Utils::ElfData elfData = reader.readHeaders();
QString error = reader.errorString(); QString error = reader.errorString();
debuggerCore()->showMessage(_("EXAMINING ") + binary, LogDebug); Internal::showMessage(_("EXAMINING ") + binary, LogDebug);
QByteArray msg = "ELF SECTIONS: "; QByteArray msg = "ELF SECTIONS: ";
static QList<QByteArray> interesting; static QList<QByteArray> interesting;
@@ -1823,16 +1823,16 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
if (interesting.contains(header.name)) if (interesting.contains(header.name))
seen.insert(header.name); seen.insert(header.name);
} }
debuggerCore()->showMessage(_(msg), LogDebug); Internal::showMessage(_(msg), LogDebug);
if (!error.isEmpty()) { if (!error.isEmpty()) {
debuggerCore()->showMessage(_("ERROR WHILE READING ELF SECTIONS: ") + error, Internal::showMessage(_("ERROR WHILE READING ELF SECTIONS: ") + error,
LogDebug); LogDebug);
return; return;
} }
if (elfData.sectionHeaders.isEmpty()) { if (elfData.sectionHeaders.isEmpty()) {
debuggerCore()->showMessage(_("NO SECTION HEADERS FOUND. IS THIS AN EXECUTABLE?"), Internal::showMessage(_("NO SECTION HEADERS FOUND. IS THIS AN EXECUTABLE?"),
LogDebug); LogDebug);
return; return;
} }
@@ -1842,7 +1842,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
bool hasEmbeddedInfo = elfData.indexOf(".debug_info") >= 0; bool hasEmbeddedInfo = elfData.indexOf(".debug_info") >= 0;
bool hasLink = elfData.indexOf(".gnu_debuglink") >= 0; bool hasLink = elfData.indexOf(".gnu_debuglink") >= 0;
if (hasEmbeddedInfo) { if (hasEmbeddedInfo) {
QSharedPointer<GlobalDebuggerOptions> options = debuggerCore()->globalDebuggerOptions(); QSharedPointer<GlobalDebuggerOptions> options = Internal::globalDebuggerOptions();
SourcePathRegExpMap globalRegExpSourceMap; SourcePathRegExpMap globalRegExpSourceMap;
globalRegExpSourceMap.reserve(options->sourcePathRegExpMap.size()); globalRegExpSourceMap.reserve(options->sourcePathRegExpMap.size());
foreach (auto entry, options->sourcePathRegExpMap) { foreach (auto entry, options->sourcePathRegExpMap) {

View File

@@ -102,7 +102,7 @@ public slots:
void updateUiForCurrentRunConfiguration(); void updateUiForCurrentRunConfiguration();
void updateActiveLanguages(); void updateActiveLanguages();
void updateDockWidgetSettings(); void updateDockWidgetSettings();
void openMemoryEditor() { debuggerCore()->openMemoryEditor(); } void openMemoryEditor() { Internal::openMemoryEditor(); }
public: public:
DebuggerMainWindow *q; DebuggerMainWindow *q;
@@ -231,10 +231,8 @@ void DebuggerMainWindowPrivate::updateActiveLanguages()
newLanguages |= QmlLanguage; newLanguages |= QmlLanguage;
} }
if (newLanguages != m_activeDebugLanguages) { if (newLanguages != m_activeDebugLanguages)
m_activeDebugLanguages = newLanguages; m_activeDebugLanguages = newLanguages;
debuggerCore()->languagesChanged();
}
if (m_changingUI || !m_inDebugMode) if (m_changingUI || !m_inDebugMode)
return; return;

View File

@@ -374,6 +374,7 @@ sg1: }
using namespace Core; using namespace Core;
using namespace Debugger::Constants; using namespace Debugger::Constants;
using namespace Debugger::Internal;
using namespace ExtensionSystem; using namespace ExtensionSystem;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace TextEditor; using namespace TextEditor;
@@ -535,8 +536,8 @@ static QWidget *addSearch(BaseTreeView *treeView, const QString &title,
{ {
QAction *act = action(UseAlternatingRowColors); QAction *act = action(UseAlternatingRowColors);
treeView->setAlternatingRowColors(act->isChecked()); treeView->setAlternatingRowColors(act->isChecked());
QObject::connect(act, SIGNAL(toggled(bool)), QObject::connect(act, &QAction::toggled,
treeView, SLOT(setAlternatingRowColorsHelper(bool))); treeView, &BaseTreeView::setAlternatingRowColorsHelper);
QWidget *widget = ItemViewFind::createSearchableWrapper(treeView); QWidget *widget = ItemViewFind::createSearchableWrapper(treeView);
widget->setObjectName(QLatin1String(objectName)); widget->setObjectName(QLatin1String(objectName));
@@ -595,7 +596,7 @@ static bool currentTextEditorPosition(ContextData *data)
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
static DebuggerPluginPrivate *theDebuggerCore = 0; static DebuggerPluginPrivate *dd = 0;
/*! /*!
\class Debugger::Internal::DebuggerCore \class Debugger::Internal::DebuggerCore
@@ -611,7 +612,7 @@ static DebuggerPluginPrivate *theDebuggerCore = 0;
Implementation of DebuggerCore. Implementation of DebuggerCore.
*/ */
class DebuggerPluginPrivate : public DebuggerCore class DebuggerPluginPrivate : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -774,17 +775,12 @@ public slots:
void attachToUnstartedApplicationDialog(); void attachToUnstartedApplicationDialog();
void attachToFoundProcess(); void attachToFoundProcess();
void continueOnAttach(Debugger::DebuggerState state); void continueOnAttach(Debugger::DebuggerState state);
void attachExternalApplication(ProjectExplorer::RunControl *rc);
void attachToQmlPort(); void attachToQmlPort();
void runScheduled(); void runScheduled();
void attachCore(); void attachCore();
void enableReverseDebuggingTriggered(const QVariant &value); void enableReverseDebuggingTriggered(const QVariant &value);
void languagesChanged();
void showStatusMessage(const QString &msg, int timeout = -1); void showStatusMessage(const QString &msg, int timeout = -1);
void openMemoryEditor();
const CPlusPlus::Snapshot &cppCodeModelSnapshot() const;
DebuggerMainWindow *mainWindow() const { return m_mainWindow; } DebuggerMainWindow *mainWindow() const { return m_mainWindow; }
@@ -794,16 +790,10 @@ public slots:
return dock && dock->toggleViewAction()->isChecked(); return dock && dock->toggleViewAction()->isChecked();
} }
bool hasSnapshots() const { return m_snapshotHandler->size(); }
void createNewDock(QWidget *widget);
void runControlStarted(DebuggerEngine *engine); void runControlStarted(DebuggerEngine *engine);
void runControlFinished(DebuggerEngine *engine); void runControlFinished(DebuggerEngine *engine);
DebuggerLanguages activeLanguages() const;
void remoteCommand(const QStringList &options, const QStringList &); void remoteCommand(const QStringList &options, const QStringList &);
bool isReverseDebugging() const;
void displayDebugger(DebuggerEngine *engine, bool updateEngine = true); void displayDebugger(DebuggerEngine *engine, bool updateEngine = true);
void dumpLog(); void dumpLog();
@@ -1049,26 +1039,13 @@ public slots:
} }
} }
bool isActiveDebugLanguage(int lang) const
{
return m_mainWindow->activeDebugLanguages() & lang;
}
QIcon locationMarkIcon() const { return m_locationMarkIcon; }
void openTextEditor(const QString &titlePattern0, const QString &contents);
void showMessage(const QString &msg, int channel, int timeout = -1); void showMessage(const QString &msg, int channel, int timeout = -1);
void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
void showModuleSections(const QString &moduleName, const Sections &sections);
bool parseArgument(QStringList::const_iterator &it, bool parseArgument(QStringList::const_iterator &it,
const QStringList::const_iterator &cend, QString *errorMessage); const QStringList::const_iterator &cend, QString *errorMessage);
bool parseArguments(const QStringList &args, QString *errorMessage); bool parseArguments(const QStringList &args, QString *errorMessage);
void parseCommandLineArguments(); void parseCommandLineArguments();
QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const { return m_globalDebuggerOptions; }
void updateQmlActions() { void updateQmlActions() {
action(QmlUpdateOnSave)->setEnabled(boolSetting(ShowQmlObjectTree)); action(QmlUpdateOnSave)->setEnabled(boolSetting(ShowQmlObjectTree));
} }
@@ -1179,8 +1156,8 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
qRegisterMetaType<ContextData>("ContextData"); qRegisterMetaType<ContextData>("ContextData");
qRegisterMetaType<DebuggerStartParameters>("DebuggerStartParameters"); qRegisterMetaType<DebuggerStartParameters>("DebuggerStartParameters");
QTC_CHECK(!theDebuggerCore); QTC_CHECK(!dd);
theDebuggerCore = this; dd = this;
m_plugin = plugin; m_plugin = plugin;
@@ -1248,11 +1225,6 @@ DebuggerEngine *DebuggerPluginPrivate::dummyEngine()
return m_dummyEngine; return m_dummyEngine;
} }
DebuggerCore *debuggerCore()
{
return theDebuggerCore;
}
static QString msgParameterMissing(const QString &a) static QString msgParameterMissing(const QString &a)
{ {
return DebuggerPlugin::tr("Option \"%1\" is missing the parameter.").arg(a); return DebuggerPlugin::tr("Option \"%1\" is missing the parameter.").arg(a);
@@ -1381,7 +1353,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
Q_UNUSED(errorMessage); Q_UNUSED(errorMessage);
m_arguments = arguments; m_arguments = arguments;
if (!m_arguments.isEmpty()) if (!m_arguments.isEmpty())
connect(KitManager::instance(), SIGNAL(kitsLoaded()), this, SLOT(parseCommandLineArguments())); connect(KitManager::instance(), &KitManager::kitsLoaded,
this, &DebuggerPluginPrivate::parseCommandLineArguments);
// Cpp/Qml ui setup // Cpp/Qml ui setup
m_mainWindow = new DebuggerMainWindow; m_mainWindow = new DebuggerMainWindow;
@@ -1442,10 +1415,6 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
setProxyAction(m_visibleStartAction, Core::Id(Constants::DEBUG)); setProxyAction(m_visibleStartAction, Core::Id(Constants::DEBUG));
} }
void DebuggerPluginPrivate::languagesChanged()
{
}
void DebuggerPluginPrivate::debugProject() void DebuggerPluginPrivate::debugProject()
{ {
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode); ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode);
@@ -1575,13 +1544,12 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly)
} }
} }
void DebuggerPluginPrivate::attachToUnstartedApplicationDialog() void DebuggerPluginPrivate::attachToUnstartedApplicationDialog()
{ {
UnstartedAppWatcherDialog *dlg = new UnstartedAppWatcherDialog(ICore::dialogParent()); UnstartedAppWatcherDialog *dlg = new UnstartedAppWatcherDialog(ICore::dialogParent());
connect(dlg, SIGNAL(finished(int)), dlg, SLOT(deleteLater())); connect(dlg, &QDialog::finished, dlg, &QObject::deleteLater);
connect(dlg, SIGNAL(processFound()), this, SLOT(attachToFoundProcess())); connect(dlg, &UnstartedAppWatcherDialog::processFound, this, &DebuggerPluginPrivate::attachToFoundProcess);
dlg->show(); dlg->show();
} }
@@ -1596,11 +1564,11 @@ void DebuggerPluginPrivate::attachToFoundProcess()
return; return;
if (dlg->hideOnAttach()) if (dlg->hideOnAttach())
connect(rc, SIGNAL(finished()), dlg, SLOT(startWatching())); connect(rc, &RunControl::finished, dlg, &UnstartedAppWatcherDialog::startWatching);
if (dlg->continueOnAttach()) { if (dlg->continueOnAttach()) {
connect(currentEngine(), SIGNAL(stateChanged(Debugger::DebuggerState)), connect(currentEngine(), &DebuggerEngine::stateChanged,
this, SLOT(continueOnAttach(Debugger::DebuggerState))); this, &DebuggerPluginPrivate::continueOnAttach);
} }
} }
@@ -1654,7 +1622,7 @@ DebuggerRunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
return DebuggerRunControlFactory::createAndScheduleRun(sp); return DebuggerRunControlFactory::createAndScheduleRun(sp);
} }
void DebuggerPluginPrivate::attachExternalApplication(RunControl *rc) void DebuggerPlugin::attachExternalApplication(RunControl *rc)
{ {
DebuggerStartParameters sp; DebuggerStartParameters sp;
sp.attachPID = rc->applicationProcessHandle().pid(); sp.attachPID = rc->applicationProcessHandle().pid();
@@ -2385,23 +2353,16 @@ void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
m_statusLabel->showStatusMessage(msg, timeout); m_statusLabel->showStatusMessage(msg, timeout);
} }
void DebuggerPluginPrivate::openMemoryEditor()
{
AddressDialog dialog;
if (dialog.exec() == QDialog::Accepted)
currentEngine()->openMemoryView(dialog.address(), 0, QList<MemoryMarkup>(), QPoint());
}
void DebuggerPluginPrivate::coreShutdown() void DebuggerPluginPrivate::coreShutdown()
{ {
m_shuttingDown = true; m_shuttingDown = true;
} }
const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const const CPlusPlus::Snapshot &cppCodeModelSnapshot()
{ {
if (m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked()) if (dd->m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked())
m_codeModelSnapshot = CppTools::CppModelManager::instance()->snapshot(); dd->m_codeModelSnapshot = CppTools::CppModelManager::instance()->snapshot();
return m_codeModelSnapshot; return dd->m_codeModelSnapshot;
} }
void setSessionValue(const QByteArray &key, const QVariant &value) void setSessionValue(const QByteArray &key, const QVariant &value)
@@ -2414,21 +2375,9 @@ QVariant sessionValue(const QByteArray &key)
return SessionManager::value(QString::fromUtf8(key)); return SessionManager::value(QString::fromUtf8(key));
} }
QTreeView *DebuggerCore::inspectorView() QTreeView *inspectorView()
{ {
return theDebuggerCore->m_inspectorView; return dd->m_inspectorView;
}
void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
const QString &contents)
{
if (m_shuttingDown)
return;
QString titlePattern = titlePattern0;
IEditor *editor = EditorManager::openEditorWithContents(
CC::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents.toUtf8(),
EditorManager::IgnoreNavigationHistory);
QTC_ASSERT(editor, return);
} }
void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int timeout) void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int timeout)
@@ -2459,10 +2408,9 @@ void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int tim
} }
} }
void DebuggerPluginPrivate::createNewDock(QWidget *widget) void createNewDock(QWidget *widget)
{ {
QDockWidget *dockWidget = QDockWidget *dockWidget = dd->m_mainWindow->createDockWidget(CppLanguage, widget);
m_mainWindow->createDockWidget(CppLanguage, widget);
dockWidget->setWindowTitle(widget->windowTitle()); dockWidget->setWindowTitle(widget->windowTitle());
dockWidget->setFeatures(QDockWidget::DockWidgetClosable); dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
dockWidget->show(); dockWidget->show();
@@ -2567,17 +2515,6 @@ void DebuggerPluginPrivate::remoteCommand(const QStringList &options,
runScheduled(); runScheduled();
} }
DebuggerLanguages DebuggerPluginPrivate::activeLanguages() const
{
QTC_ASSERT(m_mainWindow, return AnyLanguage);
return m_mainWindow->activeDebugLanguages();
}
bool DebuggerPluginPrivate::isReverseDebugging() const
{
return m_reverseDirectionAction->isChecked();
}
QMessageBox *showMessageBox(int icon, const QString &title, QMessageBox *showMessageBox(int icon, const QString &title,
const QString &text, int buttons) const QString &text, int buttons)
{ {
@@ -3133,36 +3070,36 @@ void DebuggerPluginPrivate::extensionsInitialized()
// //
// Core // Core
connect(ICore::instance(), SIGNAL(saveSettingsRequested()), SLOT(writeSettings())); connect(ICore::instance(), &ICore::saveSettingsRequested,
this, &DebuggerPluginPrivate::writeSettings);
// TextEditor // TextEditor
connect(TextEditorSettings::instance(), connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), this, &DebuggerPluginPrivate::fontSettingsChanged);
SLOT(fontSettingsChanged(TextEditor::FontSettings)));
// ProjectExplorer // ProjectExplorer
connect(SessionManager::instance(), SIGNAL(sessionLoaded(QString)), connect(SessionManager::instance(), &SessionManager::sessionLoaded,
SLOT(sessionLoaded())); this, &DebuggerPluginPrivate::sessionLoaded);
connect(SessionManager::instance(), SIGNAL(aboutToSaveSession()), connect(SessionManager::instance(), &SessionManager::aboutToSaveSession,
SLOT(aboutToSaveSession())); this, &DebuggerPluginPrivate::aboutToSaveSession);
connect(SessionManager::instance(), SIGNAL(aboutToUnloadSession(QString)), connect(SessionManager::instance(), &SessionManager::aboutToUnloadSession,
SLOT(aboutToUnloadSession())); this, &DebuggerPluginPrivate::aboutToUnloadSession);
connect(ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()), connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
SLOT(updateDebugActions())); this, &DebuggerPluginPrivate::updateDebugActions);
// EditorManager // EditorManager
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)), connect(EditorManager::instance(), &EditorManager::editorOpened,
SLOT(editorOpened(Core::IEditor*))); this, &DebuggerPluginPrivate::editorOpened);
connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
SLOT(updateBreakMenuItem(Core::IEditor*))); this, &DebuggerPluginPrivate::updateBreakMenuItem);
// Application interaction // Application interaction
connect(action(SettingsDialog), SIGNAL(triggered()), connect(action(SettingsDialog), &QAction::triggered,
SLOT(showSettingsDialog())); this, &DebuggerPluginPrivate::showSettingsDialog);
// QML Actions // QML Actions
connect(action(ShowQmlObjectTree), SIGNAL(valueChanged(QVariant)), connect(action(ShowQmlObjectTree), &SavedAction::valueChanged,
SLOT(updateQmlActions())); this, &DebuggerPluginPrivate::updateQmlActions);
updateQmlActions(); updateQmlActions();
// Toolbar // Toolbar
@@ -3189,7 +3126,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_threadBox = new QComboBox; m_threadBox = new QComboBox;
m_threadBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_threadBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
connect(m_threadBox, SIGNAL(activated(int)), SLOT(selectThread(int))); connect(m_threadBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
this, &DebuggerPluginPrivate::selectThread);
hbox->addWidget(m_threadBox); hbox->addWidget(m_threadBox);
hbox->addSpacerItem(new QSpacerItem(4, 0)); hbox->addSpacerItem(new QSpacerItem(4, 0));
@@ -3211,16 +3149,14 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_mainWindow->setToolBar(AnyLanguage, m_statusLabel); m_mainWindow->setToolBar(AnyLanguage, m_statusLabel);
connect(action(EnableReverseDebugging), connect(action(EnableReverseDebugging), &SavedAction::valueChanged,
SIGNAL(valueChanged(QVariant)), this, &DebuggerPluginPrivate::enableReverseDebuggingTriggered);
SLOT(enableReverseDebuggingTriggered(QVariant)));
setInitialState(); setInitialState();
connectEngine(0); connectEngine(0);
connect(SessionManager::instance(), connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, &DebuggerPluginPrivate::onCurrentProjectChanged);
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
m_commonOptionsPage = new CommonOptionsPage(m_globalDebuggerOptions); m_commonOptionsPage = new CommonOptionsPage(m_globalDebuggerOptions);
m_plugin->addAutoReleasedObject(m_commonOptionsPage); m_plugin->addAutoReleasedObject(m_commonOptionsPage);
@@ -3234,37 +3170,36 @@ void DebuggerPluginPrivate::extensionsInitialized()
DebuggerEngine *currentEngine() DebuggerEngine *currentEngine()
{ {
return theDebuggerCore->m_currentEngine; return dd->m_currentEngine;
} }
SavedAction *action(int code) SavedAction *action(int code)
{ {
return theDebuggerCore->m_debuggerSettings->item(code); return dd->m_debuggerSettings->item(code);
} }
bool boolSetting(int code) bool boolSetting(int code)
{ {
return theDebuggerCore->m_debuggerSettings->item(code)->value().toBool(); return dd->m_debuggerSettings->item(code)->value().toBool();
} }
QString stringSetting(int code) QString stringSetting(int code)
{ {
QString raw = theDebuggerCore->m_debuggerSettings->item(code)->value().toString(); QString raw = dd->m_debuggerSettings->item(code)->value().toString();
return globalMacroExpander()->expand(raw); return globalMacroExpander()->expand(raw);
} }
QStringList stringListSetting(int code) QStringList stringListSetting(int code)
{ {
return theDebuggerCore->m_debuggerSettings->item(code)->value().toStringList(); return dd->m_debuggerSettings->item(code)->value().toStringList();
} }
BreakHandler *breakHandler() BreakHandler *breakHandler()
{ {
return theDebuggerCore->m_breakHandler; return dd->m_breakHandler;
} }
void DebuggerPluginPrivate::showModuleSymbols(const QString &moduleName, void showModuleSymbols(const QString &moduleName, const Symbols &symbols)
const Symbols &symbols)
{ {
QTreeWidget *w = new QTreeWidget; QTreeWidget *w = new QTreeWidget;
w->setUniformRowHeights(true); w->setUniformRowHeights(true);
@@ -3274,13 +3209,13 @@ void DebuggerPluginPrivate::showModuleSymbols(const QString &moduleName,
w->setSortingEnabled(true); w->setSortingEnabled(true);
w->setObjectName(QLatin1String("Symbols.") + moduleName); w->setObjectName(QLatin1String("Symbols.") + moduleName);
QStringList header; QStringList header;
header.append(tr("Symbol")); header.append(DebuggerPlugin::tr("Symbol"));
header.append(tr("Address")); header.append(DebuggerPlugin::tr("Address"));
header.append(tr("Code")); header.append(DebuggerPlugin::tr("Code"));
header.append(tr("Section")); header.append(DebuggerPlugin::tr("Section"));
header.append(tr("Name")); header.append(DebuggerPlugin::tr("Name"));
w->setHeaderLabels(header); w->setHeaderLabels(header);
w->setWindowTitle(tr("Symbols in \"%1\"").arg(moduleName)); w->setWindowTitle(DebuggerPlugin::tr("Symbols in \"%1\"").arg(moduleName));
foreach (const Symbol &s, symbols) { foreach (const Symbol &s, symbols) {
QTreeWidgetItem *it = new QTreeWidgetItem; QTreeWidgetItem *it = new QTreeWidgetItem;
it->setData(0, Qt::DisplayRole, s.name); it->setData(0, Qt::DisplayRole, s.name);
@@ -3293,8 +3228,7 @@ void DebuggerPluginPrivate::showModuleSymbols(const QString &moduleName,
createNewDock(w); createNewDock(w);
} }
void DebuggerPluginPrivate::showModuleSections(const QString &moduleName, void showModuleSections(const QString &moduleName, const Sections &sections)
const Sections &sections)
{ {
QTreeWidget *w = new QTreeWidget; QTreeWidget *w = new QTreeWidget;
w->setUniformRowHeights(true); w->setUniformRowHeights(true);
@@ -3304,13 +3238,13 @@ void DebuggerPluginPrivate::showModuleSections(const QString &moduleName,
w->setSortingEnabled(true); w->setSortingEnabled(true);
w->setObjectName(QLatin1String("Sections.") + moduleName); w->setObjectName(QLatin1String("Sections.") + moduleName);
QStringList header; QStringList header;
header.append(tr("Name")); header.append(DebuggerPlugin::tr("Name"));
header.append(tr("From")); header.append(DebuggerPlugin::tr("From"));
header.append(tr("To")); header.append(DebuggerPlugin::tr("To"));
header.append(tr("Address")); header.append(DebuggerPlugin::tr("Address"));
header.append(tr("Flags")); header.append(DebuggerPlugin::tr("Flags"));
w->setHeaderLabels(header); w->setHeaderLabels(header);
w->setWindowTitle(tr("Sections in \"%1\"").arg(moduleName)); w->setWindowTitle(DebuggerPlugin::tr("Sections in \"%1\"").arg(moduleName));
foreach (const Section &s, sections) { foreach (const Section &s, sections) {
QTreeWidgetItem *it = new QTreeWidgetItem; QTreeWidgetItem *it = new QTreeWidgetItem;
it->setData(0, Qt::DisplayRole, s.name); it->setData(0, Qt::DisplayRole, s.name);
@@ -3331,8 +3265,107 @@ void DebuggerPluginPrivate::aboutToShutdown()
this, 0); this, 0);
} }
} // namespace Internal void updateState(DebuggerEngine *engine)
{
dd->updateState(engine);
}
void updateWatchersWindow(bool showWatch, bool showReturn)
{
dd->updateWatchersWindow(showWatch, showReturn);
}
QIcon locationMarkIcon()
{
return dd->m_locationMarkIcon;
}
bool hasSnapshots()
{
return dd->m_snapshotHandler->size();
}
void openTextEditor(const QString &titlePattern0, const QString &contents)
{
if (dd->m_shuttingDown)
return;
QString titlePattern = titlePattern0;
IEditor *editor = EditorManager::openEditorWithContents(
CC::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents.toUtf8(),
EditorManager::IgnoreNavigationHistory);
QTC_ASSERT(editor, return);
}
bool isActiveDebugLanguage(int language)
{
return dd->m_mainWindow->activeDebugLanguages() & language;
}
// void runTest(const QString &fileName);
void showMessage(const QString &msg, int channel, int timeout)
{
dd->showMessage(msg, channel, timeout);
}
bool isReverseDebugging()
{
return dd->m_reverseDirectionAction->isChecked();
}
void runControlStarted(DebuggerEngine *engine)
{
dd->runControlStarted(engine);
}
void runControlFinished(DebuggerEngine *engine)
{
dd->runControlFinished(engine);
}
void displayDebugger(DebuggerEngine *engine, bool updateEngine)
{
dd->displayDebugger(engine, updateEngine);
}
DebuggerLanguages activeLanguages()
{
QTC_ASSERT(dd->m_mainWindow, return AnyLanguage);
return dd->m_mainWindow->activeDebugLanguages();
}
void synchronizeBreakpoints()
{
dd->synchronizeBreakpoints();
}
QWidget *mainWindow()
{
return dd->mainWindow();
}
bool isDockVisible(const QString &objectName)
{
return dd->isDockVisible(objectName);
}
void openMemoryEditor()
{
AddressDialog dialog;
if (dialog.exec() == QDialog::Accepted)
currentEngine()->openMemoryView(dialog.address(), 0, QList<MemoryMarkup>(), QPoint());
}
void setThreads(const QStringList &list, int index)
{
dd->setThreads(list, index);
}
QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions()
{
return dd->m_globalDebuggerOptions;
}
} // namespace Internal
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
@@ -3340,8 +3373,6 @@ void DebuggerPluginPrivate::aboutToShutdown()
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
using namespace Debugger::Internal;
/*! /*!
\class Debugger::DebuggerPlugin \class Debugger::DebuggerPlugin
@@ -3353,13 +3384,14 @@ using namespace Debugger::Internal;
DebuggerPlugin::DebuggerPlugin() DebuggerPlugin::DebuggerPlugin()
{ {
theDebuggerCore = new DebuggerPluginPrivate(this); setObjectName(QLatin1String("DebuggerCore"));
dd = new DebuggerPluginPrivate(this);
} }
DebuggerPlugin::~DebuggerPlugin() DebuggerPlugin::~DebuggerPlugin()
{ {
delete theDebuggerCore; delete dd;
theDebuggerCore = 0; dd = 0;
} }
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage) bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
@@ -3382,25 +3414,25 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
KitManager::registerKitInformation(new DebuggerKitInformation); KitManager::registerKitInformation(new DebuggerKitInformation);
return theDebuggerCore->initialize(arguments, errorMessage); return dd->initialize(arguments, errorMessage);
} }
IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown() IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
{ {
theDebuggerCore->aboutToShutdown(); dd->aboutToShutdown();
return SynchronousShutdown; return SynchronousShutdown;
} }
QObject *DebuggerPlugin::remoteCommand(const QStringList &options, QObject *DebuggerPlugin::remoteCommand(const QStringList &options,
const QStringList &list) const QStringList &list)
{ {
theDebuggerCore->remoteCommand(options, list); dd->remoteCommand(options, list);
return 0; return 0;
} }
void DebuggerPlugin::extensionsInitialized() void DebuggerPlugin::extensionsInitialized()
{ {
theDebuggerCore->extensionsInitialized(); dd->extensionsInitialized();
} }
#ifdef WITH_TESTS #ifdef WITH_TESTS
@@ -3483,7 +3515,7 @@ void DebuggerPluginPrivate::testRunProject(const DebuggerStartParameters &sp, co
{ {
m_testCallbacks.append(cb); m_testCallbacks.append(cb);
RunControl *rc = DebuggerRunControlFactory::createAndScheduleRun(sp); RunControl *rc = DebuggerRunControlFactory::createAndScheduleRun(sp);
connect(rc, SIGNAL(finished()), this, SLOT(testRunControlFinished())); connect(rc, &RunControl::finished, this, &DebuggerPluginPrivate::testRunControlFinished);
} }
void DebuggerPluginPrivate::testRunControlFinished() void DebuggerPluginPrivate::testRunControlFinished()
@@ -3504,7 +3536,7 @@ void DebuggerPluginPrivate::testFinished()
//void DebuggerPlugin::testStateMachine() //void DebuggerPlugin::testStateMachine()
//{ //{
// theDebuggerCore->testStateMachine1(); // dd->testStateMachine1();
//} //}
//void DebuggerPluginPrivate::testStateMachine1() //void DebuggerPluginPrivate::testStateMachine1()
@@ -3539,7 +3571,7 @@ void DebuggerPluginPrivate::testFinished()
void DebuggerPlugin::testBenchmark() void DebuggerPlugin::testBenchmark()
{ {
theDebuggerCore->testBenchmark1(); dd->testBenchmark1();
} }
enum FakeEnum { FakeDebuggerCommonSettingsId }; enum FakeEnum { FakeDebuggerCommonSettingsId };

View File

@@ -34,6 +34,8 @@
#include "debugger_global.h" #include "debugger_global.h"
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
namespace ProjectExplorer { class RunControl; }
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -52,6 +54,7 @@ private:
QObject *remoteCommand(const QStringList &options, const QStringList &arguments); QObject *remoteCommand(const QStringList &options, const QStringList &arguments);
ShutdownFlag aboutToShutdown(); ShutdownFlag aboutToShutdown();
void extensionsInitialized(); void extensionsInitialized();
Q_SLOT void attachExternalApplication(ProjectExplorer::RunControl *rc);
#ifdef WITH_TESTS #ifdef WITH_TESTS
private slots: private slots:

View File

@@ -153,7 +153,7 @@ void DebuggerRunControl::start()
"Affected are breakpoints %1") "Affected are breakpoints %1")
.arg(unhandledIds.join(QLatin1String(", "))); .arg(unhandledIds.join(QLatin1String(", ")));
debuggerCore()->showMessage(warningMessage, LogWarning); Internal::showMessage(warningMessage, LogWarning);
static bool checked = true; static bool checked = true;
if (checked) if (checked)
@@ -165,7 +165,7 @@ void DebuggerRunControl::start()
} }
} }
debuggerCore()->runControlStarted(m_engine); Internal::runControlStarted(m_engine);
// We might get a synchronous startFailed() notification on Windows, // We might get a synchronous startFailed() notification on Windows,
// when launching the process fails. Emit a proper finished() sequence. // when launching the process fails. Emit a proper finished() sequence.
@@ -191,7 +191,7 @@ void DebuggerRunControl::handleFinished()
appendMessage(tr("Debugging has finished") + QLatin1Char('\n'), NormalMessageFormat); appendMessage(tr("Debugging has finished") + QLatin1Char('\n'), NormalMessageFormat);
if (m_engine) if (m_engine)
m_engine->handleFinished(); m_engine->handleFinished();
debuggerCore()->runControlFinished(m_engine); Internal::runControlFinished(m_engine);
} }
bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const
@@ -422,7 +422,7 @@ DebuggerRunControl *DebuggerRunControlFactory::createAndScheduleRun(const Debugg
ProjectExplorerPlugin::showRunErrorMessage(errorMessage); ProjectExplorerPlugin::showRunErrorMessage(errorMessage);
return 0; return 0;
} }
debuggerCore()->showMessage(sp.startMessage, 0); Internal::showMessage(sp.startMessage, 0);
ProjectExplorerPlugin::startRunControl(rc, DebugRunMode); ProjectExplorerPlugin::startRunControl(rc, DebugRunMode);
return rc; return rc;
} }

View File

@@ -1115,7 +1115,7 @@ void DebuggerToolTipManager::showToolTip
tw->acquireEngine(); tw->acquireEngine();
const Utils::WidgetContent widgetContent(tw, true); const Utils::WidgetContent widgetContent(tw, true);
Utils::ToolTip::show(context.mousePosition, widgetContent, debuggerCore()->mainWindow()); Utils::ToolTip::show(context.mousePosition, widgetContent, Internal::mainWindow());
} }
bool DebuggerToolTipManager::eventFilter(QObject *o, QEvent *e) bool DebuggerToolTipManager::eventFilter(QObject *o, QEvent *e)
@@ -1320,7 +1320,7 @@ void DebuggerToolTipManager::slotTooltipOverrideRequested
if (context.expression.isEmpty()) { if (context.expression.isEmpty()) {
const Utils::WidgetContent widgetContent(new QLabel(tr("No valid expression")), true); const Utils::WidgetContent widgetContent(new QLabel(tr("No valid expression")), true);
Utils::ToolTip::show(context.mousePosition, widgetContent, debuggerCore()->mainWindow()); Utils::ToolTip::show(context.mousePosition, widgetContent, Internal::mainWindow());
*handled = true; *handled = true;
return; return;
} }

View File

@@ -117,7 +117,7 @@ DisassemblerAgentPrivate::DisassemblerAgentPrivate()
mimeType(_("text/x-qtcreator-generic-asm")), mimeType(_("text/x-qtcreator-generic-asm")),
resetLocationScheduled(false) resetLocationScheduled(false)
{ {
locationMark.setIcon(debuggerCore()->locationMarkIcon()); locationMark.setIcon(Internal::locationMarkIcon());
locationMark.setPriority(TextMark::HighPriority); locationMark.setPriority(TextMark::HighPriority);
} }

View File

@@ -3049,7 +3049,7 @@ void GdbEngine::handleShowModuleSymbols(const GdbResponse &response)
} }
file.close(); file.close();
file.remove(); file.remove();
debuggerCore()->showModuleSymbols(modulePath, symbols); Internal::showModuleSymbols(modulePath, symbols);
} else { } else {
showMessageBox(QMessageBox::Critical, tr("Cannot Read Symbols"), showMessageBox(QMessageBox::Critical, tr("Cannot Read Symbols"),
tr("Cannot read symbols for module \"%1\".").arg(fileName)); tr("Cannot read symbols for module \"%1\".").arg(fileName));
@@ -3097,7 +3097,7 @@ void GdbEngine::handleShowModuleSections(const GdbResponse &response)
} }
} }
if (!sections.isEmpty()) if (!sections.isEmpty())
debuggerCore()->showModuleSections(moduleName, sections); Internal::showModuleSections(moduleName, sections);
} }
} }
@@ -3555,7 +3555,7 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response)
void GdbEngine::reloadRegisters() void GdbEngine::reloadRegisters()
{ {
if (!debuggerCore()->isDockVisible(_(DOCKWIDGET_REGISTER))) if (!Internal::isDockVisible(_(DOCKWIDGET_REGISTER)))
return; return;
if (state() != InferiorStopOk && state() != InferiorUnrunnable) if (state() != InferiorStopOk && state() != InferiorUnrunnable)
@@ -4250,7 +4250,7 @@ void GdbEngine::startGdb(const QStringList &args)
//showMessage(_("Assuming Qt is installed at %1").arg(qtInstallPath)); //showMessage(_("Assuming Qt is installed at %1").arg(qtInstallPath));
const SourcePathMap sourcePathMap = const SourcePathMap sourcePathMap =
DebuggerSourcePathMappingWidget::mergePlatformQtPath(sp, DebuggerSourcePathMappingWidget::mergePlatformQtPath(sp,
debuggerCore()->globalDebuggerOptions()->sourcePathMap); Internal::globalDebuggerOptions()->sourcePathMap);
const SourcePathMap completeSourcePathMap = const SourcePathMap completeSourcePathMap =
mergeStartParametersSourcePathMap(sp, sourcePathMap); mergeStartParametersSourcePathMap(sp, sourcePathMap);
for (auto it = completeSourcePathMap.constBegin(), cend = completeSourcePathMap.constEnd(); for (auto it = completeSourcePathMap.constBegin(), cend = completeSourcePathMap.constEnd();
@@ -4586,7 +4586,7 @@ void GdbEngine::createFullBacktrace()
void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response) void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
debuggerCore()->openTextEditor(_("Backtrace $"), Internal::openTextEditor(_("Backtrace $"),
_(response.consoleStreamOutput + response.logStreamOutput)); _(response.consoleStreamOutput + response.logStreamOutput));
} }
} }

View File

@@ -466,7 +466,7 @@ void LldbEngine::handleResponse(const QByteArray &response)
void LldbEngine::showFullBacktrace(const GdbMi &data) void LldbEngine::showFullBacktrace(const GdbMi &data)
{ {
debuggerCore()->openTextEditor(_("Backtrace $"), Internal::openTextEditor(_("Backtrace $"),
QString::fromUtf8(QByteArray::fromHex(data.data()))); QString::fromUtf8(QByteArray::fromHex(data.data())));
} }
@@ -805,7 +805,7 @@ void LldbEngine::refreshSymbols(const GdbMi &symbols)
symbol.demangled = item["demangled"].toUtf8(); symbol.demangled = item["demangled"].toUtf8();
syms.append(symbol); syms.append(symbol);
} }
debuggerCore()->showModuleSymbols(moduleName, syms); Internal::showModuleSymbols(moduleName, syms);
} }
@@ -1232,7 +1232,7 @@ void LldbEngine::refreshLocation(const GdbMi &reportedLocation)
void LldbEngine::reloadRegisters() void LldbEngine::reloadRegisters()
{ {
if (debuggerCore()->isDockVisible(QLatin1String(DOCKWIDGET_REGISTER))) if (Internal::isDockVisible(QLatin1String(DOCKWIDGET_REGISTER)))
runCommand("reportRegisters"); runCommand("reportRegisters");
} }

View File

@@ -439,7 +439,7 @@ void PdbEngine::handleListSymbols(const PdbResponse &response)
symbol.name = _(item["name"].data()); symbol.name = _(item["name"].data());
symbols.append(symbol); symbols.append(symbol);
} }
debuggerCore()->showModuleSymbols(moduleName, symbols); Internal::showModuleSymbols(moduleName, symbols);
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@@ -83,7 +83,7 @@ namespace Internal {
static QTreeView *inspectorTreeView() static QTreeView *inspectorTreeView()
{ {
return DebuggerCore::inspectorView(); return Internal::inspectorView();
} }
class ASTWalker : public Visitor class ASTWalker : public Visitor

View File

@@ -214,7 +214,7 @@ void SnapshotHandler::activateSnapshot(int index)
beginResetModel(); beginResetModel();
m_currentIndex = index; m_currentIndex = index;
//qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size(); //qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size();
debuggerCore()->displayDebugger(at(index), true); Internal::displayDebugger(at(index), true);
endResetModel(); endResetModel();
} }

View File

@@ -144,7 +144,7 @@ void SourceAgent::updateLocationMarker()
if (d->engine->stackHandler()->currentFrame().file == d->path) { if (d->engine->stackHandler()->currentFrame().file == d->path) {
int lineNumber = d->engine->stackHandler()->currentFrame().line; int lineNumber = d->engine->stackHandler()->currentFrame().line;
d->locationMark = new TextEditor::TextMark(QString(), lineNumber); d->locationMark = new TextEditor::TextMark(QString(), lineNumber);
d->locationMark->setIcon(debuggerCore()->locationMarkIcon()); d->locationMark->setIcon(Internal::locationMarkIcon());
d->locationMark->setPriority(TextEditor::TextMark::HighPriority); d->locationMark->setPriority(TextEditor::TextMark::HighPriority);
d->editor->textDocument()->addMark(d->locationMark); d->editor->textDocument()->addMark(d->locationMark);
QTextCursor tc = d->editor->textCursor(); QTextCursor tc = d->editor->textCursor();

View File

@@ -356,7 +356,7 @@ void ThreadsHandler::updateThreadBox()
QStringList list; QStringList list;
foreach (const ThreadData &thread, m_threads) foreach (const ThreadData &thread, m_threads)
list.append(QString::fromLatin1("#%1 %2").arg(thread.id.raw()).arg(thread.name)); list.append(QString::fromLatin1("#%1 %2").arg(thread.id.raw()).arg(thread.name));
debuggerCore()->setThreads(list, indexOf(m_currentId)); Internal::setThreads(list, indexOf(m_currentId));
} }
void ThreadsHandler::threadDataChanged(ThreadId id) void ThreadsHandler::threadDataChanged(ThreadId id)

View File

@@ -150,7 +150,7 @@ class SeparatedView : public QTabWidget
Q_OBJECT Q_OBJECT
public: public:
SeparatedView() : QTabWidget(debuggerCore()->mainWindow()) SeparatedView() : QTabWidget(Internal::mainWindow())
{ {
setTabsClosable(true); setTabsClosable(true);
connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int))); connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)));
@@ -1902,7 +1902,7 @@ void WatchHandler::updateWatchersWindow()
return; return;
previousShowWatch = showWatch; previousShowWatch = showWatch;
previousShowReturn = showReturn; previousShowReturn = showReturn;
debuggerCore()->updateWatchersWindow(showWatch, showReturn); Internal::updateWatchersWindow(showWatch, showReturn);
} }
QStringList WatchHandler::watchedExpressions() QStringList WatchHandler::watchedExpressions()

View File

@@ -956,7 +956,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
copyToClipboard(mi1.data().toString()); copyToClipboard(mi1.data().toString());
} else if (act == &actShowInEditor) { } else if (act == &actShowInEditor) {
QString contents = handler->editorContents(); QString contents = handler->editorContents();
debuggerCore()->openTextEditor(tr("Locals & Expressions"), contents); Internal::openTextEditor(tr("Locals & Expressions"), contents);
} else if (act == &actCloseEditorToolTips) { } else if (act == &actCloseEditorToolTips) {
DebuggerToolTipManager::closeAllToolTips(); DebuggerToolTipManager::closeAllToolTips();
} }