diff options
author | hjk <[email protected]> | 2019-02-18 15:49:05 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2019-02-21 07:56:58 +0000 |
commit | 317ab497936cc6c32da80bd0d3de58975bb308f1 (patch) | |
tree | 60e239efdb796e7bc6d376c789a81da3b30282eb /src/plugins | |
parent | 11f989bb93b055684948220637d5a1fc590534e7 (diff) |
Debugger: Code cosmetics
Move some constants to internalconstants.h or remove them entirely.
Change-Id: Iecd4def3b48130fb390bddf420da672d44e3d6b8
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/debugger/debuggerconstants.h | 73 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerengine.h | 30 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerinternalconstants.h | 56 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 42 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerrunconfigurationaspect.h | 5 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerruncontrol.cpp | 5 | ||||
-rw-r--r-- | src/plugins/debugger/qml/qmlinspectoragent.cpp | 1 |
7 files changed, 105 insertions, 107 deletions
diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index e0ddfff85cf..5c27458f471 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -33,82 +33,11 @@ namespace Constants { // Debug mode const char MODE_DEBUG[] = "Mode.Debug"; -// Contexts +// Debug mode context const char C_DEBUGMODE[] = "Debugger.DebugMode"; -const char C_CPPDEBUGGER[] = "Gdb Debugger"; -const char C_QMLDEBUGGER[] = "Qml/JavaScript Debugger"; -const char C_DEBUGGER_NOTRUNNING[] = "Debugger.NotRunning"; - -const char PRESET_PERSPECTIVE_ID[] = "Debugger.Perspective.Preset"; - -// Menu Groups -const char G_GENERAL[] = "Debugger.Group.General"; -const char G_SPECIAL[] = "Debugger.Group.Special"; -const char G_START_QML[] = "Debugger.Group.Start.Qml"; - -// Common actions -const char INTERRUPT[] = "Debugger.Interrupt"; -const char CONTINUE[] = "Debugger.Continue"; -const char STOP[] = "Debugger.Stop"; -const char ABORT[] = "Debugger.Abort"; -const char STEP[] = "Debugger.StepLine"; -const char STEPOUT[] = "Debugger.StepOut"; -const char NEXT[] = "Debugger.NextLine"; -const char RUNTOLINE[] = "Debugger.RunToLine"; -const char RUNTOSELECTEDFUNCTION[] = "Debugger.RunToSelectedFunction"; -const char JUMPTOLINE[] = "Debugger.JumpToLine"; -const char RETURNFROMFUNCTION[] = "Debugger.ReturnFromFunction"; -const char RESET[] = "Debugger.Reset"; -const char WATCH[] = "Debugger.AddToWatch"; -const char DETACH[] = "Debugger.Detach"; -const char OPERATE_BY_INSTRUCTION[] = "Debugger.OperateByInstruction"; -const char OPEN_MEMORY_EDITOR[] = "Debugger.Views.OpenMemoryEditor"; -const char FRAME_UP[] = "Debugger.FrameUp"; -const char FRAME_DOWN[] = "Debugger.FrameDown"; -const char QML_SHOW_APP_ON_TOP[] = "Debugger.QmlShowAppOnTop"; -const char QML_SELECTTOOL[] = "Debugger.QmlSelectTool"; - -const char TASK_CATEGORY_DEBUGGER_DEBUGINFO[] = "Debuginfo"; -const char TASK_CATEGORY_DEBUGGER_RUNTIME[] = "DebugRuntime"; - -const char TEXT_MARK_CATEGORY_BREAKPOINT[] = "Debugger.Mark.Breakpoint"; -const char TEXT_MARK_CATEGORY_LOCATION[] = "Debugger.Mark.Location"; - -// Run Configuration Aspect defaults: -const int QML_DEFAULT_DEBUG_SERVER_PORT = 3768; } // namespace Constants -enum DebuggerState -{ - DebuggerNotReady, // Debugger not started - - EngineSetupRequested, // Engine starts - EngineSetupFailed, - EngineSetupOk, - - EngineRunRequested, - EngineRunFailed, - - InferiorUnrunnable, // Used in the core dump adapter - - InferiorRunRequested, // Debuggee requested to run - InferiorRunOk, // Debuggee running - InferiorRunFailed, // Debuggee running - - InferiorStopRequested, // Debuggee running, stop requested - InferiorStopOk, // Debuggee stopped - InferiorStopFailed, // Debuggee not stopped, will kill debugger - - InferiorShutdownRequested, - InferiorShutdownFinished, - - EngineShutdownRequested, - EngineShutdownFinished, - - DebuggerFinished -}; - // Keep in sync with dumper.py enum DebuggerStartMode { diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 12e4356ce0d..3e4ab4888ee 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -56,6 +56,36 @@ namespace Debugger { class DebuggerRunTool; +enum DebuggerState +{ + DebuggerNotReady, // Debugger not started + + EngineSetupRequested, // Engine starts + EngineSetupFailed, + EngineSetupOk, + + EngineRunRequested, + EngineRunFailed, + + InferiorUnrunnable, // Used in the core dump adapter + + InferiorRunRequested, // Debuggee requested to run + InferiorRunOk, // Debuggee running + InferiorRunFailed, // Debuggee not running + + InferiorStopRequested, // Debuggee running, stop requested + InferiorStopOk, // Debuggee stopped + InferiorStopFailed, // Debuggee not stopped, will kill debugger + + InferiorShutdownRequested, + InferiorShutdownFinished, + + EngineShutdownRequested, + EngineShutdownFinished, + + DebuggerFinished +}; + DEBUGGER_EXPORT QDebug operator<<(QDebug str, DebuggerState state); namespace Internal { diff --git a/src/plugins/debugger/debuggerinternalconstants.h b/src/plugins/debugger/debuggerinternalconstants.h index cb9591e8ad9..7e1cf857dfe 100644 --- a/src/plugins/debugger/debuggerinternalconstants.h +++ b/src/plugins/debugger/debuggerinternalconstants.h @@ -46,22 +46,50 @@ const char DOCKWIDGET_LOCALS_AND_INSPECTOR[] = "Debugger.Docks.LocalsAndInspecto } // namespace Internal -namespace Constants { - -const char DEBUGGER_COMMON_SETTINGS_ID[] = "A.Debugger.General"; -const char DEBUGGER_SETTINGS_CATEGORY[] = "O.Debugger"; - -namespace Internal { - enum { debug = 0 }; -} // namespace Internal -const char OPENED_BY_DEBUGGER[] = "OpenedByDebugger"; -const char OPENED_WITH_DISASSEMBLY[] = "DisassemblerView"; -const char DISASSEMBLER_SOURCE_FILE[] = "DisassemblerSourceFile"; +namespace Constants { -// Debug action -const char DEBUG[] = "Debugger.Debug"; -const int P_ACTION_DEBUG = 90; // Priority for the modemanager. +// Common actions +const char INTERRUPT[] = "Debugger.Interrupt"; +const char CONTINUE[] = "Debugger.Continue"; +const char STOP[] = "Debugger.Stop"; +const char ABORT[] = "Debugger.Abort"; +const char STEP[] = "Debugger.StepLine"; +const char STEPOUT[] = "Debugger.StepOut"; +const char NEXT[] = "Debugger.NextLine"; +const char RUNTOLINE[] = "Debugger.RunToLine"; +const char RUNTOSELECTEDFUNCTION[] = "Debugger.RunToSelectedFunction"; +const char JUMPTOLINE[] = "Debugger.JumpToLine"; +const char RETURNFROMFUNCTION[] = "Debugger.ReturnFromFunction"; +const char RESET[] = "Debugger.Reset"; +const char WATCH[] = "Debugger.AddToWatch"; +const char DETACH[] = "Debugger.Detach"; +const char OPERATE_BY_INSTRUCTION[] = "Debugger.OperateByInstruction"; +const char OPEN_MEMORY_EDITOR[] = "Debugger.Views.OpenMemoryEditor"; +const char FRAME_UP[] = "Debugger.FrameUp"; +const char FRAME_DOWN[] = "Debugger.FrameDown"; +const char QML_SHOW_APP_ON_TOP[] = "Debugger.QmlShowAppOnTop"; +const char QML_SELECTTOOL[] = "Debugger.QmlSelectTool"; + +const char DEBUGGER_COMMON_SETTINGS_ID[] = "A.Debugger.General"; +const char DEBUGGER_SETTINGS_CATEGORY[] = "O.Debugger"; + +// Contexts +const char C_CPPDEBUGGER[] = "Gdb Debugger"; +const char C_QMLDEBUGGER[] = "Qml/JavaScript Debugger"; +const char C_DEBUGGER_NOTRUNNING[] = "Debugger.NotRunning"; + +const char PRESET_PERSPECTIVE_ID[] = "Debugger.Perspective.Preset"; + +const char TASK_CATEGORY_DEBUGGER_DEBUGINFO[] = "Debuginfo"; +const char TASK_CATEGORY_DEBUGGER_RUNTIME[] = "DebugRuntime"; + +const char TEXT_MARK_CATEGORY_BREAKPOINT[] = "Debugger.Mark.Breakpoint"; +const char TEXT_MARK_CATEGORY_LOCATION[] = "Debugger.Mark.Location"; + +const char OPENED_BY_DEBUGGER[] = "OpenedByDebugger"; +const char OPENED_WITH_DISASSEMBLY[] = "DisassemblerView"; +const char DISASSEMBLER_SOURCE_FILE[] = "DisassemblerSourceFile"; } // namespace Constants diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 771eac9be1d..648213c8626 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -395,6 +395,11 @@ namespace Internal { const char DEBUGGER_START[] = "Debugger.Start"; +// Menu Groups +const char MENU_GROUP_GENERAL[] = "Debugger.Group.General"; +const char MENU_GROUP_SPECIAL[] = "Debugger.Group.Special"; +const char MENU_GROUP_START_QML[] = "Debugger.Group.Start.Qml"; + void addCdbOptionPages(QList<IOptionsPage*> *opts); void addGdbOptionPages(QList<IOptionsPage*> *opts); @@ -1100,15 +1105,16 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, // "Start Debugging" sub-menu // groups: // G_DEFAULT_ONE - // G_START_LOCAL - // G_START_REMOTE - // G_START_QML + // MENU_GROUP_START_LOCAL + // MENU_GROUP_START_REMOTE + // MENU_GROUP_START_QML ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); const QKeySequence startShortcut(useMacShortcuts ? tr("Ctrl+Y") : tr("F5")); - cmd = ActionManager::registerAction(&m_visibleStartAction, Constants::DEBUG); + cmd = ActionManager::registerAction(&m_visibleStartAction, "Debugger.Debug"); + cmd->setDescription(tr("Start Debugging or Continue")); cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateIcon); @@ -1126,7 +1132,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, m_visibleStartAction.setAction(&m_startAction); m_visibleStartAction.setObjectName("Debug"); // used for UI introduction - ModeManager::addAction(&m_visibleStartAction, Constants::P_ACTION_DEBUG); + ModeManager::addAction(&m_visibleStartAction, /*priority*/ 90); m_undisturbableAction.setIcon(interruptIcon(false)); m_undisturbableAction.setEnabled(false); @@ -1139,40 +1145,40 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, cmd = ActionManager::registerAction(&m_attachToRunningApplication, "Debugger.AttachToRemoteProcess"); cmd->setDescription(tr("Attach to Running Application")); - mstart->addAction(cmd, G_GENERAL); + mstart->addAction(cmd, MENU_GROUP_GENERAL); cmd = ActionManager::registerAction(&m_attachToUnstartedApplication, "Debugger.AttachToUnstartedProcess"); cmd->setDescription(tr("Attach to Unstarted Application")); - mstart->addAction(cmd, G_GENERAL); + mstart->addAction(cmd, MENU_GROUP_GENERAL); cmd = ActionManager::registerAction(&m_startAndDebugApplicationAction, "Debugger.StartAndDebugApplication"); cmd->setAttribute(Command::CA_Hide); - mstart->addAction(cmd, G_GENERAL); + mstart->addAction(cmd, MENU_GROUP_GENERAL); cmd = ActionManager::registerAction(&m_attachToCoreAction, "Debugger.AttachCore"); cmd->setAttribute(Command::CA_Hide); - mstart->addAction(cmd, Constants::G_GENERAL); + mstart->addAction(cmd, MENU_GROUP_GENERAL); cmd = ActionManager::registerAction(&m_attachToRemoteServerAction, "Debugger.AttachToRemoteServer"); cmd->setAttribute(Command::CA_Hide); - mstart->addAction(cmd, Constants::G_SPECIAL); + mstart->addAction(cmd, MENU_GROUP_SPECIAL); if (HostOsInfo::isWindowsHost()) { cmd = ActionManager::registerAction(&m_startRemoteCdbAction, "Debugger.AttachRemoteCdb"); cmd->setAttribute(Command::CA_Hide); - mstart->addAction(cmd, Constants::G_SPECIAL); + mstart->addAction(cmd, MENU_GROUP_SPECIAL); } - mstart->addSeparator(Context(CC::C_GLOBAL), Constants::G_START_QML); + mstart->addSeparator(Context(CC::C_GLOBAL), MENU_GROUP_START_QML); cmd = ActionManager::registerAction(&m_attachToQmlPortAction, "Debugger.AttachToQmlPort"); cmd->setAttribute(Command::CA_Hide); - mstart->addAction(cmd, Constants::G_START_QML); + mstart->addAction(cmd, MENU_GROUP_START_QML); act = new QAction(tr("Detach Debugger"), this); act->setEnabled(false); @@ -2243,13 +2249,13 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess // Menu groups ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); - mstart->appendGroup(Constants::G_GENERAL); - mstart->appendGroup(Constants::G_SPECIAL); - mstart->appendGroup(Constants::G_START_QML); + mstart->appendGroup(MENU_GROUP_GENERAL); + mstart->appendGroup(MENU_GROUP_SPECIAL); + mstart->appendGroup(MENU_GROUP_START_QML); // Separators - mstart->addSeparator(Constants::G_GENERAL); - mstart->addSeparator(Constants::G_SPECIAL); + mstart->addSeparator(MENU_GROUP_GENERAL); + mstart->addSeparator(MENU_GROUP_SPECIAL); KitManager::registerKitAspect<DebuggerKitAspect>(); diff --git a/src/plugins/debugger/debuggerrunconfigurationaspect.h b/src/plugins/debugger/debuggerrunconfigurationaspect.h index a361f234c4f..04d6f9519a9 100644 --- a/src/plugins/debugger/debuggerrunconfigurationaspect.h +++ b/src/plugins/debugger/debuggerrunconfigurationaspect.h @@ -45,7 +45,10 @@ class DEBUGGER_EXPORT DebuggerRunConfigurationAspectData public: DebuggerLanguageStatus useCppDebugger = AutoEnabledLanguage; DebuggerLanguageStatus useQmlDebugger = AutoEnabledLanguage; - uint qmlDebugServerPort = Constants::QML_DEFAULT_DEBUG_SERVER_PORT; + + const uint QML_DEFAULT_DEBUG_SERVER_PORT = 3768; + uint qmlDebugServerPort = QML_DEFAULT_DEBUG_SERVER_PORT; + bool useMultiProcess = false; }; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 6379b9a5260..fcb84b61043 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -31,6 +31,7 @@ #include "debuggeractions.h" #include "debuggercore.h" #include "debuggerengine.h" +#include "debuggerinternalconstants.h" #include "debuggerkitinformation.h" #include "debuggerplugin.h" #include "debuggerrunconfigurationaspect.h" @@ -522,8 +523,8 @@ void DebuggerRunTool::addSearchDirectory(const Utils::FileName &dir) void DebuggerRunTool::start() { - TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO); - TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); + TaskHub::clearTasks(Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO); + TaskHub::clearTasks(Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); if (d->portsGatherer) { setRemoteChannel(d->portsGatherer->gdbServer()); diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index 36272270c9e..86d429749e9 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -29,6 +29,7 @@ #include <debugger/debuggeractions.h> #include <debugger/debuggercore.h> #include <debugger/debuggerengine.h> +#include <debugger/debuggerinternalconstants.h> #include <debugger/debuggerruncontrol.h> #include <debugger/watchhandler.h> |