forked from qt-creator/qt-creator
Debugger: Code cosmetics
Move some constants to internalconstants.h or remove them entirely. Change-Id: Iecd4def3b48130fb390bddf420da672d44e3d6b8 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
@@ -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 {
|
||||
|
@@ -46,23 +46,51 @@ const char DOCKWIDGET_LOCALS_AND_INSPECTOR[] = "Debugger.Docks.LocalsAndInspecto
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
|
||||
namespace Constants {
|
||||
|
||||
// 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";
|
||||
|
||||
namespace Internal {
|
||||
enum { debug = 0 };
|
||||
} // namespace Internal
|
||||
// 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";
|
||||
|
||||
// Debug action
|
||||
const char DEBUG[] = "Debugger.Debug";
|
||||
const int P_ACTION_DEBUG = 90; // Priority for the modemanager.
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
enum ModelRoles
|
||||
|
@@ -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>();
|
||||
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
@@ -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());
|
||||
|
@@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user