OSDN Git Service

0a0941e60722008de40d7932a0e44ab50aeb5584
[qt-creator-jp/qt-creator-jp.git] / src / plugins / debugger / breakpoint.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef DEBUGGER_BREAKPOINT_H
35 #define DEBUGGER_BREAKPOINT_H
36
37 #include <QtCore/QList>
38 #include <QtCore/QMetaType>
39 #include <QtCore/QString>
40
41 namespace Debugger {
42 namespace Internal {
43
44 typedef quint64 BreakpointId;
45
46 //////////////////////////////////////////////////////////////////
47 //
48 // BreakpointData
49 //
50 //////////////////////////////////////////////////////////////////
51
52 //! \enum Debugger::Internal::BreakpointType
53 enum BreakpointType
54 {
55     UnknownType,
56     BreakpointByFileAndLine,
57     BreakpointByFunction,
58     BreakpointByAddress,
59     BreakpointAtThrow,
60     BreakpointAtCatch,
61     BreakpointAtMain,
62     BreakpointAtFork,
63     BreakpointAtExec,
64     //BreakpointAtVFork,
65     BreakpointAtSysCall,
66     Watchpoint
67 };
68
69 //! \enum Debugger::Internal::BreakpointState
70 enum BreakpointState
71 {
72     BreakpointNew,
73     BreakpointInsertRequested,  //!< Inferior was told about bp, not ack'ed.
74     BreakpointInsertProceeding,
75     BreakpointChangeRequested,
76     BreakpointChangeProceeding,
77     BreakpointInserted,
78     BreakpointRemoveRequested,
79     BreakpointRemoveProceeding,
80     BreakpointDead
81 };
82
83 //! \enum Debugger::Internal::BreakpointPathUsage
84 enum BreakpointPathUsage
85 {
86     BreakpointPathUsageEngineDefault, //!< Default value that suits the engine.
87     BreakpointUseFullPath,            //!< Use full path to avoid ambiguities. Slow with gdb.
88     BreakpointUseShortPath            //!< Use filename only, in case source files are relocated.
89 };
90
91 class BreakpointParameters
92 {
93 public:
94     explicit BreakpointParameters(BreakpointType = UnknownType);
95     bool equals(const BreakpointParameters &rhs) const;
96     bool conditionsMatch(const QByteArray &other) const;
97     bool isWatchpoint() const { return type == Watchpoint; }
98     // Enough for now.
99     bool isBreakpoint() const { return type != Watchpoint && !tracepoint; }
100     bool isTracepoint() const { return tracepoint; }
101     QString toString() const;
102
103     bool operator==(const BreakpointParameters &p) const { return equals(p); }
104     bool operator!=(const BreakpointParameters &p) const { return !equals(p); }
105
106     BreakpointType type;     //!< Type of breakpoint.
107     bool enabled;            //!< Should we talk to the debugger engine?
108     BreakpointPathUsage pathUsage;  //!< Should we use the full path when setting the bp?
109     QString fileName;        //!< Short name of source file.
110     QByteArray condition;    //!< Condition associated with breakpoint.
111     int ignoreCount;         //!< Ignore count associated with breakpoint.
112     int lineNumber;          //!< Line in source file.
113     quint64 address;         //!< Address for watchpoints.
114     uint size;               //!< Size of watched area for watchpoints.
115     uint bitpos;             //!< Location of watched bitfield within watched area.
116     uint bitsize;            //!< Size of watched bitfield within watched area.
117     int threadSpec;          //!< Thread specification.
118     QString functionName;
119     QString module;          //!< module for file name
120     QString command;         //!< command to execute
121     bool tracepoint;
122 };
123
124 class BreakpointResponse : public BreakpointParameters
125 {
126 public:
127     BreakpointResponse();
128     QString toString() const;
129
130 public:
131     void fromParameters(const BreakpointParameters &p);
132
133     int number;             //!< Breakpoint number assigned by the debugger engine.
134     bool pending;           //!< Breakpoint not fully resolved.
135     QString fullName;       //!< Full file name acknowledged by the debugger engine.
136     bool multiple;          //!< Happens in constructors/gdb.
137     QByteArray extra;       //!< gdb: <PENDING>, <MULTIPLE>
138     QList<quint64> addresses;//!< Extra addresses for templated code.
139     int correctedLineNumber; //!< Line number as seen by gdb.
140 };
141
142 typedef QList<BreakpointId> BreakpointIds;
143
144 } // namespace Internal
145 } // namespace Debugger
146
147 #endif // DEBUGGER_BREAKPOINT_H