2010-05-07 15:16:31 +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_BREAKPOINT_H
|
|
|
|
|
#define DEBUGGER_BREAKPOINT_H
|
|
|
|
|
|
2010-11-15 14:12:05 +01:00
|
|
|
#include <QtCore/QCoreApplication>
|
2010-06-16 11:08:54 +02:00
|
|
|
#include <QtCore/QList>
|
2010-11-15 14:12:05 +01:00
|
|
|
#include <QtCore/QMetaType>
|
2010-05-07 15:16:31 +02:00
|
|
|
#include <QtCore/QString>
|
|
|
|
|
|
|
|
|
|
namespace Debugger {
|
2010-11-10 16:33:11 +01:00
|
|
|
|
|
|
|
|
class DebuggerEngine;
|
|
|
|
|
|
|
|
|
|
typedef quint64 BreakpointId; // FIXME: make Internal.
|
|
|
|
|
|
2010-05-07 15:16:31 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-11-15 12:21:43 +01:00
|
|
|
class BreakWindow;
|
|
|
|
|
class BreakpointDialog;
|
2010-05-07 15:16:31 +02:00
|
|
|
class BreakHandler;
|
2010-11-15 12:21:43 +01:00
|
|
|
class BreakpointData;
|
|
|
|
|
|
|
|
|
|
QDataStream &operator>>(QDataStream& stream, BreakpointData &data);
|
2010-05-07 15:16:31 +02:00
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// BreakpointData
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-10-28 12:18:38 +02:00
|
|
|
enum BreakpointType
|
|
|
|
|
{
|
2010-11-10 16:33:11 +01:00
|
|
|
UnknownType,
|
2010-10-28 12:18:38 +02:00
|
|
|
BreakpointByFileAndLine,
|
|
|
|
|
BreakpointByFunction,
|
|
|
|
|
BreakpointByAddress,
|
2010-11-15 14:12:05 +01:00
|
|
|
//BreakpointAtThrow, // FIXME: actually use this
|
|
|
|
|
//BreakpointAtCatch, // FIXME: actually use this
|
2010-10-28 12:18:38 +02:00
|
|
|
Watchpoint,
|
|
|
|
|
};
|
|
|
|
|
|
2010-11-08 18:00:57 +01:00
|
|
|
enum BreakpointState
|
|
|
|
|
{
|
|
|
|
|
BreakpointNew,
|
2010-11-10 16:33:11 +01:00
|
|
|
BreakpointInsertRequested, // Inferior was told about bp, not ack'ed.
|
|
|
|
|
BreakpointInsertProceeding,
|
2010-11-08 18:00:57 +01:00
|
|
|
BreakpointChangeRequested,
|
2010-11-10 16:33:11 +01:00
|
|
|
BreakpointChangeProceeding,
|
|
|
|
|
BreakpointPending,
|
|
|
|
|
BreakpointInserted,
|
|
|
|
|
BreakpointRemoveRequested,
|
|
|
|
|
BreakpointRemoveProceeding,
|
2010-11-08 18:00:57 +01:00
|
|
|
BreakpointDead,
|
|
|
|
|
};
|
|
|
|
|
|
2010-11-15 17:04:29 +01:00
|
|
|
class BreakpointParameters {
|
|
|
|
|
public:
|
|
|
|
|
explicit BreakpointParameters(BreakpointType = UnknownType);
|
|
|
|
|
bool equals(const BreakpointParameters &rhs) const;
|
|
|
|
|
|
|
|
|
|
BreakpointType type; // Type of breakpoint.
|
|
|
|
|
bool enabled; // Should we talk to the debugger engine?
|
|
|
|
|
bool useFullPath; // Should we use the full path when setting the bp?
|
|
|
|
|
QString fileName; // Short name of source file.
|
|
|
|
|
QByteArray condition; // Condition associated with breakpoint.
|
|
|
|
|
int ignoreCount; // Ignore count associated with breakpoint.
|
|
|
|
|
int lineNumber; // Line in source file.
|
|
|
|
|
quint64 address; // Address for watchpoints.
|
|
|
|
|
QByteArray threadSpec; // Thread specification.
|
|
|
|
|
QString functionName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline bool operator==(const BreakpointParameters &p1, const BreakpointParameters &p2)
|
|
|
|
|
{ return p1.equals(p2); }
|
|
|
|
|
inline bool operator!=(const BreakpointParameters &p1, const BreakpointParameters &p2)
|
|
|
|
|
{ return !p1.equals(p2); }
|
|
|
|
|
|
2010-05-07 15:16:31 +02:00
|
|
|
class BreakpointData
|
|
|
|
|
{
|
|
|
|
|
private:
|
2010-11-15 12:21:43 +01:00
|
|
|
friend class BreakHandler; // This should be the only class manipulating data.
|
|
|
|
|
friend class BreakWindow; // FIXME: Remove.
|
|
|
|
|
friend class BreakpointDialog; // FIXME: Remove.
|
|
|
|
|
friend QDataStream &operator>>(QDataStream& stream, BreakpointData &data);
|
2010-05-07 15:16:31 +02:00
|
|
|
|
|
|
|
|
public:
|
2010-11-15 14:12:05 +01:00
|
|
|
explicit BreakpointData(BreakpointType = UnknownType);
|
2010-10-25 14:00:19 +02:00
|
|
|
|
2010-11-15 17:04:29 +01:00
|
|
|
BreakpointType type() const { return m_parameters.type; }
|
|
|
|
|
quint64 address() const { return m_parameters.address; }
|
|
|
|
|
bool useFullPath() const { return m_parameters.useFullPath; }
|
2010-11-10 16:33:11 +01:00
|
|
|
QString toString() const;
|
2010-05-07 15:16:31 +02:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
bool isLocatedAt(const QString &fileName, int lineNumber,
|
|
|
|
|
bool useMarkerPosition) const;
|
2010-11-15 16:22:51 +01:00
|
|
|
bool conditionsMatch(const QByteArray &other) const;
|
2010-11-15 17:04:29 +01:00
|
|
|
QString functionName() const { return m_parameters.functionName; }
|
2010-05-07 15:16:31 +02:00
|
|
|
QString markerFileName() const { return m_markerFileName; }
|
2010-11-15 17:04:29 +01:00
|
|
|
QString fileName() const { return m_parameters.fileName; }
|
2010-05-07 15:16:31 +02:00
|
|
|
int markerLineNumber() const { return m_markerLineNumber; }
|
2010-11-15 17:04:29 +01:00
|
|
|
int lineNumber() const { return m_parameters.lineNumber; }
|
|
|
|
|
int ignoreCount() const { return m_parameters.ignoreCount; }
|
|
|
|
|
bool isEnabled() const { return m_parameters.enabled; }
|
|
|
|
|
QByteArray threadSpec() const { return m_parameters.threadSpec; }
|
|
|
|
|
QByteArray condition() const { return m_parameters.condition; }
|
|
|
|
|
const BreakpointParameters ¶meters() const { return m_parameters; }
|
|
|
|
|
|
|
|
|
|
bool isWatchpoint() const { return type() == Watchpoint; }
|
|
|
|
|
bool isBreakpoint() const { return type() != Watchpoint; } // Enough for now.
|
2010-11-10 16:33:11 +01:00
|
|
|
// Generic name for function to break on 'throw'
|
|
|
|
|
static const char *throwFunction;
|
|
|
|
|
static const char *catchFunction;
|
2010-05-07 15:16:31 +02:00
|
|
|
|
2010-11-15 12:21:43 +01:00
|
|
|
private:
|
2010-11-15 13:12:13 +01:00
|
|
|
// All setters return true on change.
|
2010-11-10 16:33:11 +01:00
|
|
|
bool setUseFullPath(bool on);
|
|
|
|
|
bool setMarkerFileName(const QString &file);
|
|
|
|
|
bool setMarkerLineNumber(int line);
|
|
|
|
|
bool setFileName(const QString &file);
|
|
|
|
|
bool setEnabled(bool on);
|
2010-11-15 14:12:05 +01:00
|
|
|
bool setIgnoreCount(int count);
|
2010-11-10 16:33:11 +01:00
|
|
|
bool setFunctionName(const QString &name);
|
|
|
|
|
bool setLineNumber(int line);
|
|
|
|
|
bool setAddress(quint64 address);
|
|
|
|
|
bool setThreadSpec(const QByteArray &spec);
|
|
|
|
|
bool setType(BreakpointType type);
|
|
|
|
|
bool setCondition(const QByteArray &cond);
|
2010-10-25 14:00:19 +02:00
|
|
|
|
2010-10-28 12:18:38 +02:00
|
|
|
private:
|
2010-11-15 13:12:13 +01:00
|
|
|
// This "user requested information" will get stored in the session.
|
2010-11-15 17:04:29 +01:00
|
|
|
BreakpointParameters m_parameters;
|
2010-05-07 15:16:31 +02:00
|
|
|
QString m_markerFileName; // Used to locate the marker.
|
|
|
|
|
int m_markerLineNumber;
|
2010-11-10 16:33:11 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(BreakHandler)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// This is what debuggers produced in response to the attempt to
|
|
|
|
|
// insert a breakpoint. The data might differ from the requested bits.
|
2010-11-15 17:04:29 +01:00
|
|
|
class BreakpointResponse : public BreakpointParameters
|
2010-11-10 16:33:11 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
BreakpointResponse();
|
|
|
|
|
QString toString() const;
|
|
|
|
|
|
|
|
|
|
public:
|
2010-11-15 17:04:29 +01:00
|
|
|
int number; // Breakpoint number assigned by the debugger engine.
|
|
|
|
|
QString fullName; // Full file name acknowledged by the debugger engine.
|
|
|
|
|
bool multiple; // Happens in constructors/gdb.
|
|
|
|
|
QByteArray state; // gdb: <PENDING>, <MULTIPLE>
|
2010-05-07 15:16:31 +02:00
|
|
|
};
|
|
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
typedef QList<BreakpointId> BreakpointIds;
|
2010-05-07 15:16:31 +02:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
#endif // DEBUGGER_BREAKPOINT_H
|