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

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