From 0b5591ae7aabcdaf3def3215d8244353c35f84c4 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Fri, 7 Jan 2011 09:44:23 +0100 Subject: [PATCH] debugger move DebuggerStartParameters into file of its own --- src/plugins/debugger/debugger.pro | 1 + src/plugins/debugger/debuggerdialogs.cpp | 1 + src/plugins/debugger/debuggerengine.cpp | 79 +++++------- src/plugins/debugger/debuggerengine.h | 56 +-------- src/plugins/debugger/debuggerplugin.cpp | 3 +- src/plugins/debugger/debuggerrunner.cpp | 2 +- .../debugger/debuggerstartparameters.h | 119 ++++++++++++++++++ 7 files changed, 159 insertions(+), 102 deletions(-) create mode 100644 src/plugins/debugger/debuggerstartparameters.h diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 0497ed90892..68f145c250b 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -30,6 +30,7 @@ HEADERS += breakhandler.h \ debuggermainwindow.h \ debuggerplugin.h \ debuggerrunner.h \ + debuggerstartparameters.h \ debuggerstreamops.h \ debuggerstringutils.h \ debuggertooltip.h \ diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index d0c86b9f91f..30fbe14ebe7 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -32,6 +32,7 @@ **************************************************************************/ #include "debuggerdialogs.h" + #include "debuggerconstants.h" #include "cdb2/cdbengine2.h" diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 7111809e51c..567f90a36a8 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -95,22 +95,9 @@ using namespace TextEditor; namespace Debugger { -DebuggerStartParameters::DebuggerStartParameters() : - isSnapshot(false), - attachPID(-1), - useTerminal(false), - qmlServerAddress("127.0.0.1"), - qmlServerPort(0), - useServerStartScript(false), - connParams(SshConnectionParameters::NoProxy), - toolChainType(ToolChain_UNKNOWN), - startMode(NoStartMode), - executableUid(0) -{} - -QString DebuggerStartParameters::toolChainName() const +QString toolChainName(const DebuggerStartParameters &sp) { - return ToolChain::toolChainName(ProjectExplorer::ToolChainType(toolChainType)); + return ToolChain::toolChainName(ProjectExplorer::ToolChainType(sp.toolChainType)); } QDebug operator<<(QDebug d, DebuggerState state) @@ -138,37 +125,6 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp) return str; } -const char *DebuggerEngine::stateName(int s) -{ -# define SN(x) case x: return #x; - switch (s) { - SN(DebuggerNotReady) - SN(EngineSetupRequested) - SN(EngineSetupOk) - SN(EngineSetupFailed) - SN(EngineRunFailed) - SN(InferiorSetupRequested) - SN(InferiorSetupFailed) - SN(EngineRunRequested) - SN(InferiorRunRequested) - SN(InferiorRunOk) - SN(InferiorRunFailed) - SN(InferiorUnrunnable) - SN(InferiorStopRequested) - SN(InferiorStopOk) - SN(InferiorStopFailed) - SN(InferiorShutdownRequested) - SN(InferiorShutdownOk) - SN(InferiorShutdownFailed) - SN(EngineShutdownRequested) - SN(EngineShutdownOk) - SN(EngineShutdownFailed) - SN(DebuggerFinished) - } - return "<unknown>"; -# undef SN -} - /////////////////////////////////////////////////////////////////////// // @@ -336,6 +292,37 @@ DebuggerEngine::~DebuggerEngine() delete d; } +const char *DebuggerEngine::stateName(int s) +{ +# define SN(x) case x: return #x; + switch (s) { + SN(DebuggerNotReady) + SN(EngineSetupRequested) + SN(EngineSetupOk) + SN(EngineSetupFailed) + SN(EngineRunFailed) + SN(InferiorSetupRequested) + SN(InferiorSetupFailed) + SN(EngineRunRequested) + SN(InferiorRunRequested) + SN(InferiorRunOk) + SN(InferiorRunFailed) + SN(InferiorUnrunnable) + SN(InferiorStopRequested) + SN(InferiorStopOk) + SN(InferiorStopFailed) + SN(InferiorShutdownRequested) + SN(InferiorShutdownOk) + SN(InferiorShutdownFailed) + SN(EngineShutdownRequested) + SN(EngineShutdownOk) + SN(EngineShutdownFailed) + SN(DebuggerFinished) + } + return "<unknown>"; +# undef SN +} + void DebuggerEngine::showStatusMessage(const QString &msg, int timeout) const { showMessage(msg, StatusBar, timeout); diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 4ee3a6074fd..5fa1a4d0d01 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -36,12 +36,12 @@ #include "debugger_global.h" #include "debuggerconstants.h" +#include "debuggerstartparameters.h" #include "moduleshandler.h" // For 'Symbols' #include "breakpoint.h" // For 'BreakpointId' #include "stackframe.h" #include <coreplugin/ssh/sshconnection.h> - #include <utils/environment.h> #include <QtCore/QObject> @@ -66,59 +66,6 @@ namespace Debugger { class DebuggerEnginePrivate; class DebuggerRunControl; -class DEBUGGER_EXPORT DebuggerStartParameters -{ -public: - DebuggerStartParameters(); - QString toolChainName() const; - - QString executable; - QString displayName; - QString coreFile; - bool isSnapshot; // set if created internally - QString processArgs; - Utils::Environment environment; - QString workingDirectory; - qint64 attachPID; - bool useTerminal; - - // Used by AttachCrashedExternal. - QString crashParameter; - - // Used by Qml debugging. - QString qmlServerAddress; - quint16 qmlServerPort; - QString projectBuildDir; - QString projectDir; - - // Used by combined cpp+qml debugging. - DebuggerEngineType cppEngineType; - - // Used by remote debugging. - QString remoteChannel; - QString remoteArchitecture; - QString gnuTarget; - QString symbolFileName; - bool useServerStartScript; - QString serverStartScript; - QString sysRoot; - QByteArray remoteDumperLib; - QByteArray remoteSourcesDir; - QString remoteMountPoint; - QString localMountDir; - Core::SshConnectionParameters connParams; - - QString debuggerCommand; - int toolChainType; - QString qtInstallPath; - - QString dumperLibrary; - QStringList dumperLibraryLocations; - DebuggerStartMode startMode; - - // For Symbian debugging. - quint32 executableUid; -}; DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &); DEBUGGER_EXPORT QDebug operator<<(QDebug str, DebuggerState state); @@ -181,6 +128,7 @@ private: quint64 m_address; }; +QString toolChainName(const DebuggerStartParameters &sp); } // namespace Internal diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index e1edcadcd29..68e33e02339 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1339,6 +1339,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) { qRegisterMetaType<WatchData>("WatchData"); qRegisterMetaType<ContextData>("ContextData"); + qRegisterMetaType<DebuggerStartParameters>("DebuggerStartParameters"); QTC_ASSERT(!theDebuggerCore, /**/); theDebuggerCore = this; @@ -2500,7 +2501,7 @@ void DebuggerPluginPrivate::runControlStarted(DebuggerEngine *engine) activateDebugMode(); const QString message = tr("Starting debugger '%1' for tool chain '%2'...") .arg(engine->objectName()) - .arg(engine->startParameters().toolChainName()); + .arg(toolChainName(engine->startParameters())); showMessage(message, StatusBar); showMessage(m_debuggerSettings->dump(), LogDebug); m_snapshotHandler->appendSnapshot(engine); diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index eb274835efd..4e5748154bc 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -373,7 +373,7 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration, debuggingFinished(); // Create Message box with possibility to go to settings. const QString msg = tr("Cannot debug '%1' (tool chain: '%2'): %3") - .arg(sp.executable, sp.toolChainName(), d->m_errorMessage); + .arg(sp.executable, toolChainName(sp), d->m_errorMessage); Core::ICore::instance()->showWarningWithOptions(tr("Warning"), msg, QString(), QLatin1String(Constants::DEBUGGER_SETTINGS_CATEGORY), d->m_settingsIdHint); diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h new file mode 100644 index 00000000000..d2a07770a87 --- /dev/null +++ b/src/plugins/debugger/debuggerstartparameters.h @@ -0,0 +1,119 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef DEBUGGER_DEBUGGERSTARTPARAMETERS_H +#define DEBUGGER_DEBUGGERSTARTPARAMETERS_H + +#include "debugger_global.h" + +#include <coreplugin/ssh/sshconnection.h> +#include <utils/environment.h> +#include <projectexplorer/toolchaintype.h> + +#include <QtCore/QMetaType> + +namespace Debugger { + +// Note: This is part of the "soft interface" of the debugger plugin. +// Do not add anything that needs implementation in a .cpp file. + +class DEBUGGER_EXPORT DebuggerStartParameters +{ +public: + DebuggerStartParameters() + : isSnapshot(false), + attachPID(-1), + useTerminal(false), + qmlServerAddress(QLatin1String("127.0.0.1")), + qmlServerPort(0), + useServerStartScript(false), + connParams(Core::SshConnectionParameters::NoProxy), + toolChainType(ProjectExplorer::ToolChain_UNKNOWN), + startMode(NoStartMode), + executableUid(0) + {} + + QString executable; + QString displayName; + QString coreFile; + bool isSnapshot; // Set if created internally. + QString processArgs; + Utils::Environment environment; + QString workingDirectory; + qint64 attachPID; + bool useTerminal; + + // Used by AttachCrashedExternal. + QString crashParameter; + + // Used by Qml debugging. + QString qmlServerAddress; + quint16 qmlServerPort; + QString projectBuildDir; + QString projectDir; + + // Used by combined cpp+qml debugging. + DebuggerEngineType cppEngineType; + + // Used by remote debugging. + QString remoteChannel; + QString remoteArchitecture; + QString gnuTarget; + QString symbolFileName; + bool useServerStartScript; + QString serverStartScript; + QString sysRoot; + QByteArray remoteDumperLib; + QByteArray remoteSourcesDir; + QString remoteMountPoint; + QString localMountDir; + Core::SshConnectionParameters connParams; + + QString debuggerCommand; + int toolChainType; + QString qtInstallPath; + + QString dumperLibrary; + QStringList dumperLibraryLocations; + DebuggerStartMode startMode; + + // For Symbian debugging. + quint32 executableUid; +}; + +} // namespace Debugger + +Q_DECLARE_METATYPE(Debugger::DebuggerStartParameters) + +#endif // DEBUGGER_DEBUGGERSTARTPARAMETERS_H + -- GitLab