2010-06-16 11:08:54 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** 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
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef DEBUGGER_DEBUGGERENGINE_H
|
|
|
|
|
#define DEBUGGER_DEBUGGERENGINE_H
|
|
|
|
|
|
|
|
|
|
#include "debugger_global.h"
|
|
|
|
|
#include "debuggerconstants.h"
|
|
|
|
|
#include "moduleshandler.h" // For 'Symbols'
|
2010-11-10 16:33:11 +01:00
|
|
|
#include "breakpoint.h" // For 'BreakpointId'
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
#include <coreplugin/ssh/sshconnection.h>
|
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
#include <utils/environment.h>
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QDebug;
|
|
|
|
|
class QPoint;
|
2010-07-21 14:24:29 +02:00
|
|
|
class QMessageBox;
|
2010-06-16 11:08:54 +02:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace TextEditor {
|
|
|
|
|
class ITextEditor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class IOptionsPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
class DebuggerEnginePrivate;
|
2010-11-08 15:19:13 +01:00
|
|
|
class DebuggerRunControl;
|
2010-09-13 13:30:35 +02:00
|
|
|
class QmlCppEngine;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
class DEBUGGER_EXPORT DebuggerStartParameters
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DebuggerStartParameters();
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
|
|
QString executable;
|
|
|
|
|
QString displayName;
|
|
|
|
|
QString coreFile;
|
2010-09-07 14:19:44 +02:00
|
|
|
bool isSnapshot; // set if created internally
|
2010-10-19 11:14:03 +02:00
|
|
|
QString processArgs;
|
|
|
|
|
Utils::Environment environment;
|
2010-06-16 11:08:54 +02:00
|
|
|
QString workingDirectory;
|
|
|
|
|
qint64 attachPID;
|
|
|
|
|
bool useTerminal;
|
|
|
|
|
bool breakAtMain;
|
|
|
|
|
QString crashParameter; // for AttachCrashedExternal
|
2010-07-30 12:14:54 +02:00
|
|
|
|
2010-08-13 14:18:10 +02:00
|
|
|
// for qml debugging
|
|
|
|
|
QString qmlServerAddress;
|
|
|
|
|
quint16 qmlServerPort;
|
2010-09-08 13:31:12 +02:00
|
|
|
QString projectBuildDir;
|
|
|
|
|
QString projectDir;
|
|
|
|
|
// for cpp+qml debugging
|
|
|
|
|
DebuggerEngineType cppEngineType;
|
2010-08-13 14:18:10 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
// for remote debugging
|
|
|
|
|
QString remoteChannel;
|
|
|
|
|
QString remoteArchitecture;
|
2010-10-29 14:04:23 +02:00
|
|
|
QString gnuTarget;
|
2010-06-16 11:08:54 +02:00
|
|
|
QString symbolFileName;
|
2010-09-06 11:33:07 +02:00
|
|
|
bool useServerStartScript;
|
2010-06-16 11:08:54 +02:00
|
|
|
QString serverStartScript;
|
|
|
|
|
QString sysRoot;
|
2010-07-30 12:14:54 +02:00
|
|
|
QByteArray remoteDumperLib;
|
|
|
|
|
QByteArray remoteSourcesDir;
|
2010-08-09 15:27:21 +02:00
|
|
|
QString remoteMountPoint;
|
|
|
|
|
QString localMountDir;
|
2010-07-30 12:14:54 +02:00
|
|
|
Core::SshConnectionParameters connParams;
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
QString debuggerCommand;
|
|
|
|
|
int toolChainType;
|
|
|
|
|
QString qtInstallPath;
|
|
|
|
|
|
|
|
|
|
QString dumperLibrary;
|
|
|
|
|
QStringList dumperLibraryLocations;
|
|
|
|
|
DebuggerStartMode startMode;
|
2010-08-20 12:58:37 +02:00
|
|
|
|
|
|
|
|
// for SymbianOS debugging
|
|
|
|
|
quint32 executableUid;
|
2010-06-16 11:08:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &);
|
|
|
|
|
DEBUGGER_EXPORT QDebug operator<<(QDebug str, DebuggerState state);
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-11-10 11:39:01 +01:00
|
|
|
class DebuggerPluginPrivate;
|
2010-06-16 11:08:54 +02:00
|
|
|
class DisassemblerViewAgent;
|
|
|
|
|
class MemoryViewAgent;
|
|
|
|
|
class WatchData;
|
|
|
|
|
class BreakHandler;
|
|
|
|
|
class ModulesHandler;
|
|
|
|
|
class RegisterHandler;
|
|
|
|
|
class StackHandler;
|
|
|
|
|
class StackFrame;
|
|
|
|
|
class SourceFilesHandler;
|
|
|
|
|
class ThreadsHandler;
|
|
|
|
|
class WatchHandler;
|
2010-11-16 11:48:17 +01:00
|
|
|
class BreakpointParameters;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-09-13 08:32:12 +02:00
|
|
|
struct WatchUpdateFlags
|
|
|
|
|
{
|
|
|
|
|
WatchUpdateFlags() : tryIncremental(false) {}
|
|
|
|
|
bool tryIncremental;
|
|
|
|
|
};
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
} // namespace Internal
|
2010-09-13 08:32:12 +02:00
|
|
|
|
2010-11-08 15:19:13 +01:00
|
|
|
|
2010-06-25 14:08:53 +02:00
|
|
|
// FIXME: DEBUGGER_EXPORT?
|
|
|
|
|
class DEBUGGER_EXPORT DebuggerEngine : public QObject
|
2010-06-16 11:08:54 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-09-13 13:30:35 +02:00
|
|
|
explicit DebuggerEngine(const DebuggerStartParameters &sp);
|
2010-06-16 11:08:54 +02:00
|
|
|
virtual ~DebuggerEngine();
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void setToolTipExpression(const QPoint & mousePos,
|
2010-11-08 15:19:13 +01:00
|
|
|
TextEditor::ITextEditor *editor, int cursorPos);
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void updateWatchData(const Internal::WatchData &data,
|
2010-10-27 14:21:33 +02:00
|
|
|
const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());
|
2010-06-16 11:08:54 +02:00
|
|
|
void startDebugger(DebuggerRunControl *runControl);
|
2010-09-13 13:30:35 +02:00
|
|
|
|
|
|
|
|
virtual void watchPoint(const QPoint &);
|
|
|
|
|
virtual void fetchMemory(Internal::MemoryViewAgent *, QObject *,
|
|
|
|
|
quint64 addr, quint64 length);
|
|
|
|
|
virtual void fetchDisassembler(Internal::DisassemblerViewAgent *);
|
|
|
|
|
virtual void activateFrame(int index);
|
|
|
|
|
|
|
|
|
|
virtual void reloadModules();
|
|
|
|
|
virtual void examineModules();
|
|
|
|
|
virtual void loadSymbols(const QString &moduleName);
|
|
|
|
|
virtual void loadAllSymbols();
|
|
|
|
|
virtual void requestModuleSymbols(const QString &moduleName);
|
|
|
|
|
|
|
|
|
|
virtual void reloadRegisters();
|
|
|
|
|
virtual void reloadSourceFiles();
|
|
|
|
|
virtual void reloadFullStack();
|
2010-07-08 18:10:50 +02:00
|
|
|
|
|
|
|
|
virtual void setRegisterValue(int regnr, const QString &value);
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
|
|
|
|
|
virtual unsigned debuggerCapabilities() const;
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual bool isSynchronous() const;
|
|
|
|
|
virtual QByteArray qtNamespace() const;
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void createSnapshot();
|
|
|
|
|
virtual void updateAll();
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-11-08 18:55:32 +01:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
virtual bool stateAcceptsBreakpointChanges() const { return true; }
|
|
|
|
|
virtual void attemptBreakpointSynchronization();
|
|
|
|
|
virtual bool acceptsBreakpoint(BreakpointId id) const; // FIXME: make pure
|
|
|
|
|
virtual void insertBreakpoint(BreakpointId id); // FIXME: make pure
|
|
|
|
|
virtual void removeBreakpoint(BreakpointId id); // FIXME: make pure
|
|
|
|
|
virtual void changeBreakpoint(BreakpointId id); // FIXME: make pure
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-11-08 15:19:13 +01:00
|
|
|
virtual void assignValueInDebugger(const Internal::WatchData *data,
|
|
|
|
|
const QString &expr, const QVariant &value);
|
2010-09-15 19:02:12 +02:00
|
|
|
virtual void removeTooltip();
|
2010-11-10 16:33:11 +01:00
|
|
|
virtual void selectThread(int index);
|
2010-07-21 14:24:29 +02:00
|
|
|
|
2010-07-08 18:10:50 +02:00
|
|
|
protected:
|
2010-11-10 11:39:01 +01:00
|
|
|
friend class Internal::DebuggerPluginPrivate;
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void detachDebugger();
|
2010-11-08 17:43:31 +01:00
|
|
|
virtual void exitDebugger();
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void executeStep();
|
|
|
|
|
virtual void executeStepOut() ;
|
|
|
|
|
virtual void executeNext();
|
|
|
|
|
virtual void executeStepI();
|
|
|
|
|
virtual void executeNextI();
|
|
|
|
|
virtual void executeReturn();
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void continueInferior();
|
|
|
|
|
virtual void interruptInferior();
|
2010-07-20 12:14:59 +02:00
|
|
|
virtual void requestInterruptInferior();
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void executeRunToLine(const QString &fileName, int lineNumber);
|
|
|
|
|
virtual void executeRunToFunction(const QString &functionName);
|
|
|
|
|
virtual void executeJumpToLine(const QString &fileName, int lineNumber);
|
|
|
|
|
virtual void executeDebuggerCommand(const QString &command);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
virtual void frameUp();
|
|
|
|
|
virtual void frameDown();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
const DebuggerStartParameters &startParameters() const;
|
|
|
|
|
DebuggerStartParameters &startParameters();
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
Internal::ModulesHandler *modulesHandler() const;
|
|
|
|
|
Internal::RegisterHandler *registerHandler() const;
|
|
|
|
|
Internal::StackHandler *stackHandler() const;
|
|
|
|
|
Internal::ThreadsHandler *threadsHandler() const;
|
|
|
|
|
Internal::WatchHandler *watchHandler() const;
|
|
|
|
|
Internal::SourceFilesHandler *sourceFilesHandler() const;
|
2010-11-04 09:54:23 +01:00
|
|
|
Internal::BreakHandler *breakHandler() const;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
virtual QAbstractItemModel *modulesModel() const;
|
|
|
|
|
virtual QAbstractItemModel *registerModel() const;
|
|
|
|
|
virtual QAbstractItemModel *stackModel() const;
|
|
|
|
|
virtual QAbstractItemModel *threadsModel() const;
|
|
|
|
|
virtual QAbstractItemModel *localsModel() const;
|
|
|
|
|
virtual QAbstractItemModel *watchersModel() const;
|
|
|
|
|
virtual QAbstractItemModel *returnModel() const;
|
|
|
|
|
virtual QAbstractItemModel *sourceFilesModel() const;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-21 11:02:51 +02:00
|
|
|
void progressPing();
|
2010-06-22 15:14:44 +02:00
|
|
|
void handleFinished();
|
2010-07-20 18:31:35 +02:00
|
|
|
void handleStartFailed();
|
2010-06-16 11:08:54 +02:00
|
|
|
bool debuggerActionsEnabled() const;
|
|
|
|
|
static bool debuggerActionsEnabled(DebuggerState state);
|
2010-09-13 13:30:35 +02:00
|
|
|
void showModuleSymbols(const QString &moduleName, const Internal::Symbols &symbols);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
void breakByFunction(const QString &functionName);
|
|
|
|
|
void breakByFunctionMain();
|
|
|
|
|
|
|
|
|
|
DebuggerState state() const;
|
2010-07-09 17:07:59 +02:00
|
|
|
DebuggerState lastGoodState() const;
|
|
|
|
|
DebuggerState targetState() const;
|
2010-09-13 13:30:35 +02:00
|
|
|
bool isDying() const;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
// Dumper stuff (common to cdb and gdb).
|
|
|
|
|
bool qtDumperLibraryEnabled() const;
|
|
|
|
|
QString qtDumperLibraryName() const;
|
|
|
|
|
QStringList qtDumperLibraryLocations() const;
|
2010-07-21 12:04:20 +02:00
|
|
|
void showQtDumperLibraryWarning(const QString &details);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
|
|
|
|
static const char *stateName(int s);
|
|
|
|
|
|
|
|
|
|
void notifyInferiorPid(qint64 pid);
|
|
|
|
|
qint64 inferiorPid() const;
|
|
|
|
|
bool isReverseDebugging() const;
|
2010-07-13 17:16:31 +02:00
|
|
|
bool isActive() const; // True if this is the currently active engine;
|
|
|
|
|
void setActive(bool on); // FIXME: private?
|
2010-06-22 15:37:27 +02:00
|
|
|
void handleCommand(int role, const QVariant &value);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-07-09 08:48:33 +02:00
|
|
|
// Convenience
|
2010-07-14 16:01:53 +02:00
|
|
|
Q_SLOT void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1) const;
|
|
|
|
|
Q_SLOT void showStatusMessage(const QString &msg, int timeout = -1) const;
|
2010-07-09 08:48:33 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void resetLocation();
|
2010-09-08 13:31:12 +02:00
|
|
|
virtual void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual void gotoLocation(const Internal::StackFrame &frame, bool setMarker);
|
2010-07-09 17:07:59 +02:00
|
|
|
virtual void quitDebugger(); // called by DebuggerRunControl
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-10-27 14:21:33 +02:00
|
|
|
virtual void updateViews();
|
2010-10-28 08:55:50 +02:00
|
|
|
bool isSlaveEngine() const;
|
2010-10-27 14:21:33 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
signals:
|
|
|
|
|
void stateChanged(const DebuggerState &state);
|
2010-10-27 14:21:33 +02:00
|
|
|
void updateViewsRequested();
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
protected:
|
2010-08-11 09:46:39 +02:00
|
|
|
// The base notify*() function implementation should be sufficient
|
|
|
|
|
// in most cases, but engines are free to override them to do some
|
|
|
|
|
// engine specific cleanup like stopping timers etc.
|
|
|
|
|
virtual void notifyEngineSetupOk();
|
|
|
|
|
virtual void notifyEngineSetupFailed();
|
|
|
|
|
virtual void notifyEngineRunFailed();
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-08-11 09:46:39 +02:00
|
|
|
virtual void notifyInferiorSetupOk();
|
|
|
|
|
virtual void notifyInferiorSetupFailed();
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-08-11 09:46:39 +02:00
|
|
|
virtual void notifyEngineRunAndInferiorRunOk();
|
|
|
|
|
virtual void notifyEngineRunAndInferiorStopOk();
|
|
|
|
|
virtual void notifyInferiorUnrunnable(); // Called by CoreAdapter.
|
2010-07-13 08:41:27 +02:00
|
|
|
|
|
|
|
|
// Use notifyInferiorRunRequested() plus notifyInferiorRunOk() instead.
|
2010-08-11 09:46:39 +02:00
|
|
|
//virtual void notifyInferiorSpontaneousRun();
|
2010-07-09 17:07:59 +02:00
|
|
|
|
2010-08-11 09:46:39 +02:00
|
|
|
virtual void notifyInferiorRunRequested();
|
|
|
|
|
virtual void notifyInferiorRunOk();
|
|
|
|
|
virtual void notifyInferiorRunFailed();
|
2010-07-09 17:07:59 +02:00
|
|
|
|
2010-08-11 09:46:39 +02:00
|
|
|
virtual void notifyInferiorStopOk();
|
|
|
|
|
virtual void notifyInferiorSpontaneousStop();
|
|
|
|
|
virtual void notifyInferiorStopFailed();
|
|
|
|
|
virtual void notifyInferiorExited();
|
2010-07-09 17:07:59 +02:00
|
|
|
|
2010-08-11 09:46:39 +02:00
|
|
|
virtual void notifyInferiorShutdownOk();
|
|
|
|
|
virtual void notifyInferiorShutdownFailed();
|
2010-07-09 17:07:59 +02:00
|
|
|
|
2010-08-11 09:46:39 +02:00
|
|
|
virtual void notifyEngineSpontaneousShutdown();
|
|
|
|
|
virtual void notifyEngineShutdownOk();
|
|
|
|
|
virtual void notifyEngineShutdownFailed();
|
2010-07-09 08:48:33 +02:00
|
|
|
|
2010-08-11 09:46:39 +02:00
|
|
|
virtual void notifyInferiorIll();
|
|
|
|
|
virtual void notifyEngineIll();
|
2010-07-09 08:48:33 +02:00
|
|
|
|
2010-07-09 17:07:59 +02:00
|
|
|
virtual void setupEngine() = 0;
|
|
|
|
|
virtual void setupInferior() = 0;
|
|
|
|
|
virtual void runEngine() = 0;
|
|
|
|
|
virtual void shutdownInferior() = 0;
|
|
|
|
|
virtual void shutdownEngine() = 0;
|
2010-07-08 18:10:50 +02:00
|
|
|
|
2010-07-08 15:06:09 +02:00
|
|
|
void setState(DebuggerState state, bool forced = false);
|
2010-10-27 14:25:36 +02:00
|
|
|
void setSlaveEngine(bool value);
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2010-08-25 16:48:35 +02:00
|
|
|
protected:
|
2010-08-18 13:54:12 +02:00
|
|
|
DebuggerRunControl *runControl() const;
|
2010-07-08 15:06:09 +02:00
|
|
|
|
2010-06-22 17:18:29 +02:00
|
|
|
private:
|
2010-08-18 13:54:12 +02:00
|
|
|
// wrapper engine needs access to state of its subengines
|
|
|
|
|
friend class QmlCppEngine;
|
|
|
|
|
|
2010-07-08 18:10:50 +02:00
|
|
|
friend class DebuggerEnginePrivate;
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerEnginePrivate *d;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
#endif // DEBUGGER_DEBUGGERENGINE_H
|