diff options
author | hjk <hjk@qt.io> | 2018-07-31 12:30:48 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2018-08-17 12:35:15 +0000 |
commit | 3b5ecac238b87615b44b27375cef0b4f1d4637e4 (patch) | |
tree | 7ef6ab68b1d92564bfdd7181e4cd6c14130a544c /src/plugins/debugger/breakpoint.h | |
parent | d6911fd10c0d16740e267147bb829ac0aa1b7413 (diff) | |
download | qt-creator-3b5ecac238b87615b44b27375cef0b4f1d4637e4.tar.gz |
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/debugger/breakpoint.h')
-rw-r--r-- | src/plugins/debugger/breakpoint.h | 85 |
1 files changed, 11 insertions, 74 deletions
diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h index 45c9a11205..26e118b8bb 100644 --- a/src/plugins/debugger/breakpoint.h +++ b/src/plugins/debugger/breakpoint.h @@ -31,52 +31,7 @@ namespace Debugger { namespace Internal { -////////////////////////////////////////////////////////////////// -// -// BreakpointIds -// -////////////////////////////////////////////////////////////////// - -class BreakpointIdBase -{ -public: - BreakpointIdBase() = default; - - bool isValid() const { return m_majorPart != 0; } - bool isMajor() const { return m_majorPart != 0 && m_minorPart == 0; } - bool isMinor() const { return m_majorPart != 0 && m_minorPart != 0; } - bool operator!() const { return !isValid(); } - operator const void*() const { return isValid() ? this : nullptr; } - quint32 toInternalId() const { return m_majorPart | (m_minorPart << 16); } - QString toString() const; - bool operator==(const BreakpointIdBase &id) const - { return m_majorPart == id.m_majorPart && m_minorPart == id.m_minorPart; } - quint16 majorPart() const { return m_majorPart; } - quint16 minorPart() const { return m_minorPart; } - -protected: - quint16 m_majorPart = 0; - quint16 m_minorPart = 0; -}; - -class BreakpointModelId : public BreakpointIdBase -{ -public: - BreakpointModelId() { m_majorPart = m_minorPart = 0; } - explicit BreakpointModelId(quint16 ma) { m_majorPart = ma; m_minorPart = 0; } - BreakpointModelId(quint16 ma, quint16 mi) { m_majorPart = ma; m_minorPart = mi; } - explicit BreakpointModelId(const QString &ba); // "21.2" -}; - -class BreakpointResponseId : public BreakpointIdBase -{ -public: - BreakpointResponseId() { m_majorPart = m_minorPart = 0; } - explicit BreakpointResponseId(quint16 ma) { m_majorPart = ma; m_minorPart = 0; } - BreakpointResponseId(quint16 ma, quint16 mi) { m_majorPart = ma; m_minorPart = mi; } - explicit BreakpointResponseId(const QString &ba); // "21.2" -}; - +class GdbMi; ////////////////////////////////////////////////////////////////// // @@ -86,7 +41,7 @@ public: //! \enum Debugger::Internal::BreakpointType -// Note: Keep synchronized with similar definitions in bridge.py +// Note: Keep synchronized with similar definitions in dumper.py enum BreakpointType { UnknownBreakpointType, @@ -110,11 +65,11 @@ enum BreakpointType enum BreakpointState { BreakpointNew, - BreakpointInsertRequested, //!< Inferior was told about bp, not ack'ed. - BreakpointInsertProceeding, - BreakpointChangeRequested, - BreakpointChangeProceeding, + BreakpointInsertionRequested, //!< Inferior was told about bp, not ack'ed. + BreakpointInsertionProceeding, BreakpointInserted, + BreakpointUpdateRequested, + BreakpointUpdateProceeding, BreakpointRemoveRequested, BreakpointRemoveProceeding, BreakpointDead @@ -185,12 +140,15 @@ public: bool conditionsMatch(const QString &other) const; bool isWatchpoint() const { return type == WatchpointAtAddress || type == WatchpointAtExpression; } + bool isLocatedAt(const QString &fileName, int lineNumber, const QString &markerFileName) const; // Enough for now. bool isBreakpoint() const { return !isWatchpoint() && !isTracepoint(); } bool isTracepoint() const { return tracepoint; } bool isCppBreakpoint() const; + bool isQmlFileAndLineBreakpoint() const; QString toString() const; void updateLocation(const QString &location); // file.cpp:42 + void updateFromGdbOutput(const GdbMi &bkpt); bool operator==(const BreakpointParameters &p) const { return equals(p); } bool operator!=(const BreakpointParameters &p) const { return !equals(p); } @@ -214,31 +172,10 @@ public: QString message; //!< message bool tracepoint; bool oneShot; //!< Should this breakpoint trigger only once? -}; - -class BreakpointResponse : public BreakpointParameters -{ -public: - BreakpointResponse(); - QString toString() const; - -public: - void fromParameters(const BreakpointParameters &p); - BreakpointResponseId id; //!< Breakpoint number assigned by the debugger engine. - bool pending; //!< Breakpoint not fully resolved. - int hitCount; //!< Number of times this has been hit. - bool multiple; //!< Happens in constructors/gdb. - int correctedLineNumber; //!< Line number as seen by gdb. + bool pending = true; //!< Breakpoint not fully resolved. + int hitCount = 0; //!< Number of times this has been hit. }; -inline uint qHash(const Debugger::Internal::BreakpointModelId &id) -{ - return id.toInternalId(); -} - } // namespace Internal } // namespace Debugger - -Q_DECLARE_METATYPE(Debugger::Internal::BreakpointModelId) -Q_DECLARE_METATYPE(Debugger::Internal::BreakpointResponseId) |