diff options
author | hjk <[email protected]> | 2015-05-27 13:59:56 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2015-05-28 08:54:48 +0000 |
commit | 244cdb7804e7e45f235836d4656644d5bf9135ee (patch) | |
tree | e64714447f4df3d547340abab29845e3142804b9 /src/plugins/debugger | |
parent | 28d2b1616541eee4ab0e06e89c7e8cab04bd9961 (diff) |
Debugger: Split off runtime-only items from DebuggerStartParameters
Right now, DebuggerStartParameter is part of the debugger plugin
external interface. Better not make it fatter than necessary.
Change-Id: I3b9205089f971dd314ccba1335b5ca2d4d9fe7c6
Reviewed-by: Christian Stenger <[email protected]>
Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/plugins/debugger')
36 files changed, 543 insertions, 516 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index c785d8c96da..0e044eaa815 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -187,7 +187,7 @@ Q_DECLARE_METATYPE(Debugger::Internal::MemoryChangeCookie) namespace Debugger { namespace Internal { -static inline bool isCreatorConsole(const DebuggerStartParameters &sp) +static inline bool isCreatorConsole(const DebuggerRunParameters &sp) { return !boolSetting(UseCdbConsole) && sp.useTerminal && (sp.startMode == StartInternal || sp.startMode == StartExternal); @@ -267,7 +267,7 @@ static inline bool validMode(DebuggerStartMode sm) } // Accessed by RunControlFactory -DebuggerEngine *createCdbEngine(const DebuggerStartParameters &sp, QString *errorMessage) +DebuggerEngine *createCdbEngine(const DebuggerRunParameters &sp, QString *errorMessage) { if (HostOsInfo::isWindowsHost()) { if (validMode(sp.startMode)) @@ -289,7 +289,7 @@ void addCdbOptionPages(QList<Core::IOptionsPage *> *opts) #define QT_CREATOR_CDB_EXT "qtcreatorcdbext" -CdbEngine::CdbEngine(const DebuggerStartParameters &sp) : +CdbEngine::CdbEngine(const DebuggerRunParameters &sp) : DebuggerEngine(sp), m_tokenPrefix("<token>"), m_effectiveStartMode(NoStartMode), @@ -472,7 +472,7 @@ int CdbEngine::elapsedLogTime() const } // Start the console stub with the sub process. Continue in consoleStubProcessStarted. -bool CdbEngine::startConsole(const DebuggerStartParameters &sp, QString *errorMessage) +bool CdbEngine::startConsole(const DebuggerRunParameters &sp, QString *errorMessage) { if (debug) qDebug("startConsole %s", qPrintable(sp.executable)); @@ -513,7 +513,7 @@ void CdbEngine::consoleStubProcessStarted() if (debug) qDebug("consoleStubProcessStarted() PID=%lld", m_consoleStub->applicationPID()); // Attach to console process. - DebuggerStartParameters attachParameters = startParameters(); + DebuggerRunParameters attachParameters = runParameters(); attachParameters.executable.clear(); attachParameters.processArgs.clear(); attachParameters.attachPID = m_consoleStub->applicationPID(); @@ -560,12 +560,12 @@ void CdbEngine::setupEngine() // CDB in theory has a command line option '-2' that launches a // console, too, but that immediately closes when the debuggee quits. // Use the Creator stub instead. - const DebuggerStartParameters &sp = startParameters(); - const bool launchConsole = isCreatorConsole(sp); - m_effectiveStartMode = launchConsole ? AttachExternal : sp.startMode; + const DebuggerRunParameters &rp = runParameters(); + const bool launchConsole = isCreatorConsole(rp); + m_effectiveStartMode = launchConsole ? AttachExternal : rp.startMode; const bool ok = launchConsole ? - startConsole(startParameters(), &errorMessage) : - launchCDB(startParameters(), &errorMessage); + startConsole(runParameters(), &errorMessage) : + launchCDB(runParameters(), &errorMessage); if (debug) qDebug("<setupEngine ok=%d", ok); if (!ok) { @@ -593,7 +593,7 @@ void CdbEngine::setupEngine() wh->addTypeFormats("QImage *", imageFormats); } -bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessage) +bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage) { if (debug) qDebug("launchCDB startMode=%d", sp.startMode); @@ -662,7 +662,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa if (sp.startMode == AttachCrashedExternal) { arguments << QLatin1String("-e") << sp.crashParameter << QLatin1String("-g"); } else { - if (isCreatorConsole(startParameters())) + if (isCreatorConsole(runParameters())) arguments << QLatin1String("-pr") << QLatin1String("-pb"); } break; @@ -725,13 +725,13 @@ void CdbEngine::setupInferior() { if (debug) qDebug("setupInferior"); - const DebuggerStartParameters &sp = startParameters(); - if (!sp.commandsAfterConnect.isEmpty()) - postCommand(sp.commandsAfterConnect, 0); + const DebuggerRunParameters &rp = runParameters(); + if (!rp.commandsAfterConnect.isEmpty()) + postCommand(rp.commandsAfterConnect, 0); // QmlCppEngine expects the QML engine to be connected before any breakpoints are hit // (attemptBreakpointSynchronization() will be directly called then) attemptBreakpointSynchronization(); - if (sp.breakOnMain) { + if (rp.breakOnMain) { const BreakpointParameters bp(BreakpointAtMain); postBuiltinCommand(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(quint16(-1)), true), 0, @@ -790,7 +790,7 @@ void CdbEngine::runEngine() // Break functions: each function must be fully qualified, // else the debugger will slow down considerably. if (boolSetting(CdbBreakOnCrtDbgReport)) { - const QByteArray module = msvcRunTime(startParameters().toolChainAbi.osFlavor()); + const QByteArray module = msvcRunTime(runParameters().toolChainAbi.osFlavor()); const QByteArray debugModule = module + 'D'; const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W'); postBuiltinCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, module), 0, @@ -814,7 +814,7 @@ void CdbEngine::runEngine() postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::fatal", 0, CB(handleBreakInsert)); } - if (startParameters().startMode == AttachCore) { + if (runParameters().startMode == AttachCore) { QTC_ASSERT(!m_coreStopReason.isNull(), return; ); notifyEngineRunOkAndInferiorUnrunnable(); processStop(*m_coreStopReason, false); @@ -843,7 +843,7 @@ void CdbEngine::shutdownInferior() } if (m_accessible) { // except console. - if (startParameters().startMode == AttachExternal || startParameters().startMode == AttachCrashedExternal) + if (runParameters().startMode == AttachExternal || runParameters().startMode == AttachCrashedExternal) detachDebugger(); STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorShutdownOk") notifyInferiorShutdownOk(); @@ -892,7 +892,7 @@ void CdbEngine::shutdownEngine() // Go for kill if there are commands pending. if (m_accessible && !commandsPending()) { // detach (except console): Wait for debugger to finish. - if (startParameters().startMode == AttachExternal || startParameters().startMode == AttachCrashedExternal) + if (runParameters().startMode == AttachExternal || runParameters().startMode == AttachCrashedExternal) detachDebugger(); // Remote requires a bit more force to quit. if (m_effectiveStartMode == AttachToRemoteServer) { @@ -1130,13 +1130,13 @@ void CdbEngine::doInterruptInferior(SpecialStopMode sm) showMessage(QString::fromLatin1("Interrupting process %1...").arg(inferiorPid()), LogMisc); QTC_ASSERT(!m_signalOperation, notifyInferiorStopFailed(); return;); - m_signalOperation = startParameters().device->signalOperation(); + m_signalOperation = runParameters().device->signalOperation(); m_specialStopMode = sm; QTC_ASSERT(m_signalOperation, notifyInferiorStopFailed(); return;); connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished, this, &CdbEngine::handleDoInterruptInferior); - m_signalOperation->setDebuggerCommand(startParameters().debuggerCommand); + m_signalOperation->setDebuggerCommand(runParameters().debuggerCommand); m_signalOperation->interruptProcess(inferiorPid()); } @@ -1199,7 +1199,7 @@ void CdbEngine::jumpToAddress(quint64 address) QByteArray registerCmd; ByteArrayInputStream str(registerCmd); // PC-register depending on 64/32bit. - str << "r " << (startParameters().toolChainAbi.wordWidth() == 64 ? "rip" : "eip") << '='; + str << "r " << (runParameters().toolChainAbi.wordWidth() == 64 ? "rip" : "eip") << '='; str.setHexPrefix(true); str.setIntegerBase(16); str << address; @@ -1755,7 +1755,7 @@ void CdbEngine::handlePid(const CdbResponse &response) // Fails for core dumps. if (response.success) notifyInferiorPid(response.extensionReply.toULongLong()); - if (response.success || startParameters().startMode == AttachCore) { + if (response.success || runParameters().startMode == AttachCore) { STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupOk") notifyInferiorSetupOk(); } else { @@ -2083,7 +2083,7 @@ void CdbEngine::handleSessionIdle(const QByteArray &messageBA) STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk") notifyEngineSetupOk(); // Store stop reason to be handled in runEngine(). - if (startParameters().startMode == AttachCore) { + if (runParameters().startMode == AttachCore) { m_coreStopReason.reset(new GdbMi); m_coreStopReason->fromString(messageBA); } @@ -2117,7 +2117,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT } // Notify about state and send off command sequence to get stack, etc. if (stopFlags & StopNotifyStop) { - if (startParameters().startMode != AttachCore) { + if (runParameters().startMode != AttachCore) { if (state() == InferiorStopRequested) { STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk") notifyInferiorStopOk(); @@ -3003,7 +3003,7 @@ void CdbEngine::handleAdditionalQmlStack(const CdbResponse &response) break; } for (int i = 0; i < qmlFrameCount; ++i) - qmlFrames[i].fixQmlFrame(startParameters()); + qmlFrames[i].fixQmlFrame(runParameters()); stackHandler()->prependFrames(qmlFrames); } while (false); if (!errorMessage.isEmpty()) @@ -3012,9 +3012,9 @@ void CdbEngine::handleAdditionalQmlStack(const CdbResponse &response) void CdbEngine::mergeStartParametersSourcePathMap() { - const DebuggerStartParameters &sp = startParameters(); - QMap<QString, QString>::const_iterator end = sp.sourcePathMap.end(); - for (QMap<QString, QString>::const_iterator it = sp.sourcePathMap.begin(); it != end; ++it) { + const DebuggerRunParameters &rp = runParameters(); + QMap<QString, QString>::const_iterator end = rp.sourcePathMap.end(); + for (QMap<QString, QString>::const_iterator it = rp.sourcePathMap.begin(); it != end; ++it) { SourcePathMapping spm(QDir::toNativeSeparators(it.key()), QDir::toNativeSeparators(it.value())); if (!m_sourcePathMappings.contains(spm)) m_sourcePathMappings.push_back(spm); diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 778b29f2619..290c50be049 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -73,7 +73,7 @@ public: typedef QSharedPointer<CdbCommand> CdbCommandPtr; typedef std::function<void(const CdbResponse &)> CommandHandler; - CdbEngine(const DebuggerStartParameters &sp); + CdbEngine(const DebuggerRunParameters &sp); ~CdbEngine(); // Factory function that returns 0 if the debug engine library cannot be found. @@ -187,7 +187,7 @@ private: }; - bool startConsole(const DebuggerStartParameters &sp, QString *errorMessage); + bool startConsole(const DebuggerRunParameters &sp, QString *errorMessage); void init(); unsigned examineStopReason(const GdbMi &stopReason, QString *message, QString *exceptionBoxMessage, @@ -196,7 +196,7 @@ private: bool commandsPending() const; void handleExtensionMessage(char t, int token, const QByteArray &what, const QByteArray &message); bool doSetupEngine(QString *errorMessage); - bool launchCDB(const DebuggerStartParameters &sp, QString *errorMessage); + bool launchCDB(const DebuggerRunParameters &sp, QString *errorMessage); void handleSessionAccessible(unsigned long cdbExState); void handleSessionInaccessible(unsigned long cdbExState); void handleSessionIdle(const QByteArray &message); diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index d622e6da71f..34b59bbb4f6 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -358,9 +358,9 @@ void StartApplicationDialog::updateState() d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(okEnabled); } -bool StartApplicationDialog::run(QWidget *parent, DebuggerStartParameters *sp) +bool StartApplicationDialog::run(QWidget *parent, DebuggerRunParameters *rp) { - const bool attachRemote = sp->startMode == AttachToRemoteServer; + const bool attachRemote = rp->startMode == AttachToRemoteServer; const QString settingsGroup = QLatin1String("DebugMode"); const QString arrayName = QLatin1String("StartApplication"); @@ -411,29 +411,29 @@ bool StartApplicationDialog::run(QWidget *parent, DebuggerStartParameters *sp) Kit *kit = dialog.d->kitChooser->currentKit(); QTC_ASSERT(kit, return false); - bool res = DebuggerRunControlFactory::fillParametersFromKit(sp, kit); + bool res = fillParametersFromKit(rp, kit); QTC_ASSERT(res, return false); - sp->executable = newParameters.localExecutable; + rp->executable = newParameters.localExecutable; const QString inputAddress = dialog.d->serverAddressEdit->text(); if (!inputAddress.isEmpty()) - sp->remoteChannel = inputAddress; + rp->remoteChannel = inputAddress; else - sp->remoteChannel = sp->connParams.host; - sp->remoteChannel += QLatin1Char(':') + QString::number(newParameters.serverPort); - sp->displayName = newParameters.displayName(); - sp->workingDirectory = newParameters.workingDirectory; - sp->useTerminal = newParameters.runInTerminal; + rp->remoteChannel = rp->connParams.host; + rp->remoteChannel += QLatin1Char(':') + QString::number(newParameters.serverPort); + rp->displayName = newParameters.displayName(); + rp->workingDirectory = newParameters.workingDirectory; + rp->useTerminal = newParameters.runInTerminal; if (!newParameters.processArgs.isEmpty()) - sp->processArgs = newParameters.processArgs; - sp->breakOnMain = newParameters.breakAtMain; - sp->serverStartScript = newParameters.serverStartScript; - sp->debugInfoLocation = newParameters.debugInfoLocation; + rp->processArgs = newParameters.processArgs; + rp->breakOnMain = newParameters.breakAtMain; + rp->serverStartScript = newParameters.serverStartScript; + rp->debugInfoLocation = newParameters.debugInfoLocation; IDevice::ConstPtr dev = DeviceKitInformation::device(kit); bool isLocal = !dev || (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); if (!attachRemote) - sp->startMode = isLocal ? StartExternal : StartRemoteProcess; + rp->startMode = isLocal ? StartExternal : StartRemoteProcess; return true; } diff --git a/src/plugins/debugger/debuggerdialogs.h b/src/plugins/debugger/debuggerdialogs.h index 9b0ddc4673b..5503944df78 100644 --- a/src/plugins/debugger/debuggerdialogs.h +++ b/src/plugins/debugger/debuggerdialogs.h @@ -50,13 +50,11 @@ namespace Core { class Id; } namespace ProjectExplorer { class Kit; } namespace Debugger { -class DebuggerStartParameters; - namespace Internal { class AttachCoreDialogPrivate; class AttachToQmlPortDialogPrivate; -class ProcessListFilterModel; +class DebuggerRunParameters; class StartApplicationParameters; class StartApplicationDialogPrivate; class StartRemoteEngineDialogPrivate; @@ -87,7 +85,7 @@ public: explicit StartApplicationDialog(QWidget *parent); ~StartApplicationDialog(); - static bool run(QWidget *parent, DebuggerStartParameters *sp); + static bool run(QWidget *parent, DebuggerRunParameters *rp); private slots: void historyIndexChanged(int); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index a2d293be670..c63490d230f 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -94,7 +94,7 @@ enum { debug = 0 }; /////////////////////////////////////////////////////////////////////// // -// DebuggerStartParameters +// DebuggerRunParameters // /////////////////////////////////////////////////////////////////////// @@ -109,7 +109,7 @@ QDebug operator<<(QDebug d, DebuggerState state) return d << DebuggerEngine::stateName(state); } -QDebug operator<<(QDebug str, const DebuggerStartParameters &sp) +QDebug operator<<(QDebug str, const DebuggerRunParameters &sp) { QDebug nospace = str.nospace(); nospace << "executable=" << sp.executable @@ -166,11 +166,11 @@ class DebuggerEnginePrivate : public QObject Q_OBJECT public: - DebuggerEnginePrivate(DebuggerEngine *engine, const DebuggerStartParameters &sp) + DebuggerEnginePrivate(DebuggerEngine *engine, const DebuggerRunParameters &sp) : m_engine(engine), m_masterEngine(0), m_runControl(0), - m_startParameters(sp), + m_runParameters(sp), m_state(DebuggerNotReady), m_lastGoodState(DebuggerNotReady), m_targetState(DebuggerNotReady), @@ -195,7 +195,7 @@ public: Utils::globalMacroExpander()->registerFileVariables(PrefixDebugExecutable, tr("Debugged executable"), - [this]() { return m_startParameters.executable; }); + [this]() { return m_runParameters.executable; }); } public slots: @@ -298,7 +298,7 @@ public: DebuggerEngine *m_masterEngine; // Not owned DebuggerRunControl *m_runControl; // Not owned. - DebuggerStartParameters m_startParameters; + DebuggerRunParameters m_runParameters; // The current state. DebuggerState m_state; @@ -342,7 +342,7 @@ public: // ////////////////////////////////////////////////////////////////////// -DebuggerEngine::DebuggerEngine(const DebuggerStartParameters &startParameters) +DebuggerEngine::DebuggerEngine(const DebuggerRunParameters &startParameters) : d(new DebuggerEnginePrivate(this, startParameters)) {} @@ -543,13 +543,13 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) d->m_runControl = runControl; - d->m_inferiorPid = d->m_startParameters.attachPID > 0 - ? d->m_startParameters.attachPID : 0; + d->m_inferiorPid = d->m_runParameters.attachPID > 0 + ? d->m_runParameters.attachPID : 0; if (d->m_inferiorPid) d->m_runControl->setApplicationProcessHandle(ProcessHandle(d->m_inferiorPid)); - if (!d->m_startParameters.environment.size()) - d->m_startParameters.environment = Utils::Environment(); + if (!d->m_runParameters.environment.size()) + d->m_runParameters.environment = Utils::Environment(); action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability)); @@ -641,14 +641,14 @@ void DebuggerEngine::handleFinished() watchHandler()->cleanup(); } -const DebuggerStartParameters &DebuggerEngine::startParameters() const +const DebuggerRunParameters &DebuggerEngine::runParameters() const { - return d->m_startParameters; + return d->m_runParameters; } -DebuggerStartParameters &DebuggerEngine::startParameters() +DebuggerRunParameters &DebuggerEngine::runParameters() { - return d->m_startParameters; + return d->m_runParameters; } DebuggerState DebuggerEngine::state() const @@ -751,7 +751,7 @@ void DebuggerEnginePrivate::doSetupEngine() { m_engine->showMessage(_("CALL: SETUP ENGINE")); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << m_engine << state()); - m_engine->validateExecutable(&m_startParameters); + m_engine->validateExecutable(&m_runParameters); m_engine->setupEngine(); } @@ -895,20 +895,20 @@ void DebuggerEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &re d->setRemoteSetupState(RemoteSetupSucceeded); if (result.gdbServerPort != InvalidPid) { - QString &rc = d->m_startParameters.remoteChannel; + QString &rc = d->m_runParameters.remoteChannel; const int sepIndex = rc.lastIndexOf(QLatin1Char(':')); if (sepIndex != -1) { rc.replace(sepIndex + 1, rc.count() - sepIndex - 1, QString::number(result.gdbServerPort)); } - } else if (result.inferiorPid != InvalidPid && startParameters().startMode == AttachExternal) { + } else if (result.inferiorPid != InvalidPid && runParameters().startMode == AttachExternal) { // e.g. iOS Simulator - startParameters().attachPID = result.inferiorPid; + runParameters().attachPID = result.inferiorPid; } if (result.qmlServerPort != InvalidPort) { - d->m_startParameters.qmlServerPort = result.qmlServerPort; - d->m_startParameters.processArgs.replace(_("%qml_port%"), QString::number(result.qmlServerPort)); + d->m_runParameters.qmlServerPort = result.qmlServerPort; + d->m_runParameters.processArgs.replace(_("%qml_port%"), QString::number(result.qmlServerPort)); } } else { @@ -1308,11 +1308,11 @@ DebuggerEngine *DebuggerEngine::masterEngine() const QString DebuggerEngine::toFileInProject(const QUrl &fileUrl) { // make sure file finder is properly initialized - const DebuggerStartParameters &sp = startParameters(); - d->m_fileFinder.setProjectDirectory(sp.projectSourceDirectory); - d->m_fileFinder.setProjectFiles(sp.projectSourceFiles); - d->m_fileFinder.setAdditionalSearchDirectories(sp.additionalSearchDirectories); - d->m_fileFinder.setSysroot(sp.sysRoot); + const DebuggerRunParameters &rp = runParameters(); + d->m_fileFinder.setProjectDirectory(rp.projectSourceDirectory); + d->m_fileFinder.setProjectFiles(rp.projectSourceFiles); + d->m_fileFinder.setAdditionalSearchDirectories(rp.additionalSearchDirectories); + d->m_fileFinder.setSysroot(rp.sysRoot); return d->m_fileFinder.findFile(fileUrl); } @@ -1362,9 +1362,9 @@ void DebuggerEngine::notifyInferiorPid(qint64 pid) d->m_inferiorPid = pid; if (pid) { showMessage(tr("Taking notice of pid %1").arg(pid)); - if (d->m_startParameters.startMode == StartInternal - || d->m_startParameters.startMode == StartExternal - || d->m_startParameters.startMode == AttachExternal) + if (d->m_runParameters.startMode == StartInternal + || d->m_runParameters.startMode == StartExternal + || d->m_runParameters.startMode == AttachExternal) QTimer::singleShot(0, d, SLOT(raiseApplication())); } } @@ -1793,7 +1793,7 @@ void DebuggerEngine::setStateDebugging(bool on) d->m_isStateDebugging = on; } -void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp) +void DebuggerEngine::validateExecutable(DebuggerRunParameters *sp) { if (sp->skipExecutableValidation) return; @@ -1980,6 +1980,17 @@ void DebuggerEngine::updateLocalsView(const GdbMi &all) emit stackFrameCompleted(); } +DebuggerRunParameters::DebuggerRunParameters() + : cppEngineType(NoEngineType), + isSnapshot(false), + testCase(0) +{} + +void DebuggerRunParameters::operator=(const DebuggerStartParameters &sp) +{ + DebuggerStartParameters::operator=(sp); +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 33b943e6cc6..b3670a8ea30 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -33,6 +33,9 @@ #include "debugger_global.h" #include "debuggerconstants.h" +#include "debuggerstartparameters.h" + +#include <projectexplorer/devicesupport/idevice.h> #include <QObject> #include <QProcess> @@ -43,16 +46,13 @@ class QPoint; class QAbstractItemModel; QT_END_NAMESPACE -namespace TextEditor { class TextEditorWidget; } namespace Core { class IOptionsPage; } namespace Debugger { class DebuggerRunControl; -class DebuggerStartParameters; class RemoteSetupResult; -DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &); DEBUGGER_EXPORT QDebug operator<<(QDebug str, DebuggerState state); namespace Internal { @@ -80,6 +80,34 @@ class MemoryViewSetupData; class Terminal; class ThreadId; +class DebuggerRunParameters : public DebuggerStartParameters +{ +public: + DebuggerRunParameters(); + + void operator=(const DebuggerStartParameters &sp); + + QString coreFile; + QString overrideStartScript; // Used in attach to core and remote debugging + QString startMessage; // First status message shown. + DebuggerEngineType cppEngineType; + QByteArray remoteSourcesDir; + QString remoteMountPoint; + QMap<QString, QString> sourcePathMap; + QString debugInfoLocation; // Gdb "set-debug-file-directory". + QStringList debugSourceLocation; // Gdb "directory" + QString serverStartScript; + QString localMountDir; + ProjectExplorer::IDevice::ConstPtr device; + bool isSnapshot; // Set if created internally. + + // Used by AttachCrashedExternal. + QString crashParameter; + + // For Debugger testing. + int testCase; +}; + class Location { public: @@ -133,11 +161,11 @@ class DebuggerEngine : public QObject Q_OBJECT public: - explicit DebuggerEngine(const DebuggerStartParameters &sp); + explicit DebuggerEngine(const DebuggerRunParameters &sp); virtual ~DebuggerEngine(); - const DebuggerStartParameters &startParameters() const; - DebuggerStartParameters &startParameters(); + const DebuggerRunParameters &runParameters() const; + DebuggerRunParameters &runParameters(); virtual bool setToolTipExpression(const Internal::DebuggerToolTipContext &); @@ -366,7 +394,7 @@ protected: bool isStateDebugging() const; void setStateDebugging(bool on); - static void validateExecutable(DebuggerStartParameters *sp); + static void validateExecutable(DebuggerRunParameters *sp); virtual void setupSlaveInferior(); virtual void setupSlaveEngine(); @@ -390,6 +418,16 @@ private: DebuggerEnginePrivate *d; }; +DebuggerEngine *createEngine(DebuggerEngineType et, const DebuggerRunParameters &rp, QString *errorMessage); + +bool fillParametersFromKit(DebuggerRunParameters *r, const ProjectExplorer::Kit *kit, QString *errorMessage = 0); + +bool fillParametersFromLocalRunConfiguration(DebuggerRunParameters *rp, + const ProjectExplorer::RunConfiguration *runConfig, QString *errorMessage = 0); + +DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp); + + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index b1c01f2b3d2..3c66453afa0 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -443,7 +443,7 @@ static QToolButton *toolButton(Id id) class DummyEngine : public DebuggerEngine { public: - DummyEngine() : DebuggerEngine(DebuggerStartParameters()) {} + DummyEngine() : DebuggerEngine(DebuggerRunParameters()) {} ~DummyEngine() {} void setupEngine() {} @@ -757,7 +757,7 @@ public slots: void testUnloadProject(); void testFinished(); - void testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb); + void testRunProject(const DebuggerRunParameters &sp, const TestCallBack &cb); void testRunControlFinished(); // void testStateMachine1(); @@ -957,7 +957,7 @@ public: DebuggerRunControlFactory *m_debuggerRunControlFactory; Id m_previousMode; - QList<DebuggerStartParameters> m_scheduledStarts; + QList<DebuggerRunParameters> m_scheduledStarts; ProxyAction *m_visibleStartAction; ProxyAction *m_hiddenStopAction; @@ -1054,7 +1054,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) : { qRegisterMetaType<WatchData>("WatchData"); qRegisterMetaType<ContextData>("ContextData"); - qRegisterMetaType<DebuggerStartParameters>("DebuggerStartParameters"); + qRegisterMetaType<DebuggerRunParameters>("DebuggerRunParameters"); QTC_CHECK(!dd); dd = this; @@ -1143,16 +1143,16 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, return false; } Kit *kit = 0; - DebuggerStartParameters sp; + DebuggerRunParameters rp; qulonglong pid = it->toULongLong(); if (pid) { - sp.startMode = AttachExternal; - sp.closeMode = DetachAtClose; - sp.attachPID = pid; - sp.displayName = tr("Process %1").arg(sp.attachPID); - sp.startMessage = tr("Attaching to local process %1.").arg(sp.attachPID); + rp.startMode = AttachExternal; + rp.closeMode = DetachAtClose; + rp.attachPID = pid; + rp.displayName = tr("Process %1").arg(rp.attachPID); + rp.startMessage = tr("Attaching to local process %1.").arg(rp.attachPID); } else { - sp.startMode = StartExternal; + rp.startMode = StartExternal; QStringList args = it->split(QLatin1Char(',')); foreach (const QString &arg, args) { QString key = arg.section(QLatin1Char('='), 0, 0); @@ -1160,36 +1160,36 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, if (val.isEmpty()) { if (key.isEmpty()) { continue; - } else if (sp.executable.isEmpty()) { - sp.executable = key; + } else if (rp.executable.isEmpty()) { + rp.executable = key; } else { *errorMessage = DebuggerPlugin::tr("Only one executable allowed."); return false; } } if (key == QLatin1String("server")) { - sp.startMode = AttachToRemoteServer; - sp.remoteChannel = val; - sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel); - sp.startMessage = tr("Attaching to remote server %1.").arg(sp.remoteChannel); + rp.startMode = AttachToRemoteServer; + rp.remoteChannel = val; + rp.displayName = tr("Remote: \"%1\"").arg(rp.remoteChannel); + rp.startMessage = tr("Attaching to remote server %1.").arg(rp.remoteChannel); } else if (key == QLatin1String("core")) { - sp.startMode = AttachCore; - sp.closeMode = DetachAtClose; - sp.coreFile = val; - sp.displayName = tr("Core file \"%1\"").arg(sp.coreFile); - sp.startMessage = tr("Attaching to core file %1.").arg(sp.coreFile); + rp.startMode = AttachCore; + rp.closeMode = DetachAtClose; + rp.coreFile = val; + rp.displayName = tr("Core file \"%1\"").arg(rp.coreFile); + rp.startMessage = tr("Attaching to core file %1.").arg(rp.coreFile); } else if (key == QLatin1String("kit")) { kit = KitManager::find(Id::fromString(val)); } } } - if (!DebuggerRunControlFactory::fillParametersFromKit(&sp, kit, errorMessage)) + if (!fillParametersFromKit(&rp, kit, errorMessage)) return false; - if (sp.startMode == StartExternal) { - sp.displayName = tr("Executable file \"%1\"").arg(sp.executable); - sp.startMessage = tr("Debugging file %1.").arg(sp.executable); + if (rp.startMode == StartExternal) { + rp.displayName = tr("Executable file \"%1\"").arg(rp.executable); + rp.startMessage = tr("Debugging file %1.").arg(rp.executable); } - m_scheduledStarts.append(sp); + m_scheduledStarts.append(rp); return true; } // -wincrashevent <event-handle>:<pid>. A handle used for @@ -1203,20 +1203,20 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, *errorMessage = msgParameterMissing(*it); return false; } - DebuggerStartParameters sp; - if (!DebuggerRunControlFactory::fillParametersFromKit(&sp, findUniversalCdbKit(), errorMessage)) + DebuggerRunParameters rp; + if (!fillParametersFromKit(&rp, findUniversalCdbKit(), errorMessage)) return false; - sp.startMode = AttachCrashedExternal; - sp.crashParameter = it->section(QLatin1Char(':'), 0, 0); - sp.attachPID = it->section(QLatin1Char(':'), 1, 1).toULongLong(); - sp.displayName = tr("Crashed process %1").arg(sp.attachPID); - sp.startMessage = tr("Attaching to crashed process %1").arg(sp.attachPID); - if (!sp.attachPID) { + rp.startMode = AttachCrashedExternal; + rp.crashParameter = it->section(QLatin1Char(':'), 0, 0); + rp.attachPID = it->section(QLatin1Char(':'), 1, 1).toULongLong(); + rp.displayName = tr("Crashed process %1").arg(rp.attachPID); + rp.startMessage = tr("Attaching to crashed process %1").arg(rp.attachPID); + if (!rp.attachPID) { *errorMessage = DebuggerPlugin::tr("The parameter \"%1\" of option \"%2\" " "does not match the pattern <handle>:<pid>.").arg(*it, option); return false; } - m_scheduledStarts.append(sp); + m_scheduledStarts.append(rp); return true; } @@ -1319,9 +1319,9 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project) void DebuggerPluginPrivate::startAndDebugApplication() { - DebuggerStartParameters sp; - if (StartApplicationDialog::run(ICore::dialogParent(), &sp)) - DebuggerRunControlFactory::createAndScheduleRun(sp); + DebuggerRunParameters rp; + if (StartApplicationDialog::run(ICore::dialogParent(), &rp)) + createAndScheduleRun(rp); } void DebuggerPluginPrivate::attachCore() @@ -1348,29 +1348,29 @@ void DebuggerPluginPrivate::attachCore() setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile()); QString display = dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile(); - DebuggerStartParameters sp; - bool res = DebuggerRunControlFactory::fillParametersFromKit(&sp, dlg.kit()); + DebuggerRunParameters rp; + bool res = fillParametersFromKit(&rp, dlg.kit()); QTC_ASSERT(res, return); - sp.masterEngineType = DebuggerKitInformation::engineType(dlg.kit()); - sp.executable = dlg.localExecutableFile(); - sp.coreFile = dlg.localCoreFile(); - sp.displayName = tr("Core file \"%1\"").arg(display); - sp.startMode = AttachCore; - sp.closeMode = DetachAtClose; - sp.overrideStartScript = dlg.overrideStartScript(); - DebuggerRunControlFactory::createAndScheduleRun(sp); + rp.masterEngineType = DebuggerKitInformation::engineType(dlg.kit()); + rp.executable = dlg.localExecutableFile(); + rp.coreFile = dlg.localCoreFile(); + rp.displayName = tr("Core file \"%1\"").arg(display); + rp.startMode = AttachCore; + rp.closeMode = DetachAtClose; + rp.overrideStartScript = dlg.overrideStartScript(); + createAndScheduleRun(rp); } void DebuggerPluginPrivate::startRemoteCdbSession() { const QByteArray connectionKey = "CdbRemoteConnection"; - DebuggerStartParameters sp; + DebuggerRunParameters rp; Kit *kit = findUniversalCdbKit(); QTC_ASSERT(kit, return); - bool res = DebuggerRunControlFactory::fillParametersFromKit(&sp, kit); + bool res = fillParametersFromKit(&rp, kit); QTC_ASSERT(res, return); - sp.startMode = AttachToRemoteServer; - sp.closeMode = KillAtClose; + rp.startMode = AttachToRemoteServer; + rp.closeMode = KillAtClose; StartRemoteCdbDialog dlg(ICore::dialogParent()); QString previousConnection = configValue(connectionKey).toString(); if (previousConnection.isEmpty()) @@ -1378,19 +1378,19 @@ void DebuggerPluginPrivate::startRemoteCdbSession() dlg.setConnection(previousConnection); if (dlg.exec() != QDialog::Accepted) return; - sp.remoteChannel = dlg.connection(); - setConfigValue(connectionKey, sp.remoteChannel); - DebuggerRunControlFactory::createAndScheduleRun(sp); + rp.remoteChannel = dlg.connection(); + setConfigValue(connectionKey, rp.remoteChannel); + createAndScheduleRun(rp); } void DebuggerPluginPrivate::attachToRemoteServer() { - DebuggerStartParameters sp; - sp.startMode = AttachToRemoteServer; - if (StartApplicationDialog::run(ICore::dialogParent(), &sp)) { - sp.closeMode = KillAtClose; - sp.serverStartScript.clear(); - DebuggerRunControlFactory::createAndScheduleRun(sp); + DebuggerRunParameters rp; + rp.startMode = AttachToRemoteServer; + if (StartApplicationDialog::run(ICore::dialogParent(), &rp)) { + rp.closeMode = KillAtClose; + rp.serverStartScript.clear(); + createAndScheduleRun(rp); } } @@ -1487,45 +1487,45 @@ DebuggerRunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit, return 0; } - DebuggerStartParameters sp; - bool res = DebuggerRunControlFactory::fillParametersFromKit(&sp, kit); + DebuggerRunParameters rp; + bool res = fillParametersFromKit(&rp, kit); QTC_ASSERT(res, return 0); - sp.attachPID = process.pid; - sp.displayName = tr("Process %1").arg(process.pid); - sp.executable = process.exe; - sp.startMode = AttachExternal; - sp.closeMode = DetachAtClose; - sp.continueAfterAttach = contAfterAttach; - return DebuggerRunControlFactory::createAndScheduleRun(sp); + rp.attachPID = process.pid; + rp.displayName = tr("Process %1").arg(process.pid); + rp.executable = process.exe; + rp.startMode = AttachExternal; + rp.closeMode = DetachAtClose; + rp.continueAfterAttach = contAfterAttach; + return createAndScheduleRun(rp); } void DebuggerPlugin::attachExternalApplication(RunControl *rc) { - DebuggerStartParameters sp; - sp.attachPID = rc->applicationProcessHandle().pid(); - sp.displayName = tr("Process %1").arg(sp.attachPID); - sp.startMode = AttachExternal; - sp.closeMode = DetachAtClose; - sp.toolChainAbi = rc->abi(); + DebuggerRunParameters rp; + rp.attachPID = rc->applicationProcessHandle().pid(); + rp.displayName = tr("Process %1").arg(rp.attachPID); + rp.startMode = AttachExternal; + rp.closeMode = DetachAtClose; + rp.toolChainAbi = rc->abi(); Kit *kit = 0; if (const RunConfiguration *runConfiguration = rc->runConfiguration()) if (const Target *target = runConfiguration->target()) kit = target->kit(); - bool res = DebuggerRunControlFactory::fillParametersFromKit(&sp, kit); + bool res = fillParametersFromKit(&rp, kit); QTC_ASSERT(res, return); - DebuggerRunControlFactory::createAndScheduleRun(sp); + createAndScheduleRun(rp); } void DebuggerPluginPrivate::attachToQmlPort() { - DebuggerStartParameters sp; + DebuggerRunParameters rp; AttachToQmlPortDialog dlg(ICore::mainWindow()); const QVariant qmlServerPort = configValue("LastQmlServerPort"); if (qmlServerPort.isValid()) dlg.setPort(qmlServerPort.toInt()); else - dlg.setPort(sp.qmlServerPort); + dlg.setPort(rp.qmlServerPort); const Id kitId = Id::fromSetting(configValue("LastProfile")); if (kitId.isValid()) @@ -1536,21 +1536,21 @@ void DebuggerPluginPrivate::attachToQmlPort() Kit *kit = dlg.kit(); QTC_ASSERT(kit, return); - bool res = DebuggerRunControlFactory::fillParametersFromKit(&sp, kit); + bool res = fillParametersFromKit(&rp, kit); QTC_ASSERT(res, return); setConfigValue("LastQmlServerPort", dlg.port()); setConfigValue("LastProfile", kit->id().toSetting()); IDevice::ConstPtr device = DeviceKitInformation::device(kit); if (device) { - sp.connParams = device->sshParameters(); - sp.qmlServerAddress = device->qmlProfilerHost(); + rp.connParams = device->sshParameters(); + rp.qmlServerAddress = device->qmlProfilerHost(); } - sp.qmlServerPort = dlg.port(); - sp.startMode = AttachToRemoteProcess; - sp.closeMode = KillAtClose; - sp.languages = QmlLanguage; - sp.masterEngineType = QmlEngineType; + rp.qmlServerPort = dlg.port(); + rp.startMode = AttachToRemoteProcess; + rp.closeMode = KillAtClose; + rp.languages = QmlLanguage; + rp.masterEngineType = QmlEngineType; // // get files from all the projects in the session @@ -1565,11 +1565,11 @@ void DebuggerPluginPrivate::attachToQmlPort() foreach (Project *project, projects) sourceFiles << project->files(Project::ExcludeGeneratedFiles); - sp.projectSourceDirectory = + rp.projectSourceDirectory = !projects.isEmpty() ? projects.first()->projectDirectory().toString() : QString(); - sp.projectSourceFiles = sourceFiles; - sp.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); - DebuggerRunControlFactory::createAndScheduleRun(sp); + rp.projectSourceFiles = sourceFiles; + rp.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); + createAndScheduleRun(rp); } void DebuggerPluginPrivate::enableReverseDebuggingTriggered(const QVariant &value) @@ -1582,8 +1582,8 @@ void DebuggerPluginPrivate::enableReverseDebuggingTriggered(const QVariant &valu void DebuggerPluginPrivate::runScheduled() { - foreach (const DebuggerStartParameters &sp, m_scheduledStarts) - DebuggerRunControlFactory::createAndScheduleRun(sp); + foreach (const DebuggerRunParameters &rp, m_scheduledStarts) + createAndScheduleRun(rp); } void DebuggerPluginPrivate::editorOpened(IEditor *editor) @@ -1815,7 +1815,7 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine) engine->watchHandler()->resetWatchers(); - m_mainWindow->setEngineDebugLanguages(engine->startParameters().languages); + m_mainWindow->setEngineDebugLanguages(engine->runParameters().languages); } static void changeFontSize(QWidget *widget, qreal size) @@ -2034,7 +2034,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) m_threadBox->setEnabled(state == InferiorStopOk || state == InferiorUnrunnable); - const bool isCore = engine->startParameters().startMode == AttachCore; + const bool isCore = engine->runParameters().startMode == AttachCore; const bool stopped = state == InferiorStopOk; const bool detachable = stopped && !isCore; m_detachAction->setEnabled(detachable); @@ -2270,7 +2270,7 @@ void createNewDock(QWidget *widget) dockWidget->show(); } -static QString formatStartParameters(DebuggerStartParameters &sp) +static QString formatStartParameters(DebuggerRunParameters &sp) { QString rc; QTextStream str(&rc); @@ -2331,9 +2331,9 @@ void DebuggerPluginPrivate::runControlStarted(DebuggerEngine *engine) activateDebugMode(); const QString message = tr("Starting debugger \"%1\" for ABI \"%2\"...") .arg(engine->objectName()) - .arg(engine->startParameters().toolChainAbi.toString()); + .arg(engine->runParameters().toolChainAbi.toString()); showStatusMessage(message); - showMessage(formatStartParameters(engine->startParameters()), LogDebug); + showMessage(formatStartParameters(engine->runParameters()), LogDebug); showMessage(m_debuggerSettings->dump(), LogDebug); m_snapshotHandler->appendSnapshot(engine); connectEngine(engine); @@ -3367,10 +3367,10 @@ void DebuggerPluginPrivate::testUnloadProject() // return t ? qobject_cast<LocalApplicationRunConfiguration *>(t->activeRunConfiguration()) : 0; //} -void DebuggerPluginPrivate::testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb) +void DebuggerPluginPrivate::testRunProject(const DebuggerRunParameters &rp, const TestCallBack &cb) { m_testCallbacks.append(cb); - RunControl *rc = DebuggerRunControlFactory::createAndScheduleRun(sp); + RunControl *rc = createAndScheduleRun(rp); connect(rc, &RunControl::finished, this, &DebuggerPluginPrivate::testRunControlFinished); } @@ -3409,7 +3409,7 @@ void DebuggerPluginPrivate::testFinished() //void DebuggerPluginPrivate::testStateMachine2() //{ -// DebuggerStartParameters sp; +// DebuggerRunParameters sp; // fillParameters(&sp, currentKit()); // sp.executable = activeLocalRunConfiguration()->executable(); // sp.testCase = TestNoBoundsOfCurrentFunction; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 4a4138162f2..e5d37917de6 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -69,12 +69,12 @@ enum { debug = 0 }; namespace Debugger { namespace Internal { -DebuggerEngine *createCdbEngine(const DebuggerStartParameters &sp, QString *error); -DebuggerEngine *createGdbEngine(const DebuggerStartParameters &sp); -DebuggerEngine *createPdbEngine(const DebuggerStartParameters &sp); -DebuggerEngine *createQmlEngine(const DebuggerStartParameters &sp); -DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp, QString *error); -DebuggerEngine *createLldbEngine(const DebuggerStartParameters &sp); +DebuggerEngine *createCdbEngine(const DebuggerRunParameters &sp, QString *error); +DebuggerEngine *createGdbEngine(const DebuggerRunParameters &sp); +DebuggerEngine *createPdbEngine(const DebuggerRunParameters &sp); +DebuggerEngine *createQmlEngine(const DebuggerRunParameters &sp); +DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &sp, QString *error); +DebuggerEngine *createLldbEngine(const DebuggerRunParameters &sp); } // namespace Internal @@ -131,22 +131,22 @@ DebuggerRunControl::~DebuggerRunControl() QString DebuggerRunControl::displayName() const { QTC_ASSERT(m_engine, return QString()); - return m_engine->startParameters().displayName; + return m_engine->runParameters().displayName; } void DebuggerRunControl::start() { QTC_ASSERT(m_engine, return); // User canceled input dialog asking for executable when working on library project. - if (m_engine->startParameters().startMode == StartInternal - && m_engine->startParameters().executable.isEmpty()) { + if (m_engine->runParameters().startMode == StartInternal + && m_engine->runParameters().executable.isEmpty()) { appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat); emit started(); emit finished(); return; } - if (m_engine->startParameters().startMode == StartInternal) { + if (m_engine->runParameters().startMode == StartInternal) { QStringList unhandledIds; foreach (Breakpoint bp, breakHandler()->allBreakpoints()) { if (bp.isEnabled() && !m_engine->acceptsBreakpoint(bp)) @@ -250,7 +250,7 @@ bool DebuggerRunControl::isRunning() const DebuggerStartParameters &DebuggerRunControl::startParameters() { - return m_engine->startParameters(); + return m_engine->runParameters(); } void DebuggerRunControl::notifyInferiorIll() @@ -289,8 +289,10 @@ bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfig, RunMode mode && qobject_cast<LocalApplicationRunConfiguration *>(runConfig); } -bool DebuggerRunControlFactory::fillParametersFromLocalRunConfiguration - (DebuggerStartParameters *sp, const RunConfiguration *runConfig, QString *errorMessage) +namespace Internal { + +bool fillParametersFromLocalRunConfiguration + (DebuggerRunParameters *sp, const RunConfiguration *runConfig, QString *errorMessage) { QTC_ASSERT(runConfig, return false); EnvironmentAspect *environmentAspect = runConfig->extraAspect<EnvironmentAspect>(); @@ -360,6 +362,8 @@ bool DebuggerRunControlFactory::fillParametersFromLocalRunConfiguration return true; } +} // namespace Internal + RunControl *DebuggerRunControlFactory::create (RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage) { @@ -367,7 +371,7 @@ RunControl *DebuggerRunControlFactory::create // We cover only local setup here. Remote setups are handled by the // RunControl factories in the target specific plugins. - DebuggerStartParameters sp; + DebuggerRunParameters sp; bool res = fillParametersFromLocalRunConfiguration(&sp, runConfiguration, errorMessage); if (sp.startMode == NoStartMode) return 0; @@ -381,78 +385,86 @@ RunControl *DebuggerRunControlFactory::create return doCreate(sp, errorMessage); } +IRunConfigurationAspect *DebuggerRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc) +{ + return new DebuggerRunConfigurationAspect(rc); +} + +DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp, QString *errorMessage) +{ + return DebuggerRunControlFactory::doCreate(sp, errorMessage); +} + DebuggerRunControl *DebuggerRunControlFactory::doCreate - (const DebuggerStartParameters &sp0, QString *errorMessage) + (const DebuggerStartParameters &sp, QString *errorMessage) { TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO); TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); - DebuggerStartParameters sp = sp0; + DebuggerRunParameters rp; + rp = sp; if (!boolSetting(AutoEnrichParameters)) { - const QString sysroot = sp.sysRoot; - if (sp.debugInfoLocation.isEmpty()) - sp.debugInfoLocation = sysroot + QLatin1String("/usr/lib/debug"); - if (sp.debugSourceLocation.isEmpty()) { + const QString sysroot = rp.sysRoot; + if (rp.debugInfoLocation.isEmpty()) + rp.debugInfoLocation = sysroot + QLatin1String("/usr/lib/debug"); + if (rp.debugSourceLocation.isEmpty()) { QString base = sysroot + QLatin1String("/usr/src/debug/"); - sp.debugSourceLocation.append(base + QLatin1String("qt5base/src/corelib")); - sp.debugSourceLocation.append(base + QLatin1String("qt5base/src/gui")); - sp.debugSourceLocation.append(base + QLatin1String("qt5base/src/network")); + rp.debugSourceLocation.append(base + QLatin1String("qt5base/src/corelib")); + rp.debugSourceLocation.append(base + QLatin1String("qt5base/src/gui")); + rp.debugSourceLocation.append(base + QLatin1String("qt5base/src/network")); } } - if (sp.masterEngineType == NoEngineType) { - if (sp.executable.endsWith(_(".py")) - || sp.executable == _("/usr/bin/python") - || sp.executable == _("/usr/bin/python3")) { - sp.masterEngineType = PdbEngineType; + if (rp.masterEngineType == NoEngineType) { + if (rp.executable.endsWith(_(".py")) + || rp.executable == _("/usr/bin/python") + || rp.executable == _("/usr/bin/python3")) { + rp.masterEngineType = PdbEngineType; } else { - if (RunConfiguration *rc = sp.runConfiguration) { + if (RunConfiguration *rc = rp.runConfiguration) { DebuggerRunConfigurationAspect *aspect = rc->extraAspect<Debugger::DebuggerRunConfigurationAspect>(); if (const Target *target = rc->target()) - if (!DebuggerRunControlFactory::fillParametersFromKit(&sp, target->kit(), errorMessage)) + if (!fillParametersFromKit(&rp, target->kit(), errorMessage)) return 0; - const bool useCppDebugger = aspect->useCppDebugger() && (sp.languages & CppLanguage); - const bool useQmlDebugger = aspect->useQmlDebugger() && (sp.languages & QmlLanguage); + const bool useCppDebugger = aspect->useCppDebugger() && (rp.languages & CppLanguage); + const bool useQmlDebugger = aspect->useQmlDebugger() && (rp.languages & QmlLanguage); if (useQmlDebugger) { if (useCppDebugger) - sp.masterEngineType = QmlCppEngineType; + rp.masterEngineType = QmlCppEngineType; else - sp.masterEngineType = QmlEngineType; + rp.masterEngineType = QmlEngineType; } else { - sp.masterEngineType = sp.cppEngineType; + rp.masterEngineType = rp.cppEngineType; } } else { - sp.masterEngineType = sp.cppEngineType; + rp.masterEngineType = rp.cppEngineType; } } } QString error; - DebuggerEngine *engine = createEngine(sp.masterEngineType, sp, &error); + DebuggerEngine *engine = createEngine(rp.masterEngineType, rp, &error); if (!engine) { Core::ICore::showWarningWithOptions(DebuggerRunControl::tr("Debugger"), error); if (errorMessage) *errorMessage = error; return 0; } - return new DebuggerRunControl(sp.runConfiguration, engine); + return new DebuggerRunControl(rp.runConfiguration, engine); } -IRunConfigurationAspect *DebuggerRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc) -{ - return new DebuggerRunConfigurationAspect(rc); -} +namespace Internal { -DebuggerRunControl *DebuggerRunControlFactory::createAndScheduleRun(const DebuggerStartParameters &sp) +DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp) { QString errorMessage; - DebuggerRunControl *rc = doCreate(sp, &errorMessage); + DebuggerRunControl *rc = createDebuggerRunControl(rp, &errorMessage); if (!rc) { ProjectExplorerPlugin::showRunErrorMessage(errorMessage); return 0; } - Internal::showMessage(sp.startMessage, 0); + Internal::showMessage(rp.startMessage, 0); ProjectExplorerPlugin::startRunControl(rc, DebugRunMode); return rc; } @@ -465,7 +477,7 @@ static QString executableForPid(qint64 pid) return QString(); } -bool DebuggerRunControlFactory::fillParametersFromKit(DebuggerStartParameters *sp, const Kit *kit, QString *errorMessage /* = 0 */) +bool fillParametersFromKit(DebuggerRunParameters *sp, const Kit *kit, QString *errorMessage /* = 0 */) { if (!kit) { // This code can only be reached when starting via the command line @@ -547,8 +559,8 @@ bool DebuggerRunControlFactory::fillParametersFromKit(DebuggerStartParameters *s return true; } -DebuggerEngine *DebuggerRunControlFactory::createEngine(DebuggerEngineType et, - const DebuggerStartParameters &sp, QString *errorMessage) +DebuggerEngine *createEngine(DebuggerEngineType et, + const DebuggerRunParameters &sp, QString *errorMessage) { switch (et) { case GdbEngineType: @@ -571,4 +583,5 @@ DebuggerEngine *DebuggerRunControlFactory::createEngine(DebuggerEngineType et, return 0; } +} // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 031ab923ede..9c61b66e65f 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -41,11 +41,13 @@ namespace ProjectExplorer { class Kit; } namespace Debugger { class RemoteSetupResult; - -namespace Internal { class DebuggerEngine; } - class DebuggerStartParameters; +namespace Internal { +class DebuggerEngine; +class DebuggerRunParameters; +} + class DEBUGGER_EXPORT DebuggerRunControl : public ProjectExplorer::RunControl { @@ -104,24 +106,15 @@ public: bool canRun(ProjectExplorer::RunConfiguration *runConfig, ProjectExplorer::RunMode mode) const; - static Internal::DebuggerEngine *createEngine(DebuggerEngineType et, - const DebuggerStartParameters &sp, - QString *errorMessage); - - static bool fillParametersFromKit(DebuggerStartParameters *sp, - const ProjectExplorer::Kit *kit, QString *errorMessage = 0); - - static bool fillParametersFromLocalRunConfiguration(DebuggerStartParameters *sp, - const ProjectExplorer::RunConfiguration *runConfig, QString *errorMessage = 0); - - static DebuggerRunControl *createAndScheduleRun(const DebuggerStartParameters &sp); - static DebuggerRunControl *doCreate(const DebuggerStartParameters &sp, QString *errorMessage); ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect( ProjectExplorer::RunConfiguration *rc); }; +DEBUGGER_EXPORT DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp, + QString *errorMessage); + } // namespace Debugger #endif // DEBUGGERRUNCONTROL_H diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp index 8aa29de2824..fa8a81fb9be 100644 --- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp +++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp @@ -29,7 +29,7 @@ ****************************************************************************/ #include "debuggersourcepathmappingwidget.h" -#include "debuggerstartparameters.h" +#include "debuggerengine.h" #include <coreplugin/variablechooser.h> @@ -438,7 +438,7 @@ static QString findQtInstallPath(const FileName &qmakePath) /* Merge settings for an installed Qt (unless another setting * is already in the map. */ DebuggerSourcePathMappingWidget::SourcePathMap - DebuggerSourcePathMappingWidget::mergePlatformQtPath(const DebuggerStartParameters &sp, + DebuggerSourcePathMappingWidget::mergePlatformQtPath(const DebuggerRunParameters &sp, const SourcePathMap &in) { const FileName qmake = BuildableHelperLibrary::findSystemQt(sp.environment); diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.h b/src/plugins/debugger/debuggersourcepathmappingwidget.h index 4b7e65415b1..0f74c148097 100644 --- a/src/plugins/debugger/debuggersourcepathmappingwidget.h +++ b/src/plugins/debugger/debuggersourcepathmappingwidget.h @@ -46,11 +46,9 @@ QT_END_NAMESPACE namespace Utils { class PathChooser; } namespace Debugger { - -class DebuggerStartParameters; - namespace Internal { +class DebuggerRunParameters; class SourcePathMappingModel; class DebuggerSourcePathMappingWidget : public QGroupBox @@ -67,7 +65,7 @@ public: /* Merge settings for an installed Qt (unless another setting * is already in the map. */ - static SourcePathMap mergePlatformQtPath(const DebuggerStartParameters &sp, + static SourcePathMap mergePlatformQtPath(const DebuggerRunParameters &sp, const SourcePathMap &in); private slots: diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h index 27aff60495c..6ba479dc2ee 100644 --- a/src/plugins/debugger/debuggerstartparameters.h +++ b/src/plugins/debugger/debuggerstartparameters.h @@ -38,7 +38,6 @@ #include <utils/environment.h> #include <projectexplorer/abi.h> #include <projectexplorer/runconfiguration.h> -#include <projectexplorer/devicesupport/idevice.h> #include <QMetaType> #include <QVector> @@ -74,9 +73,7 @@ class DEBUGGER_EXPORT DebuggerStartParameters public: DebuggerStartParameters() : masterEngineType(NoEngineType), - cppEngineType(NoEngineType), runConfiguration(0), - isSnapshot(false), attachPID(-1), useTerminal(false), breakOnMain(false), @@ -90,26 +87,19 @@ public: startMode(NoStartMode), closeMode(KillAtClose), useCtrlCStub(false), - skipExecutableValidation(false), - testCase(0) + skipExecutableValidation(false) {} DebuggerEngineType masterEngineType; - DebuggerEngineType cppEngineType; QString sysRoot; QString deviceSymbolsRoot; QString debuggerCommand; ProjectExplorer::Abi toolChainAbi; - ProjectExplorer::IDevice::ConstPtr device; QPointer<ProjectExplorer::RunConfiguration> runConfiguration; QString platform; QString executable; QString displayName; // Used in the Snapshots view. - QString startMessage; // First status message shown. - QString coreFile; - QString overrideStartScript; // Used in attach to core and remote debugging - bool isSnapshot; // Set if created internally. QString processArgs; Utils::Environment environment; QString workingDirectory; @@ -120,9 +110,6 @@ public: bool multiProcess; DebuggerLanguages languages; - // Used by AttachCrashedExternal. - QString crashParameter; - // Used by Qml debugging. QString qmlServerAddress; quint16 qmlServerPort; @@ -133,15 +120,8 @@ public: // Used by remote debugging. QString remoteChannel; - QString serverStartScript; - QString debugInfoLocation; // Gdb "set-debug-file-directory". - QStringList debugSourceLocation; // Gdb "directory" - QByteArray remoteSourcesDir; - QString remoteMountPoint; - QString localMountDir; QSsh::SshConnectionParameters connParams; bool remoteSetupNeeded; - QMap<QString, QString> sourcePathMap; // Used by baremetal plugin QByteArray commandsForReset; // commands used for resetting the inferior @@ -161,9 +141,6 @@ public: // Used by Android to avoid false positives on warnOnRelease bool skipExecutableValidation; - - // For Debugger testing. - int testCase; }; } // namespace Debugger diff --git a/src/plugins/debugger/gdb/attachgdbadapter.cpp b/src/plugins/debugger/gdb/attachgdbadapter.cpp index 53d1604a80f..f090b99ff08 100644 --- a/src/plugins/debugger/gdb/attachgdbadapter.cpp +++ b/src/plugins/debugger/gdb/attachgdbadapter.cpp @@ -47,7 +47,7 @@ namespace Internal { // /////////////////////////////////////////////////////////////////////// -GdbAttachEngine::GdbAttachEngine(const DebuggerStartParameters &startParameters) +GdbAttachEngine::GdbAttachEngine(const DebuggerRunParameters &startParameters) : GdbEngine(startParameters) { } @@ -57,10 +57,10 @@ void GdbAttachEngine::setupEngine() QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); showMessage(_("TRYING TO START ADAPTER")); - if (!startParameters().workingDirectory.isEmpty()) - m_gdbProc->setWorkingDirectory(startParameters().workingDirectory); - if (startParameters().environment.size()) - m_gdbProc->setEnvironment(startParameters().environment.toStringList()); + if (!runParameters().workingDirectory.isEmpty()) + m_gdbProc->setWorkingDirectory(runParameters().workingDirectory); + if (runParameters().environment.size()) + m_gdbProc->setEnvironment(runParameters().environment.toStringList()); startGdb(); } @@ -76,7 +76,7 @@ void GdbAttachEngine::setupInferior() void GdbAttachEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); - const qint64 pid = startParameters().attachPID; + const qint64 pid = runParameters().attachPID; postCommand("attach " + QByteArray::number(pid), NoFlags, [this](const DebuggerResponse &r) { handleAttach(r); }); showStatusMessage(tr("Attached to process %1.").arg(inferiorPid())); @@ -100,13 +100,13 @@ void GdbAttachEngine::handleAttach(const DebuggerResponse &response) // InferiorStopOk, e.g. for "Attach to running application". // The *stopped came in between sending the 'attach' and // receiving its '^done'. - if (startParameters().continueAfterAttach) + if (runParameters().continueAfterAttach) continueInferiorInternal(); } break; case ResultError: if (response.data["msg"].data() == "ptrace: Operation not permitted.") { - QString msg = msgPtraceError(startParameters().startMode); + QString msg = msgPtraceError(runParameters().startMode); showStatusMessage(tr("Failed to attach to application: %1").arg(msg)); Core::AsynchronousMessageBox::warning(tr("Debugger Error"), msg); notifyEngineIll(); @@ -122,7 +122,7 @@ void GdbAttachEngine::handleAttach(const DebuggerResponse &response) void GdbAttachEngine::interruptInferior2() { - interruptLocalInferior(startParameters().attachPID); + interruptLocalInferior(runParameters().attachPID); } void GdbAttachEngine::shutdownEngine() diff --git a/src/plugins/debugger/gdb/attachgdbadapter.h b/src/plugins/debugger/gdb/attachgdbadapter.h index 6d03609ef23..5f1bf28234a 100644 --- a/src/plugins/debugger/gdb/attachgdbadapter.h +++ b/src/plugins/debugger/gdb/attachgdbadapter.h @@ -48,7 +48,7 @@ class GdbAttachEngine : public GdbEngine Q_OBJECT public: - explicit GdbAttachEngine(const DebuggerStartParameters &startParameters); + explicit GdbAttachEngine(const DebuggerRunParameters &runParameters); private: void setupEngine(); diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp index 1ee58825fff..c81bef5a1b7 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.cpp +++ b/src/plugins/debugger/gdb/coregdbadapter.cpp @@ -56,7 +56,7 @@ namespace Internal { // /////////////////////////////////////////////////////////////////////// -GdbCoreEngine::GdbCoreEngine(const DebuggerStartParameters &startParameters) +GdbCoreEngine::GdbCoreEngine(const DebuggerRunParameters &startParameters) : GdbEngine(startParameters), m_coreUnpackProcess(0) {} @@ -82,9 +82,9 @@ void GdbCoreEngine::setupEngine() QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); showMessage(_("TRYING TO START ADAPTER")); - const DebuggerStartParameters &sp = startParameters(); - m_executable = sp.executable; - QFileInfo fi(sp.coreFile); + const DebuggerRunParameters &rp = runParameters(); + m_executable = rp.executable; + QFileInfo fi(rp.coreFile); m_coreName = fi.absoluteFilePath(); unpackCoreIfNeeded(); @@ -178,7 +178,7 @@ void GdbCoreEngine::continueSetupEngine() } if (isCore && m_executable.isEmpty()) { GdbCoreEngine::CoreInfo cinfo = readExecutableNameFromCore( - startParameters().debuggerCommand, + runParameters().debuggerCommand, coreFileName()); if (cinfo.isCore) { @@ -253,7 +253,7 @@ void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response) postCommand("p 5", NoFlags, CB(handleRoundTrip)); return; } - showStatusMessage(tr("Attach to core \"%1\" failed:").arg(startParameters().coreFile) + showStatusMessage(tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile) + QLatin1Char('\n') + QString::fromLocal8Bit(response.data["msg"].data())); notifyEngineIll(); } diff --git a/src/plugins/debugger/gdb/coregdbadapter.h b/src/plugins/debugger/gdb/coregdbadapter.h index 2d6e8c0c078..bd0ee88ee6d 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.h +++ b/src/plugins/debugger/gdb/coregdbadapter.h @@ -43,7 +43,7 @@ class GdbCoreEngine : public GdbEngine Q_OBJECT public: - explicit GdbCoreEngine(const DebuggerStartParameters &startParameters); + explicit GdbCoreEngine(const DebuggerRunParameters &runParameters); ~GdbCoreEngine(); struct CoreInfo diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 521d92280e5..ff6cc8821c2 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -222,7 +222,7 @@ private: // /////////////////////////////////////////////////////////////////////// -GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters) +GdbEngine::GdbEngine(const DebuggerRunParameters &startParameters) : DebuggerEngine(startParameters) { setObjectName(_("GdbEngine")); @@ -272,7 +272,7 @@ GdbEngine::~GdbEngine() DebuggerStartMode GdbEngine::startMode() const { - return startParameters().startMode; + return runParameters().startMode; } QString GdbEngine::errorMessage(QProcess::ProcessError error) @@ -825,12 +825,12 @@ void GdbEngine::interruptInferior() if (HostOsInfo::isWindowsHost() && !m_isQnxGdb) { QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state(); notifyInferiorStopFailed()); QTC_ASSERT(!m_signalOperation, notifyInferiorStopFailed()); - m_signalOperation = startParameters().device->signalOperation(); + m_signalOperation = runParameters().device->signalOperation(); QTC_ASSERT(m_signalOperation, notifyInferiorStopFailed()); connect(m_signalOperation.data(), SIGNAL(finished(QString)), SLOT(handleInterruptDeviceInferior(QString))); - m_signalOperation->setDebuggerCommand(startParameters().debuggerCommand); + m_signalOperation->setDebuggerCommand(runParameters().debuggerCommand); m_signalOperation->interruptProcess(inferiorPid()); } else { interruptInferior2(); @@ -1165,11 +1165,11 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response) // (response->resultClass == ResultDone && (cmd.flags & RunRequest)); if (!isExpectedResult) { - const DebuggerStartParameters &sp = startParameters(); - Abi abi = sp.toolChainAbi; + const DebuggerRunParameters &rp = runParameters(); + Abi abi = rp.toolChainAbi; if (abi.os() == Abi::WindowsOS && cmd.function.startsWith("attach") - && (sp.startMode == AttachExternal || sp.useTerminal)) + && (rp.startMode == AttachExternal || rp.useTerminal)) { // Ignore spurious 'running' responses to 'attach'. } else { @@ -1377,7 +1377,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data) } // Ignore signals from the process stub. - if (startParameters().useTerminal + if (runParameters().useTerminal && data["reason"].data() == "signal-received" && data["signal-name"].data() == "SIGSTOP" && (func.endsWith("/ld-linux.so.2") @@ -1476,8 +1476,8 @@ void GdbEngine::handleStopResponse(const GdbMi &data) // This is gdb 7+'s initial *stopped in response to attach that // appears before the ^done is seen. notifyEngineRunAndInferiorStopOk(); - const DebuggerStartParameters &sp = startParameters(); - if (sp.useTerminal) + const DebuggerRunParameters &rp = runParameters(); + if (rp.useTerminal) continueInferiorInternal(); return; } else { @@ -1598,12 +1598,12 @@ void GdbEngine::handleStop2(const GdbMi &data) // dState changed from InferiorStopRequested(13) to InferiorStopOk(14). const QByteArray reason = data["reason"].data(); - const DebuggerStartParameters &sp = startParameters(); + const DebuggerRunParameters &rp = runParameters(); bool isStopperThread = false; - if (sp.toolChainAbi.os() == Abi::WindowsOS - && sp.useTerminal + if (rp.toolChainAbi.os() == Abi::WindowsOS + && rp.useTerminal && reason == "signal-received" && data["signal-name"].data() == "SIGTRAP") { @@ -1653,7 +1653,7 @@ void GdbEngine::handleStop2(const GdbMi &data) QByteArray meaning = data["signal-meaning"].data(); // Ignore these as they are showing up regularly when // stopping debugging. - if (name == stopSignal(sp.toolChainAbi) || sp.expectedSignals.contains(name)) { + if (name == stopSignal(rp.toolChainAbi) || rp.expectedSignals.contains(name)) { showMessage(_(name + " CONSIDERED HARMLESS. CONTINUING.")); } else { showMessage(_("HANDLING SIGNAL " + name)); @@ -1723,7 +1723,7 @@ void GdbEngine::handleShowVersion(const DebuggerResponse &response) else postCommand("set target-async off", ConsoleCommand); - if (startParameters().multiProcess) + if (runParameters().multiProcess) postCommand("set detach-on-fork off", ConsoleCommand); //postCommand("set build-id-verbose 2", ConsoleCommand); } @@ -1824,7 +1824,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName) if (!boolSetting(AutoEnrichParameters)) return cleanFilePath; - const QString sysroot = startParameters().sysRoot; + const QString sysroot = runParameters().sysRoot; if (QFileInfo(cleanFilePath).isReadable()) return cleanFilePath; if (!sysroot.isEmpty() && fileName.startsWith(QLatin1Char('/'))) { @@ -1864,7 +1864,7 @@ void GdbEngine::shutdownInferior() { CHECK_STATE(InferiorShutdownRequested); m_commandsToRunOnTemporaryBreak.clear(); - switch (startParameters().closeMode) { + switch (runParameters().closeMode) { case KillAtClose: case KillAndExitMonitorAtClose: postCommand("kill", NeedsStop | LosesChild, CB(handleInferiorShutdown)); @@ -1912,7 +1912,7 @@ void GdbEngine::notifyAdapterShutdownOk() m_commandsDoneCallback = 0; switch (m_gdbProc->state()) { case QProcess::Running: { - if (startParameters().closeMode == KillAndExitMonitorAtClose) + if (runParameters().closeMode == KillAndExitMonitorAtClose) postCommand("monitor exit"); DebuggerCommand cmd("exitGdb"); cmd.flags = GdbEngine::ExitRequest; @@ -2020,11 +2020,11 @@ bool GdbEngine::hasCapability(unsigned cap) const | ResetInferiorCapability)) return true; - if (startParameters().startMode == AttachCore) + if (runParameters().startMode == AttachCore) return false; // FIXME: Remove in case we have gdb 7.x on Mac. - if (startParameters().toolChainAbi.os() == Abi::MacOS) + if (runParameters().toolChainAbi.os() == Abi::MacOS) return false; return cap == SnapshotCapability; @@ -2441,7 +2441,7 @@ QByteArray GdbEngine::breakpointLocation(const BreakpointParameters &data) if (data.type == BreakpointAtCatch) return "__cxa_begin_catch"; if (data.type == BreakpointAtMain) { - const Abi abi = startParameters().toolChainAbi; + const Abi abi = runParameters().toolChainAbi; return (abi.os() == Abi::WindowsOS) ? "qMain" : "main"; } if (data.type == BreakpointByFunction) @@ -2719,10 +2719,10 @@ bool GdbEngine::stateAcceptsBreakpointChanges() const bool GdbEngine::acceptsBreakpoint(Breakpoint bp) const { - if (startParameters().startMode == AttachCore) + if (runParameters().startMode == AttachCore) return false; // We handle QML breakpoint unless specifically - if (isNativeMixedEnabled() && !(startParameters().languages & QmlLanguage)) + if (isNativeMixedEnabled() && !(runParameters().languages & QmlLanguage)) return true; return bp.parameters().isCppBreakpoint(); } @@ -3291,7 +3291,7 @@ void GdbEngine::handleQmlStackTrace(const DebuggerResponse &response) qmlFrames.reserve(qmlFrameCount); for (int i = 0; i < qmlFrameCount; ++i) { StackFrame frame = parseStackFrame(stackMi.childAt(i), i); - frame.fixQmlFrame(startParameters()); + frame.fixQmlFrame(runParameters()); qmlFrames.append(frame); } stackHandler()->prependFrames(qmlFrames); @@ -3338,7 +3338,7 @@ StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level) || frame.file.endsWith(QLatin1String(".qml"))) { frame.file = QFile::decodeName(frameMi["file"].data()); frame.language = QmlLanguage; - frame.fixQmlFrame(startParameters()); + frame.fixQmlFrame(runParameters()); } return frame; } @@ -3516,9 +3516,9 @@ void GdbEngine::createSnapshot() void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QString &coreFile) { if (response.resultClass == ResultDone) { - DebuggerStartParameters sp = startParameters(); - sp.startMode = AttachCore; - sp.coreFile = coreFile; + DebuggerRunParameters rp = runParameters(); + rp.startMode = AttachCore; + rp.coreFile = coreFile; //snapshot.setDate(QDateTime::currentDateTime()); StackFrames frames = stackHandler()->frames(); QString function = _("<unknown>"); @@ -3526,9 +3526,9 @@ void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QStri const StackFrame &frame = frames.at(0); function = frame.function + _(":") + QString::number(frame.line); } - sp.displayName = function + _(": ") + QDateTime::currentDateTime().toString(); - sp.isSnapshot = true; - DebuggerRunControlFactory::createAndScheduleRun(sp); + rp.displayName = function + _(": ") + QDateTime::currentDateTime().toString(); + rp.isSnapshot = true; + createAndScheduleRun(rp); } else { QByteArray msg = response.data["msg"].data(); AsynchronousMessageBox::critical(tr("Snapshot Creation Error"), @@ -4041,7 +4041,7 @@ bool GdbEngine::handleCliDisassemblerResult(const QByteArray &output, Disassembl // Binary/configuration check logic. -static QString gdbBinary(const DebuggerStartParameters &sp) +static QString gdbBinary(const DebuggerRunParameters &sp) { // 1) Environment. const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH"); @@ -4051,7 +4051,7 @@ static QString gdbBinary(const DebuggerStartParameters &sp) return sp.debuggerCommand; } -static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerStartParameters &sp, +static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerRunParameters &sp, const SourcePathMap &in) { // Do not overwrite user settings. @@ -4075,12 +4075,12 @@ void GdbEngine::startGdb(const QStringList &args) m_gdbProc->disconnect(); // From any previous runs - const DebuggerStartParameters &sp = startParameters(); - m_gdb = gdbBinary(sp); + const DebuggerRunParameters &rp = runParameters(); + m_gdb = gdbBinary(rp); if (m_gdb.isEmpty()) { handleGdbStartFailed(); handleAdapterStartFailed( - msgNoGdbBinaryForToolChain(sp.toolChainAbi), + msgNoGdbBinaryForToolChain(rp.toolChainAbi), Constants::DEBUGGER_COMMON_SETTINGS_ID); return; } @@ -4179,17 +4179,17 @@ void GdbEngine::startGdb(const QStringList &args) Module module; module.startAddress = 0; module.endAddress = 0; - module.modulePath = sp.executable; + module.modulePath = rp.executable; module.moduleName = QLatin1String("<executable>"); modulesHandler()->updateModule(module); // Apply source path mappings from global options. //showMessage(_("Assuming Qt is installed at %1").arg(qtInstallPath)); const SourcePathMap sourcePathMap = - DebuggerSourcePathMappingWidget::mergePlatformQtPath(sp, + DebuggerSourcePathMappingWidget::mergePlatformQtPath(rp, Internal::globalDebuggerOptions()->sourcePathMap); const SourcePathMap completeSourcePathMap = - mergeStartParametersSourcePathMap(sp, sourcePathMap); + mergeStartParametersSourcePathMap(rp, sourcePathMap); for (auto it = completeSourcePathMap.constBegin(), cend = completeSourcePathMap.constEnd(); it != cend; ++it) { @@ -4198,14 +4198,14 @@ void GdbEngine::startGdb(const QStringList &args) } // Spaces just will not work. - foreach (const QString &src, sp.debugSourceLocation) { + foreach (const QString &src, rp.debugSourceLocation) { if (QDir(src).exists()) postCommand("directory " + src.toLocal8Bit()); else showMessage(_("# directory does not exist: ") + src, LogInput); } - const QByteArray sysroot = sp.sysRoot.toLocal8Bit(); + const QByteArray sysroot = rp.sysRoot.toLocal8Bit(); if (!sysroot.isEmpty()) { postCommand("set sysroot " + sysroot); // sysroot is not enough to correctly locate the sources, so explicitly @@ -4267,7 +4267,7 @@ void GdbEngine::handleGdbStartFailed() void GdbEngine::loadInitScript() { - const QString script = startParameters().overrideStartScript; + const QString script = runParameters().overrideStartScript; if (!script.isEmpty()) { if (QFileInfo(script).isReadable()) { postCommand("source " + script.toLocal8Bit()); @@ -4339,8 +4339,8 @@ void GdbEngine::abortDebugger() void GdbEngine::resetInferior() { - if (!startParameters().commandsForReset.isEmpty()) { - QByteArray commands = globalMacroExpander()->expand(startParameters().commandsForReset); + if (!runParameters().commandsForReset.isEmpty()) { + QByteArray commands = globalMacroExpander()->expand(runParameters().commandsForReset); foreach (QByteArray command, commands.split('\n')) { command = command.trimmed(); if (!command.isEmpty()) { @@ -4383,26 +4383,26 @@ void GdbEngine::notifyInferiorSetupFailed() void GdbEngine::handleInferiorPrepared() { - const DebuggerStartParameters &sp = startParameters(); + const DebuggerRunParameters &rp = runParameters(); CHECK_STATE(InferiorSetupRequested); - if (!sp.commandsAfterConnect.isEmpty()) { - QByteArray commands = globalMacroExpander()->expand(sp.commandsAfterConnect); + if (!rp.commandsAfterConnect.isEmpty()) { + QByteArray commands = globalMacroExpander()->expand(rp.commandsAfterConnect); foreach (QByteArray command, commands.split('\n')) { postCommand(command); } } //postCommand("set follow-exec-mode new"); - if (sp.breakOnMain) { + if (rp.breakOnMain) { QByteArray cmd = "tbreak "; - cmd += sp.toolChainAbi.os() == Abi::WindowsOS ? "qMain" : "main"; + cmd += rp.toolChainAbi.os() == Abi::WindowsOS ? "qMain" : "main"; postCommand(cmd); } // Initial attempt to set breakpoints. - if (sp.startMode != AttachCore) { + if (rp.startMode != AttachCore) { showStatusMessage(tr("Setting breakpoints...")); showMessage(tr("Setting breakpoints...")); attemptBreakpointSynchronization(); @@ -4420,7 +4420,7 @@ void GdbEngine::finishInferiorSetup() { CHECK_STATE(InferiorSetupRequested); - if (startParameters().startMode == AttachCore) { + if (runParameters().startMode == AttachCore) { notifyInferiorSetupOk(); // No breakpoints in core files. } else { if (boolSetting(BreakOnAbort)) @@ -4443,7 +4443,7 @@ void GdbEngine::finishInferiorSetup() void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response) { if (response.resultClass == ResultDone) { - const QByteArray debugInfoLocation = startParameters().debugInfoLocation.toLocal8Bit(); + const QByteArray debugInfoLocation = runParameters().debugInfoLocation.toLocal8Bit(); if (QFile::exists(QString::fromLocal8Bit(debugInfoLocation))) { const QByteArray curDebugInfoLocations = response.consoleStreamOutput.split('"').value(1); if (curDebugInfoLocations.isEmpty()) { @@ -4547,14 +4547,14 @@ bool GdbEngine::isHiddenBreakpoint(const BreakpointResponseId &id) const bool GdbEngine::usesExecInterrupt() const { - DebuggerStartMode mode = startParameters().startMode; + DebuggerStartMode mode = runParameters().startMode; return (mode == AttachToRemoteServer || mode == AttachToRemoteProcess) && boolSetting(TargetAsync); } void GdbEngine::scheduleTestResponse(int testCase, const QByteArray &response) { - if (!m_testCases.contains(testCase) && startParameters().testCase != testCase) + if (!m_testCases.contains(testCase) && runParameters().testCase != testCase) return; int token = currentToken() + 1; @@ -4592,11 +4592,11 @@ void GdbEngine::write(const QByteArray &data) bool GdbEngine::prepareCommand() { if (HostOsInfo::isWindowsHost()) { - DebuggerStartParameters &sp = startParameters(); + DebuggerRunParameters &rp = runParameters(); QtcProcess::SplitError perr; - sp.processArgs = QtcProcess::prepareArgs(sp.processArgs, &perr, + rp.processArgs = QtcProcess::prepareArgs(rp.processArgs, &perr, HostOsInfo::hostOs(), - &sp.environment, &sp.workingDirectory).toWindowsArgs(); + &rp.environment, &rp.workingDirectory).toWindowsArgs(); if (perr != QtcProcess::SplitOk) { // perr == BadQuoting is never returned on Windows // FIXME? QTCREATORBUG-2809 @@ -4671,20 +4671,20 @@ void GdbEngine::debugLastCommand() // Factory // -DebuggerEngine *createGdbEngine(const DebuggerStartParameters &sp) +DebuggerEngine *createGdbEngine(const DebuggerRunParameters &rp) { - switch (sp.startMode) { + switch (rp.startMode) { case AttachCore: - return new GdbCoreEngine(sp); + return new GdbCoreEngine(rp); case StartRemoteProcess: case AttachToRemoteServer: - return new GdbRemoteServerEngine(sp); + return new GdbRemoteServerEngine(rp); case AttachExternal: - return new GdbAttachEngine(sp); + return new GdbAttachEngine(rp); default: - if (sp.useTerminal) - return new GdbTermEngine(sp); - return new GdbPlainEngine(sp); + if (rp.useTerminal) + return new GdbTermEngine(rp); + return new GdbPlainEngine(rp); } } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 6c079805856..88caf6f2ac0 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -67,7 +67,7 @@ class GdbEngine : public DebuggerEngine Q_OBJECT public: - explicit GdbEngine(const DebuggerStartParameters &startParameters); + explicit GdbEngine(const DebuggerRunParameters &runParameters); ~GdbEngine(); private: ////////// General Interface ////////// diff --git a/src/plugins/debugger/gdb/gdbplainengine.cpp b/src/plugins/debugger/gdb/gdbplainengine.cpp index 52b53af71e3..a22a4d47a3b 100644 --- a/src/plugins/debugger/gdb/gdbplainengine.cpp +++ b/src/plugins/debugger/gdb/gdbplainengine.cpp @@ -47,7 +47,7 @@ namespace Internal { #define CB(callback) [this](const DebuggerResponse &r) { callback(r); } -GdbPlainEngine::GdbPlainEngine(const DebuggerStartParameters &startParameters) +GdbPlainEngine::GdbPlainEngine(const DebuggerRunParameters &startParameters) : GdbEngine(startParameters) { // Output @@ -58,8 +58,8 @@ GdbPlainEngine::GdbPlainEngine(const DebuggerStartParameters &startParameters) void GdbPlainEngine::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); - if (!startParameters().processArgs.isEmpty()) { - QString args = startParameters().processArgs; + if (!runParameters().processArgs.isEmpty()) { + QString args = runParameters().processArgs; postCommand("-exec-arguments " + toLocalEncoding(args)); } postCommand("-file-exec-and-symbols \"" + execFilePath() + '"', @@ -83,7 +83,7 @@ void GdbPlainEngine::handleFileExecAndSymbols(const DebuggerResponse &response) void GdbPlainEngine::runEngine() { - if (startParameters().useContinueInsteadOfRun) + if (runParameters().useContinueInsteadOfRun) postCommand("-exec-continue", GdbEngine::RunRequest, CB(handleExecuteContinue)); else postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun)); @@ -126,10 +126,10 @@ void GdbPlainEngine::setupEngine() } gdbArgs.append(_("--tty=") + m_outputCollector.serverName()); - if (!startParameters().workingDirectory.isEmpty()) - m_gdbProc->setWorkingDirectory(startParameters().workingDirectory); - if (startParameters().environment.size()) - m_gdbProc->setEnvironment(startParameters().environment.toStringList()); + if (!runParameters().workingDirectory.isEmpty()) + m_gdbProc->setWorkingDirectory(runParameters().workingDirectory); + if (runParameters().environment.size()) + m_gdbProc->setEnvironment(runParameters().environment.toStringList()); startGdb(gdbArgs); } @@ -153,7 +153,7 @@ void GdbPlainEngine::shutdownEngine() QByteArray GdbPlainEngine::execFilePath() const { - return QFileInfo(startParameters().executable) + return QFileInfo(runParameters().executable) .absoluteFilePath().toLocal8Bit(); } diff --git a/src/plugins/debugger/gdb/gdbplainengine.h b/src/plugins/debugger/gdb/gdbplainengine.h index fc889c9d282..98bc3b1d4d0 100644 --- a/src/plugins/debugger/gdb/gdbplainengine.h +++ b/src/plugins/debugger/gdb/gdbplainengine.h @@ -43,7 +43,7 @@ class GdbPlainEngine : public GdbEngine Q_OBJECT public: - explicit GdbPlainEngine(const DebuggerStartParameters &startParameters); + explicit GdbPlainEngine(const DebuggerRunParameters &runParameters); private: void handleExecRun(const DebuggerResponse &response); diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index 137a41ed2da..c908584e630 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -59,7 +59,7 @@ namespace Internal { // /////////////////////////////////////////////////////////////////////// -GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerStartParameters &startParameters) +GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerRunParameters &startParameters) : GdbEngine(startParameters), m_startAttempted(false) { if (HostOsInfo::isWindowsHost()) @@ -79,23 +79,23 @@ void GdbRemoteServerEngine::setupEngine() { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); showMessage(_("TRYING TO START ADAPTER")); - if (!startParameters().serverStartScript.isEmpty()) { + if (!runParameters().serverStartScript.isEmpty()) { // Provide script information about the environment QString arglist; - QtcProcess::addArg(&arglist, startParameters().serverStartScript); - QtcProcess::addArg(&arglist, startParameters().executable); - QtcProcess::addArg(&arglist, startParameters().remoteChannel); + QtcProcess::addArg(&arglist, runParameters().serverStartScript); + QtcProcess::addArg(&arglist, runParameters().executable); + QtcProcess::addArg(&arglist, runParameters().remoteChannel); m_uploadProc.start(_("/bin/sh ") + arglist); m_uploadProc.waitForStarted(); } - if (!startParameters().workingDirectory.isEmpty()) - m_gdbProc->setWorkingDirectory(startParameters().workingDirectory); - if (startParameters().environment.size()) - m_gdbProc->setEnvironment(startParameters().environment.toStringList()); + if (!runParameters().workingDirectory.isEmpty()) + m_gdbProc->setWorkingDirectory(runParameters().workingDirectory); + if (runParameters().environment.size()) + m_gdbProc->setEnvironment(runParameters().environment.toStringList()); - if (startParameters().remoteSetupNeeded) + if (runParameters().remoteSetupNeeded) notifyEngineRequestRemoteSetup(); else startGdb(); @@ -166,21 +166,21 @@ void GdbRemoteServerEngine::uploadProcFinished() void GdbRemoteServerEngine::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); - const DebuggerStartParameters &sp = startParameters(); + const DebuggerRunParameters &rp = runParameters(); QString executableFileName; - if (!sp.executable.isEmpty()) { - QFileInfo fi(sp.executable); + if (!rp.executable.isEmpty()) { + QFileInfo fi(rp.executable); executableFileName = fi.absoluteFilePath(); } //const QByteArray sysroot = sp.sysroot.toLocal8Bit(); //const QByteArray remoteArch = sp.remoteArchitecture.toLatin1(); - const QString args = isMasterEngine() ? startParameters().processArgs - : masterEngine()->startParameters().processArgs; + const QString args = isMasterEngine() ? runParameters().processArgs + : masterEngine()->runParameters().processArgs; // if (!remoteArch.isEmpty()) // postCommand("set architecture " + remoteArch); - const QString solibSearchPath = sp.solibSearchPath.join(HostOsInfo::pathListSeparator()); + const QString solibSearchPath = rp.solibSearchPath.join(HostOsInfo::pathListSeparator()); if (!solibSearchPath.isEmpty()) postCommand("set solib-search-path " + solibSearchPath.toLocal8Bit()); @@ -250,7 +250,7 @@ void GdbRemoteServerEngine::handleFileExecAndSymbols(const DebuggerResponse &res void GdbRemoteServerEngine::callTargetRemote() { - QByteArray rawChannel = startParameters().remoteChannel.toLatin1(); + QByteArray rawChannel = runParameters().remoteChannel.toLatin1(); QByteArray channel = rawChannel; // Don't touch channels with explicitly set protocols. @@ -268,7 +268,7 @@ void GdbRemoteServerEngine::callTargetRemote() if (m_isQnxGdb) postCommand("target qnx " + channel, NoFlags, CB(handleTargetQnx)); - else if (startParameters().multiProcess) + else if (runParameters().multiProcess) postCommand("target extended-remote " + channel, NoFlags, CB(handleTargetExtendedRemote)); else postCommand("target remote " + channel, NoFlags, CB(handleTargetRemote)); @@ -306,12 +306,12 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const DebuggerResponse &r foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n'))) postCommand(cmd.toLatin1()); } - if (startParameters().attachPID > 0) { // attach to pid if valid + if (runParameters().attachPID > 0) { // attach to pid if valid // gdb server will stop the remote application itself. - postCommand("attach " + QByteArray::number(startParameters().attachPID), + postCommand("attach " + QByteArray::number(runParameters().attachPID), NoFlags, CB(handleTargetExtendedAttach)); } else { - postCommand("-gdb-set remote exec-file " + startParameters().remoteExecutable.toLatin1(), + postCommand("-gdb-set remote exec-file " + runParameters().remoteExecutable.toLatin1(), NoFlags, CB(handleTargetExtendedAttach)); } } else { @@ -343,8 +343,8 @@ void GdbRemoteServerEngine::handleTargetQnx(const DebuggerResponse &response) showMessage(_("INFERIOR STARTED")); showMessage(msgAttachedToStoppedInferior(), StatusBar); - const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID; - const QString remoteExecutable = isMasterEngine() ? startParameters().remoteExecutable : masterEngine()->startParameters().remoteExecutable; + const qint64 pid = isMasterEngine() ? runParameters().attachPID : masterEngine()->runParameters().attachPID; + const QString remoteExecutable = isMasterEngine() ? runParameters().remoteExecutable : masterEngine()->runParameters().remoteExecutable; if (pid > -1) postCommand("attach " + QByteArray::number(pid), NoFlags, CB(handleAttach)); else if (!remoteExecutable.isEmpty()) @@ -372,7 +372,7 @@ void GdbRemoteServerEngine::handleAttach(const DebuggerResponse &response) } case ResultError: if (response.data["msg"].data() == "ptrace: Operation not permitted.") { - notifyInferiorSetupFailed(msgPtraceError(startParameters().startMode)); + notifyInferiorSetupFailed(msgPtraceError(runParameters().startMode)); break; } // if msg != "ptrace: ..." fall through @@ -405,7 +405,7 @@ void GdbRemoteServerEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); - const QString remoteExecutable = startParameters().remoteExecutable; + const QString remoteExecutable = runParameters().remoteExecutable; if (!remoteExecutable.isEmpty()) { postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun)); } else { @@ -468,9 +468,9 @@ void GdbRemoteServerEngine::notifyEngineRemoteServerRunning (const QByteArray &serverChannel, int inferiorPid) { // Currently only used by Android support. - startParameters().attachPID = inferiorPid; - startParameters().remoteChannel = QString::fromLatin1(serverChannel); - startParameters().multiProcess = true; + runParameters().attachPID = inferiorPid; + runParameters().remoteChannel = QString::fromLatin1(serverChannel); + runParameters().multiProcess = true; showMessage(_("NOTE: REMOTE SERVER RUNNING IN MULTIMODE")); m_startAttempted = true; startGdb(); diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.h b/src/plugins/debugger/gdb/remotegdbserveradapter.h index 1292cc5e377..50e4e708898 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.h +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.h @@ -41,7 +41,7 @@ class GdbRemoteServerEngine : public GdbEngine Q_OBJECT public: - explicit GdbRemoteServerEngine(const DebuggerStartParameters &startParameters); + explicit GdbRemoteServerEngine(const DebuggerRunParameters &runParameters); private: void setupEngine(); diff --git a/src/plugins/debugger/gdb/startgdbserverdialog.cpp b/src/plugins/debugger/gdb/startgdbserverdialog.cpp index 68a87c9f486..0dd3290cd3d 100644 --- a/src/plugins/debugger/gdb/startgdbserverdialog.cpp +++ b/src/plugins/debugger/gdb/startgdbserverdialog.cpp @@ -30,11 +30,11 @@ #include "startgdbserverdialog.h" +#include <debugger/debuggerengine.h> #include <debugger/debuggermainwindow.h> #include <debugger/debuggerplugin.h> #include <debugger/debuggerkitinformation.h> #include <debugger/debuggerruncontrol.h> -#include <debugger/debuggerstartparameters.h> #include <coreplugin/icore.h> #include <coreplugin/messagebox.h> @@ -212,17 +212,17 @@ void GdbServerStarter::attach(int port) return; } - DebuggerStartParameters sp; - bool res = DebuggerRunControlFactory::fillParametersFromKit(&sp, d->kit); + DebuggerRunParameters rp; + bool res = fillParametersFromKit(&rp, d->kit); QTC_ASSERT(res, return); - sp.masterEngineType = GdbEngineType; - sp.connParams.port = port; - sp.remoteChannel = sp.connParams.host + QLatin1Char(':') + QString::number(sp.connParams.port); - sp.displayName = tr("Remote: \"%1:%2\"").arg(sp.connParams.host).arg(port); - sp.executable = localExecutable; - sp.startMode = AttachToRemoteServer; - sp.closeMode = KillAtClose; - DebuggerRunControlFactory::createAndScheduleRun(sp); + rp.masterEngineType = GdbEngineType; + rp.connParams.port = port; + rp.remoteChannel = rp.connParams.host + QLatin1Char(':') + QString::number(rp.connParams.port); + rp.displayName = tr("Remote: \"%1:%2\"").arg(rp.connParams.host).arg(port); + rp.executable = localExecutable; + rp.startMode = AttachToRemoteServer; + rp.closeMode = KillAtClose; + createAndScheduleRun(rp); } void GdbServerStarter::handleProcessClosed(int status) diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp index a41bf432289..b31eb9dc403 100644 --- a/src/plugins/debugger/gdb/termgdbadapter.cpp +++ b/src/plugins/debugger/gdb/termgdbadapter.cpp @@ -52,7 +52,7 @@ namespace Internal { // /////////////////////////////////////////////////////////////////////// -GdbTermEngine::GdbTermEngine(const DebuggerStartParameters &startParameters) +GdbTermEngine::GdbTermEngine(const DebuggerRunParameters &startParameters) : GdbEngine(startParameters) { #ifdef Q_OS_WIN @@ -86,9 +86,9 @@ void GdbTermEngine::setupEngine() if (!prepareCommand()) return; - m_stubProc.setWorkingDirectory(startParameters().workingDirectory); + m_stubProc.setWorkingDirectory(runParameters().workingDirectory); // Set environment + dumper preload. - m_stubProc.setEnvironment(startParameters().environment); + m_stubProc.setEnvironment(runParameters().environment); connect(&m_stubProc, &ConsoleProcess::processError, this, &GdbTermEngine::stubError); @@ -99,8 +99,8 @@ void GdbTermEngine::setupEngine() // FIXME: Starting the stub implies starting the inferior. This is // fairly unclean as far as the state machine and error reporting go. - if (!m_stubProc.start(startParameters().executable, - startParameters().processArgs)) { + if (!m_stubProc.start(runParameters().executable, + runParameters().processArgs)) { // Error message for user is delivered via a signal. handleAdapterStartFailed(QString()); return; @@ -148,7 +148,7 @@ void GdbTermEngine::handleStubAttached(const DebuggerResponse &response) switch (response.resultClass) { case ResultDone: case ResultRunning: - if (startParameters().toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS) { + if (runParameters().toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS) { QString errorMessage; // Resume thread that was suspended by console stub process (see stub code). const qint64 mainThreadId = m_stubProc.applicationMainThreadID(); @@ -170,7 +170,7 @@ void GdbTermEngine::handleStubAttached(const DebuggerResponse &response) break; case ResultError: if (response.data["msg"].data() == "ptrace: Operation not permitted.") { - showMessage(msgPtraceError(startParameters().startMode)); + showMessage(msgPtraceError(runParameters().startMode)); notifyEngineRunFailed(); break; } diff --git a/src/plugins/debugger/gdb/termgdbadapter.h b/src/plugins/debugger/gdb/termgdbadapter.h index bafd2caad9b..a4594094913 100644 --- a/src/plugins/debugger/gdb/termgdbadapter.h +++ b/src/plugins/debugger/gdb/termgdbadapter.h @@ -49,7 +49,7 @@ class GdbTermEngine : public GdbEngine Q_OBJECT public: - explicit GdbTermEngine(const DebuggerStartParameters &startParameters); + explicit GdbTermEngine(const DebuggerRunParameters &runParameters); ~GdbTermEngine(); private: diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 97ff3bbca59..f25e4834d2d 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -85,7 +85,7 @@ static int ¤tToken() // /////////////////////////////////////////////////////////////////////// -LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters) +LldbEngine::LldbEngine(const DebuggerRunParameters &startParameters) : DebuggerEngine(startParameters), m_continueAtNextSpontaneousStop(false) { m_lastAgentId = 0; @@ -156,7 +156,7 @@ void LldbEngine::shutdownEngine() { QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state()); m_lldbProc.kill(); - if (startParameters().useTerminal) + if (runParameters().useTerminal) m_stubProc.stop(); notifyEngineShutdownOk(); } @@ -178,11 +178,11 @@ void LldbEngine::abortDebugger() bool LldbEngine::prepareCommand() { if (HostOsInfo::isWindowsHost()) { - DebuggerStartParameters &sp = startParameters(); + DebuggerRunParameters &rp = runParameters(); QtcProcess::SplitError perr; - sp.processArgs = QtcProcess::prepareArgs(sp.processArgs, &perr, + rp.processArgs = QtcProcess::prepareArgs(rp.processArgs, &perr, HostOsInfo::hostOs(), - &sp.environment, &sp.workingDirectory).toWindowsArgs(); + &rp.environment, &rp.workingDirectory).toWindowsArgs(); if (perr != QtcProcess::SplitOk) { // perr == BadQuoting is never returned on Windows // FIXME? QTCREATORBUG-2809 @@ -195,7 +195,7 @@ bool LldbEngine::prepareCommand() void LldbEngine::setupEngine() { - if (startParameters().useTerminal) { + if (runParameters().useTerminal) { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); showMessage(_("TRYING TO START ADAPTER")); @@ -210,9 +210,9 @@ void LldbEngine::setupEngine() return; } - m_stubProc.setWorkingDirectory(startParameters().workingDirectory); + m_stubProc.setWorkingDirectory(runParameters().workingDirectory); // Set environment + dumper preload. - m_stubProc.setEnvironment(startParameters().environment); + m_stubProc.setEnvironment(runParameters().environment); connect(&m_stubProc, &ConsoleProcess::processError, this, &LldbEngine::stubError); connect(&m_stubProc, &ConsoleProcess::processStarted, this, &LldbEngine::stubStarted); @@ -220,8 +220,8 @@ void LldbEngine::setupEngine() // FIXME: Starting the stub implies starting the inferior. This is // fairly unclean as far as the state machine and error reporting go. - if (!m_stubProc.start(startParameters().executable, - startParameters().processArgs)) { + if (!m_stubProc.start(runParameters().executable, + runParameters().processArgs)) { // Error message for user is delivered via a signal. //handleAdapterStartFailed(QString()); notifyEngineSetupFailed(); @@ -230,7 +230,7 @@ void LldbEngine::setupEngine() } else { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); - if (startParameters().remoteSetupNeeded) + if (runParameters().remoteSetupNeeded) notifyEngineRequestRemoteSetup(); else startLldb(); @@ -239,7 +239,7 @@ void LldbEngine::setupEngine() void LldbEngine::startLldb() { - m_lldbCmd = startParameters().debuggerCommand; + m_lldbCmd = runParameters().debuggerCommand; connect(&m_lldbProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), this, &LldbEngine::handleLldbError); connect(&m_lldbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), @@ -253,9 +253,9 @@ void LldbEngine::startLldb() this, &LldbEngine::handleResponse, Qt::QueuedConnection); showMessage(_("STARTING LLDB: ") + m_lldbCmd); - m_lldbProc.setEnvironment(startParameters().environment.toStringList()); - if (!startParameters().workingDirectory.isEmpty()) - m_lldbProc.setWorkingDirectory(startParameters().workingDirectory); + m_lldbProc.setEnvironment(runParameters().environment.toStringList()); + if (!runParameters().workingDirectory.isEmpty()) + m_lldbProc.setWorkingDirectory(runParameters().workingDirectory); m_lldbProc.start(m_lldbCmd); @@ -310,18 +310,18 @@ void LldbEngine::setupInferior() // FIXME: splitting of setupInferior() necessary to support LLDB <= 310 - revert asap void LldbEngine::setupInferiorStage2() { - const DebuggerStartParameters &sp = startParameters(); + const DebuggerRunParameters &rp = runParameters(); QString executable; QtcProcess::Arguments args; - QtcProcess::prepareCommand(QFileInfo(sp.executable).absoluteFilePath(), - sp.processArgs, &executable, &args); + QtcProcess::prepareCommand(QFileInfo(rp.executable).absoluteFilePath(), + rp.processArgs, &executable, &args); DebuggerCommand cmd("setupInferior"); cmd.arg("executable", executable); - cmd.arg("breakOnMain", sp.breakOnMain); - cmd.arg("useTerminal", sp.useTerminal); - cmd.arg("startMode", sp.startMode); + cmd.arg("breakOnMain", rp.breakOnMain); + cmd.arg("useTerminal", rp.useTerminal); + cmd.arg("startMode", rp.startMode); cmd.beginList("bkpts"); foreach (Breakpoint bp, breakHandler()->unclaimedBreakpoints()) { @@ -345,7 +345,7 @@ void LldbEngine::setupInferiorStage2() cmd.arg(arg.toUtf8().toHex()); cmd.endList(); - if (sp.useTerminal) { + if (rp.useTerminal) { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); const qint64 attachedPID = m_stubProc.applicationPID(); const qint64 attachedMainThreadID = m_stubProc.applicationMainThreadID(); @@ -357,20 +357,20 @@ void LldbEngine::setupInferiorStage2() } else { - cmd.arg("startMode", sp.startMode); + cmd.arg("startMode", rp.startMode); // it is better not to check the start mode on the python sid (as we would have to duplicate the - // enum values), and thus we assume that if the sp.attachPID is valid we really have to attach - QTC_CHECK(sp.attachPID <= 0 || (sp.startMode == AttachCrashedExternal - || sp.startMode == AttachExternal)); - cmd.arg("attachPid", sp.attachPID); - cmd.arg("sysRoot", sp.deviceSymbolsRoot.isEmpty() ? sp.sysRoot : sp.deviceSymbolsRoot); - cmd.arg("remoteChannel", ((sp.startMode == AttachToRemoteProcess - || sp.startMode == AttachToRemoteServer) - ? sp.remoteChannel : QString())); - cmd.arg("platform", sp.platform); - QTC_CHECK(!sp.continueAfterAttach || (sp.startMode == AttachToRemoteProcess - || sp.startMode == AttachExternal - || sp.startMode == AttachToRemoteServer)); + // enum values), and thus we assume that if the rp.attachPID is valid we really have to attach + QTC_CHECK(rp.attachPID <= 0 || (rp.startMode == AttachCrashedExternal + || rp.startMode == AttachExternal)); + cmd.arg("attachPid", rp.attachPID); + cmd.arg("sysRoot", rp.deviceSymbolsRoot.isEmpty() ? rp.sysRoot : rp.deviceSymbolsRoot); + cmd.arg("remoteChannel", ((rp.startMode == AttachToRemoteProcess + || rp.startMode == AttachToRemoteServer) + ? rp.remoteChannel : QString())); + cmd.arg("platform", rp.platform); + QTC_CHECK(!rp.continueAfterAttach || (rp.startMode == AttachToRemoteProcess + || rp.startMode == AttachExternal + || rp.startMode == AttachToRemoteServer)); m_continueAtNextSpontaneousStop = false; } @@ -379,12 +379,12 @@ void LldbEngine::setupInferiorStage2() void LldbEngine::runEngine() { - const DebuggerStartParameters &sp = startParameters(); + const DebuggerRunParameters &rp = runParameters(); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state(); return); showStatusMessage(tr("Running requested..."), 5000); DebuggerCommand cmd("runEngine"); - if (sp.startMode == AttachCore) { - cmd.arg("coreFile", sp.coreFile); + if (rp.startMode == AttachCore) { + cmd.arg("coreFile", rp.coreFile); cmd.arg("continuation", "updateAll"); } runCommand(cmd); @@ -597,10 +597,10 @@ bool LldbEngine::stateAcceptsBreakpointChanges() const bool LldbEngine::acceptsBreakpoint(Breakpoint bp) const { - if (startParameters().startMode == AttachCore) + if (runParameters().startMode == AttachCore) return false; // We handle QML breakpoint unless specifically disabled. - if (isNativeMixedEnabled() && !(startParameters().languages & QmlLanguage)) + if (isNativeMixedEnabled() && !(runParameters().languages & QmlLanguage)) return true; return bp.parameters().isCppBreakpoint(); } @@ -1025,7 +1025,7 @@ void LldbEngine::refreshStack(const GdbMi &stack) || frame.file.endsWith(QLatin1String(".js")) || frame.file.endsWith(QLatin1String(".qml"))) { frame.language = QmlLanguage; - frame.fixQmlFrame(startParameters()); + frame.fixQmlFrame(runParameters()); } frames.append(frame); } @@ -1114,7 +1114,7 @@ void LldbEngine::refreshState(const GdbMi &reportedState) else if (newState == "inferiorsetupfailed") notifyInferiorSetupFailed(); else if (newState == "enginerunandinferiorrunok") { - if (startParameters().continueAfterAttach) + if (runParameters().continueAfterAttach) m_continueAtNextSpontaneousStop = true; notifyEngineRunAndInferiorRunOk(); } else if (newState == "enginerunandinferiorstopok") @@ -1249,14 +1249,14 @@ bool LldbEngine::hasCapability(unsigned cap) const | MemoryAddressCapability)) return true; - if (startParameters().startMode == AttachCore) + if (runParameters().startMode == AttachCore) return false; //return cap == SnapshotCapability; return false; } -DebuggerEngine *createLldbEngine(const DebuggerStartParameters &startParameters) +DebuggerEngine *createLldbEngine(const DebuggerRunParameters &startParameters) { return new LldbEngine(startParameters); } diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index f334d218eb1..cbc8fd9faf1 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -63,7 +63,7 @@ class LldbEngine : public DebuggerEngine Q_OBJECT public: - explicit LldbEngine(const DebuggerStartParameters &startParameters); + explicit LldbEngine(const DebuggerRunParameters &runParameters); ~LldbEngine(); private: diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 278cd355940..8f03345bd2d 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -66,7 +66,7 @@ using namespace Core; namespace Debugger { namespace Internal { -PdbEngine::PdbEngine(const DebuggerStartParameters &startParameters) +PdbEngine::PdbEngine(const DebuggerRunParameters &startParameters) : DebuggerEngine(startParameters) { setObjectName(QLatin1String("PdbEngine")); @@ -162,12 +162,12 @@ void PdbEngine::setupInferior() QString PdbEngine::mainPythonFile() const { - return QFileInfo(startParameters().processArgs).absoluteFilePath(); + return QFileInfo(runParameters().processArgs).absoluteFilePath(); } QString PdbEngine::pythonInterpreter() const { - return startParameters().executable; + return runParameters().executable; } void PdbEngine::runEngine() @@ -615,7 +615,7 @@ void PdbEngine::refreshStack(const GdbMi &stack) || frame.file.endsWith(QLatin1String(".js")) || frame.file.endsWith(QLatin1String(".qml"))) { frame.language = QmlLanguage; - frame.fixQmlFrame(startParameters()); + frame.fixQmlFrame(runParameters()); } frames.append(frame); } @@ -683,7 +683,7 @@ bool PdbEngine::hasCapability(unsigned cap) const | ShowModuleSymbolsCapability); } -DebuggerEngine *createPdbEngine(const DebuggerStartParameters &startParameters) +DebuggerEngine *createPdbEngine(const DebuggerRunParameters &startParameters) { return new PdbEngine(startParameters); } diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h index d9575ef53ed..2c7ef35ee19 100644 --- a/src/plugins/debugger/pdb/pdbengine.h +++ b/src/plugins/debugger/pdb/pdbengine.h @@ -50,7 +50,7 @@ class PdbEngine : public DebuggerEngine Q_OBJECT public: - explicit PdbEngine(const DebuggerStartParameters &startParameters); + explicit PdbEngine(const DebuggerRunParameters &runParameters); private: // DebuggerEngine implementation diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp index 222fc097e64..e95ebef02a6 100644 --- a/src/plugins/debugger/qml/qmlcppengine.cpp +++ b/src/plugins/debugger/qml/qmlcppengine.cpp @@ -60,7 +60,7 @@ enum { debug = 0 }; } \ } while (0) -DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp, +DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &sp, QString *errorMessage) { QmlCppEngine *newEngine = new QmlCppEngine(sp, errorMessage); @@ -77,12 +77,12 @@ DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp, // //////////////////////////////////////////////////////////////////////// -QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp, QString *errorMessage) - : DebuggerEngine(sp) +QmlCppEngine::QmlCppEngine(const DebuggerRunParameters &rp, QString *errorMessage) + : DebuggerEngine(rp) { setObjectName(QLatin1String("QmlCppEngine")); - m_qmlEngine = new QmlEngine(sp, this); - m_cppEngine = DebuggerRunControlFactory::createEngine(sp.cppEngineType, sp, errorMessage); + m_qmlEngine = new QmlEngine(rp, this); + m_cppEngine = createEngine(rp.cppEngineType, rp, errorMessage); if (!m_cppEngine) { *errorMessage = tr("The slave debugging engine required for combined QML/C++-Debugging could not be created: %1").arg(*errorMessage); return; @@ -386,7 +386,7 @@ void QmlCppEngine::setupEngine() m_qmlEngine->setupSlaveEngine(); m_cppEngine->setupSlaveEngine(); - if (startParameters().remoteSetupNeeded) + if (runParameters().remoteSetupNeeded) notifyEngineRequestRemoteSetup(); } diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h index 3ea2b14ff34..8a2e321bcc2 100644 --- a/src/plugins/debugger/qml/qmlcppengine.h +++ b/src/plugins/debugger/qml/qmlcppengine.h @@ -43,7 +43,7 @@ class QmlCppEngine : public DebuggerEngine Q_OBJECT public: - QmlCppEngine(const DebuggerStartParameters &sp, QString *errorMessage); + QmlCppEngine(const DebuggerRunParameters &sp, QString *errorMessage); ~QmlCppEngine(); bool canDisplayTooltip() const; diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index eb32ddfe114..ad4a0131689 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -261,7 +261,7 @@ ConsoleManagerInterface *qmlConsoleManager() // /////////////////////////////////////////////////////////////////////// -QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters, DebuggerEngine *masterEngine) +QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngine *masterEngine) : DebuggerEngine(startParameters) , m_adapter(this) , m_inspectorAdapter(&m_adapter, this) @@ -409,7 +409,7 @@ void QmlEngine::beginConnection(quint16 port) QTC_ASSERT(state() == EngineRunRequested, return); - QString host = startParameters().qmlServerAddress; + QString host = runParameters().qmlServerAddress; // Use localhost as default if (host.isEmpty()) host = QLatin1String("localhost"); @@ -425,8 +425,8 @@ void QmlEngine::beginConnection(quint16 port) * the connection will be closed again (instead of returning the "connection refused" * error that we expect). */ - if (startParameters().qmlServerPort > 0) - port = startParameters().qmlServerPort; + if (runParameters().qmlServerPort > 0) + port = runParameters().qmlServerPort; m_adapter.beginConnectionTcp(host, port); } @@ -575,9 +575,9 @@ void QmlEngine::runEngine() QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); if (!isSlaveEngine()) { - if (startParameters().startMode == AttachToRemoteServer) + if (runParameters().startMode == AttachToRemoteServer) m_noDebugOutputTimer.start(); - else if (startParameters().startMode == AttachToRemoteProcess) + else if (runParameters().startMode == AttachToRemoteProcess) beginConnection(); else startApplicationLauncher(); @@ -590,13 +590,13 @@ void QmlEngine::startApplicationLauncher() { if (!m_applicationLauncher.isRunning()) { appendMessage(tr("Starting %1 %2").arg( - QDir::toNativeSeparators(startParameters().executable), - startParameters().processArgs) + QDir::toNativeSeparators(runParameters().executable), + runParameters().processArgs) + QLatin1Char('\n') , Utils::NormalMessageFormat); m_applicationLauncher.start(ProjectExplorer::ApplicationLauncher::Gui, - startParameters().executable, - startParameters().processArgs); + runParameters().executable, + runParameters().processArgs); } } @@ -615,7 +615,7 @@ void QmlEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) if (result.success) { if (result.qmlServerPort != InvalidPort) - startParameters().qmlServerPort = result.qmlServerPort; + runParameters().qmlServerPort = result.qmlServerPort; notifyEngineSetupOk(); @@ -638,7 +638,7 @@ void QmlEngine::notifyEngineRemoteServerRunning(const QByteArray &serverChannel, bool ok = false; quint16 qmlPort = serverChannel.toUInt(&ok); if (ok) - startParameters().qmlServerPort = qmlPort; + runParameters().qmlServerPort = qmlPort; else qWarning() << tr("QML debugging port not set: Unable to convert %1 to unsigned int.").arg(QString::fromLatin1(serverChannel)); @@ -684,12 +684,12 @@ void QmlEngine::shutdownEngine() void QmlEngine::setupEngine() { - if (startParameters().remoteSetupNeeded) { + if (runParameters().remoteSetupNeeded) { // we need to get the port first notifyEngineRequestRemoteSetup(); } else { - m_applicationLauncher.setEnvironment(startParameters().environment); - m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory); + m_applicationLauncher.setEnvironment(runParameters().environment); + m_applicationLauncher.setWorkingDirectory(runParameters().workingDirectory); // We can't do this in the constructore because runControl() isn't yet defined connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), @@ -1234,7 +1234,7 @@ bool QmlEngine::evaluateScript(const QString &expression) QString QmlEngine::qmlImportPath() const { - return startParameters().environment.value(QLatin1String("QML_IMPORT_PATH")); + return runParameters().environment.value(QLatin1String("QML_IMPORT_PATH")); } void QmlEngine::logMessage(const QString &service, LogDirection direction, const QString &message) @@ -1353,7 +1353,7 @@ bool QmlEngine::adjustBreakpointLineAndColumn( return success; } -DebuggerEngine *createQmlEngine(const DebuggerStartParameters &sp) +DebuggerEngine *createQmlEngine(const DebuggerRunParameters &sp) { return new QmlEngine(sp); } diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index 621947dfe48..8fd88c1dcff 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -59,7 +59,7 @@ class QmlEngine : public DebuggerEngine, QmlJS::IScriptEvaluator Q_OBJECT public: - explicit QmlEngine(const DebuggerStartParameters &startParameters, + explicit QmlEngine(const DebuggerRunParameters &runParameters, DebuggerEngine *masterEngine = 0); ~QmlEngine(); diff --git a/src/plugins/debugger/snapshothandler.cpp b/src/plugins/debugger/snapshothandler.cpp index b69680462f6..11f9bcbcf8b 100644 --- a/src/plugins/debugger/snapshothandler.cpp +++ b/src/plugins/debugger/snapshothandler.cpp @@ -133,9 +133,9 @@ SnapshotHandler::~SnapshotHandler() { for (int i = m_snapshots.size(); --i >= 0; ) { if (DebuggerEngine *engine = at(i)) { - const DebuggerStartParameters &sp = engine->startParameters(); - if (sp.isSnapshot && !sp.coreFile.isEmpty()) - QFile::remove(sp.coreFile); + const DebuggerRunParameters &rp = engine->runParameters(); + if (rp.isSnapshot && !rp.coreFile.isEmpty()) + QFile::remove(rp.coreFile); } } } @@ -164,15 +164,15 @@ QVariant SnapshotHandler::data(const QModelIndex &index, int role) const if (!engine) return QLatin1String("<finished>"); - const DebuggerStartParameters &sp = engine->startParameters(); + const DebuggerRunParameters &rp = engine->runParameters(); switch (role) { case Qt::DisplayRole: switch (index.column()) { case 0: - return sp.displayName; + return rp.displayName; case 1: - return sp.coreFile.isEmpty() ? sp.executable : sp.coreFile; + return rp.coreFile.isEmpty() ? rp.executable : rp.coreFile; } return QVariant(); diff --git a/src/plugins/debugger/stackframe.cpp b/src/plugins/debugger/stackframe.cpp index 252248ece3c..cc07c4406e5 100644 --- a/src/plugins/debugger/stackframe.cpp +++ b/src/plugins/debugger/stackframe.cpp @@ -29,8 +29,8 @@ ****************************************************************************/ #include "stackframe.h" -#include "debuggerstartparameters.h" +#include "debuggerengine.h" #include "watchutils.h" #include <QDebug> @@ -134,7 +134,7 @@ QString StackFrame::toToolTip() const } // Try to resolve files of a QML stack (resource files). -void StackFrame::fixQmlFrame(const DebuggerStartParameters &sp) +void StackFrame::fixQmlFrame(const DebuggerRunParameters &rp) { if (language != QmlLanguage) return; @@ -146,8 +146,8 @@ void StackFrame::fixQmlFrame(const DebuggerStartParameters &sp) if (!file.startsWith(QLatin1String("qrc:/"))) return; const QString relativeFile = file.right(file.size() - 5); - if (!sp.projectSourceDirectory.isEmpty()) { - const QFileInfo pFi(sp.projectSourceDirectory + QLatin1Char('/') + relativeFile); + if (!rp.projectSourceDirectory.isEmpty()) { + const QFileInfo pFi(rp.projectSourceDirectory + QLatin1Char('/') + relativeFile); if (pFi.isFile()) { file = pFi.absoluteFilePath(); usable = true; diff --git a/src/plugins/debugger/stackframe.h b/src/plugins/debugger/stackframe.h index 3afe0886581..8d29f3f004f 100644 --- a/src/plugins/debugger/stackframe.h +++ b/src/plugins/debugger/stackframe.h @@ -41,11 +41,10 @@ class QDebug; QT_END_NAMESPACE namespace Debugger { - -class DebuggerStartParameters; - namespace Internal { +class DebuggerRunParameters; + class StackFrame { public: @@ -54,7 +53,7 @@ public: bool isUsable() const; QString toToolTip() const; QString toString() const; - void fixQmlFrame(const DebuggerStartParameters &sp); + void fixQmlFrame(const DebuggerRunParameters &rp); public: DebuggerLanguage language; |