Files
qt-creator/src/plugins/debugger/debuggermanager.h

315 lines
8.9 KiB
C
Raw Normal View History

/**************************************************************************
2008-12-02 12:01:29 +01:00
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2008-12-02 12:01:29 +01:00
**
** Contact: Nokia Corporation (qt-info@nokia.com)
2008-12-02 12:01:29 +01:00
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
2009-08-14 09:30:56 +02:00
** contact the sales department at http://qt.nokia.com/contact.
2008-12-02 12:01:29 +01:00
**
**************************************************************************/
2008-12-02 15:08:31 +01:00
2008-12-02 12:01:29 +01:00
#ifndef DEBUGGER_DEBUGGERMANAGER_H
#define DEBUGGER_DEBUGGERMANAGER_H
#include "debuggerconstants.h"
2008-12-02 12:01:29 +01:00
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
2008-12-02 12:01:29 +01:00
#include <QtCore/QStringList>
#include <QtCore/QVariant>
QT_BEGIN_NAMESPACE
class QAction;
class QDockWidget;
class QLabel;
class QDebug;
class QAbstractItemModel;
class QPoint;
class QVariant;
2008-12-02 12:01:29 +01:00
QT_END_NAMESPACE
namespace Core {
class IOptionsPage;
namespace Utils {
class FancyMainWindow;
}
} // namespace Core
namespace TextEditor {
class ITextEditor;
}
2008-12-02 12:01:29 +01:00
namespace Debugger {
namespace Internal {
class DebuggerOutputWindow;
class DebuggerPlugin;
class BreakHandler;
class BreakpointData;
2008-12-02 12:01:29 +01:00
class ModulesHandler;
class RegisterHandler;
class SourceFilesWindow;
struct StackFrame;
2008-12-02 12:01:29 +01:00
class StackHandler;
class Symbol;
2008-12-02 12:01:29 +01:00
class ThreadsHandler;
class WatchData;
class WatchHandler;
class IDebuggerEngine;
class GdbEngine;
class ScriptEngine;
class CdbDebugEngine;
struct CdbDebugEnginePrivate;
struct DebuggerManagerActions;
2008-12-02 12:01:29 +01:00
class DebuggerStartParameters
{
public:
DebuggerStartParameters();
void clear();
QString executable;
QString coreFile;
QStringList processArgs;
QStringList environment;
QString workingDir;
QString buildDir;
qint64 attachPID;
bool useTerminal;
QString crashParameter; // for AttachCrashedExternal
// for remote debugging
QString remoteChannel;
QString remoteArchitecture;
QString serverStartScript;
int toolChainType;
QString dumperLibrary;
QStringList dumperLibraryLocations;
DebuggerStartMode startMode;
};
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
QDebug operator<<(QDebug str, const DebuggerStartParameters &);
// Flags for initialization
2009-09-10 13:09:42 +02:00
enum DebuggerEngineTypeFlags
{
GdbEngineType = 0x01,
ScriptEngineType = 0x02,
CdbEngineType = 0x04,
TcfEngineType = 0x08,
AllEngineTypes = GdbEngineType
| ScriptEngineType
| CdbEngineType
| TcfEngineType
};
QDebug operator<<(QDebug d, DebuggerState state);
2008-12-02 12:01:29 +01:00
//
// DebuggerManager
2008-12-02 12:01:29 +01:00
//
struct DebuggerManagerPrivate;
class DebuggerManager : public QObject
2008-12-02 12:01:29 +01:00
{
Q_OBJECT
2008-12-02 12:01:29 +01:00
public:
DebuggerManager();
~DebuggerManager();
friend class IDebuggerEngine;
friend class DebuggerPlugin;
2009-02-20 14:56:36 +01:00
friend class CdbDebugEventCallback;
friend class CdbDumperHelper;
friend class CdbExceptionLoggerEventCallback;
friend class GdbEngine;
friend class ScriptEngine;
friend class TcfEngine;
2009-09-25 15:10:19 +02:00
friend class CdbDebugEngine;
friend struct CdbDebugEnginePrivate;
2008-12-02 12:01:29 +01:00
QList<Core::IOptionsPage*> initializeEngines(unsigned enabledTypeFlags);
Core::Utils::FancyMainWindow *mainWindow() const;
QLabel *statusLabel() const;
IDebuggerEngine *currentEngine() const;
2008-12-02 12:01:29 +01:00
DebuggerStartParametersPtr startParameters() const;
qint64 inferiorPid() const;
void showMessageBox(int icon, const QString &title, const QString &text);
2008-12-02 12:01:29 +01:00
public slots:
void startNewDebugger(const DebuggerStartParametersPtr &sp);
void exitDebugger();
2008-12-02 12:01:29 +01:00
void setSimpleDockWidgetArrangement();
void setBusyCursor(bool on);
void queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **ed);
void gotoLocation(const StackFrame &frame, bool setLocationMarker);
void fileOpen(const QString &file);
2008-12-02 12:01:29 +01:00
void resetLocation();
void interruptDebuggingRequest();
void jumpToLineExec();
void runToLineExec();
void runToFunctionExec();
void toggleBreakpoint();
void breakByFunction(const QString &functionName);
void breakByFunctionMain();
2008-12-02 12:01:29 +01:00
void setBreakpoint(const QString &fileName, int lineNumber);
void activateFrame(int index);
void selectThread(int index);
void stepExec();
void stepOutExec();
void nextExec();
void continueExec();
void detachDebugger();
2008-12-02 12:01:29 +01:00
void addToWatchWindow();
void updateWatchData(const WatchData &data);
2008-12-02 12:01:29 +01:00
void sessionLoaded();
void aboutToUnloadSession();
2008-12-02 12:01:29 +01:00
void aboutToSaveSession();
QVariant sessionValue(const QString &name);
void setSessionValue(const QString &name, const QVariant &value);
2008-12-02 12:01:29 +01:00
void assignValueInDebugger();
2008-12-02 12:01:29 +01:00
void assignValueInDebugger(const QString &expr, const QString &value);
void executeDebuggerCommand();
2008-12-02 12:01:29 +01:00
void executeDebuggerCommand(const QString &command);
void watchPoint();
void setRegisterValue(int nr, const QString &value);
void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever
2008-12-02 12:01:29 +01:00
private slots:
2009-09-10 13:09:42 +02:00
void showDebuggerOutput(const QString &msg)
{ showDebuggerOutput(LogDebug, msg); }
void showDebuggerOutput(int channel, const QString &msg);
void showDebuggerInput(int channel, const QString &msg);
void showApplicationOutput(const QString &data);
2008-12-02 12:01:29 +01:00
void reloadSourceFiles();
void sourceFilesDockToggled(bool on);
2008-12-02 12:01:29 +01:00
void reloadModules();
void modulesDockToggled(bool on);
void loadSymbols(const QString &moduleName);
void loadAllSymbols();
void reloadRegisters();
void registerDockToggled(bool on);
void clearStatusMessage();
void attemptBreakpointSynchronization();
void reloadFullStack();
void stepByInstructionTriggered();
2009-09-10 13:09:42 +02:00
void startFailed();
2008-12-02 12:01:29 +01:00
private:
ModulesHandler *modulesHandler() const;
BreakHandler *breakHandler() const;
RegisterHandler *registerHandler() const;
StackHandler *stackHandler() const;
ThreadsHandler *threadsHandler() const;
WatchHandler *watchHandler() const;
SourceFilesWindow *sourceFileWindow() const;
QWidget *threadsWindow() const;
DebuggerManagerActions debuggerManagerActions() const;
2008-12-02 12:01:29 +01:00
void notifyInferiorStopped();
void notifyInferiorRunning();
void notifyInferiorExited();
void notifyInferiorPidChanged(qint64);
2008-12-02 12:01:29 +01:00
void cleanupViews();
2008-12-02 12:01:29 +01:00
DebuggerState state() const;
void setState(DebuggerState state);
//
2008-12-02 12:01:29 +01:00
// internal implementation
//
bool qtDumperLibraryEnabled() const;
QString qtDumperLibraryName() const;
QStringList qtDumperLibraryLocations() const;
void showQtDumperLibraryWarning(const QString &details = QString());
bool isReverseDebugging() const;
QAbstractItemModel *threadsModel();
2008-12-02 12:01:29 +01:00
Q_SLOT void loadSessionData();
Q_SLOT void saveSessionData();
Q_SLOT void dumpLog();
public:
// stuff in this block should be made private by moving it to
2008-12-02 12:01:29 +01:00
// one of the interfaces
QList<Symbol> moduleSymbols(const QString &moduleName);
2008-12-02 12:01:29 +01:00
signals:
void debuggingFinished();
void inferiorPidChanged(qint64 pid);
void stateChanged(int newstatus);
2008-12-02 12:01:29 +01:00
void debugModeRequested();
void previousModeRequested();
void statusMessageRequested(const QString &msg, int timeout); // -1 for 'forever'
void gotoLocationRequested(const StackFrame &frame, bool setLocationMarker);
2008-12-02 12:01:29 +01:00
void resetLocationRequested();
void currentTextEditorRequested(QString *fileName, int *lineNumber, QObject **ob);
void sessionValueRequested(const QString &name, QVariant *value);
void setSessionValueRequested(const QString &name, const QVariant &value);
void configValueRequested(const QString &name, QVariant *value);
void setConfigValueRequested(const QString &name, const QVariant &value);
void applicationOutputAvailable(const QString &output);
2008-12-02 12:01:29 +01:00
private:
void init();
2009-04-06 16:30:11 +02:00
void runTest(const QString &fileName);
Q_SLOT void createNewDock(QWidget *widget);
2008-12-02 12:01:29 +01:00
void shutdown();
void toggleBreakpoint(const QString &fileName, int lineNumber);
void toggleBreakpointEnabled(const QString &fileName, int lineNumber);
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
void setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, int cursorPos);
2008-12-02 12:01:29 +01:00
DebuggerManagerPrivate *d;
2008-12-02 12:01:29 +01:00
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_DEBUGGERMANAGER_H