]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/tools/lldb-mi/MICmdCmdBreak.h
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / tools / lldb-mi / MICmdCmdBreak.h
1 //===-- MICmdCmdBreak.h -----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // Overview:    CMICmdCmdBreakInsert            interface.
10 //              CMICmdCmdBreakDelete            interface.
11 //              CMICmdCmdBreakDisable           interface.
12 //              CMICmdCmdBreakEnable            interface.
13 //              CMICmdCmdBreakAfter             interface.
14 //              CMICmdCmdBreakCondition         interface.
15 //
16 //              To implement new MI commands derive a new command class from the
17 //              command base
18 //              class. To enable the new command for interpretation add the new
19 //              command class
20 //              to the command factory. The files of relevance are:
21 //                  MICmdCommands.cpp
22 //                  MICmdBase.h / .cpp
23 //                  MICmdCmd.h / .cpp
24 //              For an introduction to adding a new command see
25 //              CMICmdCmdSupportInfoMiCmdQuery
26 //              command class as an example.
27
28 #pragma once
29
30 // Third party headers:
31 #include "lldb/API/SBBreakpoint.h"
32
33 // In-house headers:
34 #include "MICmdBase.h"
35
36 //++
37 //============================================================================
38 // Details: MI command class. MI commands derived from the command base class.
39 //          *this class implements MI command "break-insert".
40 //          This command does not follow the MI documentation exactly.
41 //--
42 class CMICmdCmdBreakInsert : public CMICmdBase {
43   // Statics:
44 public:
45   // Required by the CMICmdFactory when registering *this command
46   static CMICmdBase *CreateSelf();
47
48   // Methods:
49 public:
50   /* ctor */ CMICmdCmdBreakInsert();
51
52   // Overridden:
53 public:
54   // From CMICmdInvoker::ICmd
55   bool Execute() override;
56   bool Acknowledge() override;
57   bool ParseArgs() override;
58   // From CMICmnBase
59   /* dtor */ ~CMICmdCmdBreakInsert() override;
60
61   // Enumerations:
62 private:
63   //++ ===================================================================
64   // Details: The type of break point give in the MI command text.
65   //--
66   enum BreakPoint_e {
67     eBreakPoint_Invalid = 0,
68     eBreakPoint_ByFileLine,
69     eBreakPoint_ByFileFn,
70     eBreakPoint_ByName,
71     eBreakPoint_ByAddress,
72     eBreakPoint_count,
73     eBreakPoint_NotDefineYet
74   };
75
76   // Attributes:
77 private:
78   bool m_bBrkPtIsTemp;
79   bool m_bHaveArgOptionThreadGrp;
80   CMIUtilString m_brkName;
81   CMIUtilString m_strArgOptionThreadGrp;
82   lldb::SBBreakpoint m_brkPt;
83   bool m_bBrkPtIsPending;
84   MIuint m_nBrkPtIgnoreCount;
85   bool m_bBrkPtEnabled;
86   bool m_bBrkPtCondition;
87   CMIUtilString m_brkPtCondition;
88   bool m_bBrkPtThreadId;
89   MIuint m_nBrkPtThreadId;
90   const CMIUtilString m_constStrArgNamedTempBrkPt;
91   const CMIUtilString m_constStrArgNamedHWBrkPt; // Not handled by *this command
92   const CMIUtilString m_constStrArgNamedPendinfBrkPt;
93   const CMIUtilString m_constStrArgNamedDisableBrkPt;
94   const CMIUtilString m_constStrArgNamedTracePt; // Not handled by *this command
95   const CMIUtilString m_constStrArgNamedConditionalBrkPt;
96   const CMIUtilString m_constStrArgNamedInoreCnt;
97   const CMIUtilString m_constStrArgNamedRestrictBrkPtToThreadId;
98   const CMIUtilString m_constStrArgNamedLocation;
99 };
100
101 //++
102 //============================================================================
103 // Details: MI command class. MI commands derived from the command base class.
104 //          *this class implements MI command "break-delete".
105 //--
106 class CMICmdCmdBreakDelete : public CMICmdBase {
107   // Statics:
108 public:
109   // Required by the CMICmdFactory when registering *this command
110   static CMICmdBase *CreateSelf();
111
112   // Methods:
113 public:
114   /* ctor */ CMICmdCmdBreakDelete();
115
116   // Overridden:
117 public:
118   // From CMICmdInvoker::ICmd
119   bool Execute() override;
120   bool Acknowledge() override;
121   bool ParseArgs() override;
122   // From CMICmnBase
123   /* dtor */ ~CMICmdCmdBreakDelete() override;
124
125   // Attributes:
126 private:
127   const CMIUtilString m_constStrArgNamedBrkPt;
128 };
129
130 //++
131 //============================================================================
132 // Details: MI command class. MI commands derived from the command base class.
133 //          *this class implements MI command "break-disable".
134 //--
135 class CMICmdCmdBreakDisable : public CMICmdBase {
136   // Statics:
137 public:
138   // Required by the CMICmdFactory when registering *this command
139   static CMICmdBase *CreateSelf();
140
141   // Methods:
142 public:
143   /* ctor */ CMICmdCmdBreakDisable();
144
145   // Overridden:
146 public:
147   // From CMICmdInvoker::ICmd
148   bool Execute() override;
149   bool Acknowledge() override;
150   bool ParseArgs() override;
151   // From CMICmnBase
152   /* dtor */ ~CMICmdCmdBreakDisable() override;
153
154   // Attributes:
155 private:
156   const CMIUtilString m_constStrArgNamedBrkPt;
157   bool m_bBrkPtDisabledOk;
158   MIuint m_nBrkPtId;
159 };
160
161 //++
162 //============================================================================
163 // Details: MI command class. MI commands derived from the command base class.
164 //          *this class implements MI command "break-enable".
165 //--
166 class CMICmdCmdBreakEnable : public CMICmdBase {
167   // Statics:
168 public:
169   // Required by the CMICmdFactory when registering *this command
170   static CMICmdBase *CreateSelf();
171
172   // Methods:
173 public:
174   /* ctor */ CMICmdCmdBreakEnable();
175
176   // Overridden:
177 public:
178   // From CMICmdInvoker::ICmd
179   bool Execute() override;
180   bool Acknowledge() override;
181   bool ParseArgs() override;
182   // From CMICmnBase
183   /* dtor */ ~CMICmdCmdBreakEnable() override;
184
185   // Attributes:
186 private:
187   const CMIUtilString m_constStrArgNamedBrkPt;
188   bool m_bBrkPtEnabledOk;
189   MIuint m_nBrkPtId;
190 };
191
192 //++
193 //============================================================================
194 // Details: MI command class. MI commands derived from the command base class.
195 //          *this class implements MI command "break-after".
196 //--
197 class CMICmdCmdBreakAfter : public CMICmdBase {
198   // Statics:
199 public:
200   // Required by the CMICmdFactory when registering *this command
201   static CMICmdBase *CreateSelf();
202
203   // Methods:
204 public:
205   /* ctor */ CMICmdCmdBreakAfter();
206
207   // Overridden:
208 public:
209   // From CMICmdInvoker::ICmd
210   bool Execute() override;
211   bool Acknowledge() override;
212   bool ParseArgs() override;
213   // From CMICmnBase
214   /* dtor */ ~CMICmdCmdBreakAfter() override;
215
216   // Attributes:
217 private:
218   const CMIUtilString m_constStrArgNamedNumber;
219   const CMIUtilString m_constStrArgNamedCount;
220   MIuint m_nBrkPtId;
221   MIuint m_nBrkPtCount;
222 };
223
224 //++
225 //============================================================================
226 // Details: MI command class. MI commands derived from the command base class.
227 //          *this class implements MI command "break-condition".
228 //--
229 class CMICmdCmdBreakCondition : public CMICmdBase {
230   // Statics:
231 public:
232   // Required by the CMICmdFactory when registering *this command
233   static CMICmdBase *CreateSelf();
234
235   // Methods:
236 public:
237   /* ctor */ CMICmdCmdBreakCondition();
238
239   // Overridden:
240 public:
241   // From CMICmdInvoker::ICmd
242   bool Execute() override;
243   bool Acknowledge() override;
244   bool ParseArgs() override;
245   // From CMICmnBase
246   /* dtor */ ~CMICmdCmdBreakCondition() override;
247
248   // Methods:
249 private:
250   CMIUtilString GetRestOfExpressionNotSurroundedInQuotes();
251
252   // Attributes:
253 private:
254   const CMIUtilString m_constStrArgNamedNumber;
255   const CMIUtilString m_constStrArgNamedExpr;
256   const CMIUtilString m_constStrArgNamedExprNoQuotes; // Not specified in MI
257                                                       // spec, we need to handle
258                                                       // expressions not
259                                                       // surrounded by quotes
260   MIuint m_nBrkPtId;
261   CMIUtilString m_strBrkPtExpr;
262 };