]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/tools/lldb-mi/MICmdCmdVar.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / tools / lldb-mi / MICmdCmdVar.h
1 //===-- MICmdCmdVar.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:    CMICmdCmdVarCreate              interface.
10 //              CMICmdCmdVarUpdate              interface.
11 //              CMICmdCmdVarDelete              interface.
12 //              CMICmdCmdVarAssign              interface.
13 //              CMICmdCmdVarSetFormat           interface.
14 //              CMICmdCmdVarListChildren        interface.
15 //              CMICmdCmdVarEvaluateExpression  interface.
16 //              CMICmdCmdVarInfoPathExpression  interface.
17 //              CMICmdCmdVarShowAttributes      interface.
18 //
19 //              To implement new MI commands derive a new command class from the
20 //              command base
21 //              class. To enable the new command for interpretation add the new
22 //              command class
23 //              to the command factory. The files of relevance are:
24 //                  MICmdCommands.cpp
25 //                  MICmdBase.h / .cpp
26 //                  MICmdCmd.h / .cpp
27 //              For an introduction to adding a new command see
28 //              CMICmdCmdSupportInfoMiCmdQuery
29 //              command class as an example.
30
31 #pragma once
32
33 // In-house headers:
34 #include "MICmdBase.h"
35 #include "MICmnLLDBDebugSessionInfo.h"
36 #include "MICmnLLDBDebugSessionInfoVarObj.h"
37 #include "MICmnMIValueList.h"
38 #include "MICmnMIValueTuple.h"
39
40 // Declarations:
41 class CMICmnLLDBDebugSessionInfoVarObj;
42
43 //++
44 //============================================================================
45 // Details: MI command class. MI commands derived from the command base class.
46 //          *this class implements MI command "var-create".
47 //--
48 class CMICmdCmdVarCreate : public CMICmdBase {
49   // Statics:
50 public:
51   // Required by the CMICmdFactory when registering *this command
52   static CMICmdBase *CreateSelf();
53
54   // Methods:
55 public:
56   /* ctor */ CMICmdCmdVarCreate();
57
58   // Overridden:
59 public:
60   // From CMICmdInvoker::ICmd
61   bool Execute() override;
62   bool Acknowledge() override;
63   bool ParseArgs() override;
64
65   // Overridden:
66 public:
67   // From CMICmnBase
68   /* dtor */ ~CMICmdCmdVarCreate() override;
69
70   // Methods:
71 private:
72   void CompleteSBValue(lldb::SBValue &vrwValue);
73
74   // Attribute:
75 private:
76   CMIUtilString m_strVarName;
77   MIuint m_nChildren;
78   MIuint64 m_nThreadId;
79   CMIUtilString m_strType;
80   bool m_bValid; // True = Variable is valid, false = not valid
81   CMIUtilString m_strExpression;
82   CMIUtilString m_strValue;
83   const CMIUtilString m_constStrArgName;
84   const CMIUtilString m_constStrArgFrameAddr;
85   const CMIUtilString m_constStrArgExpression;
86 };
87
88 //++
89 //============================================================================
90 // Details: MI command class. MI commands derived from the command base class.
91 //          *this class implements MI command "var-update".
92 //--
93 class CMICmdCmdVarUpdate : public CMICmdBase {
94   // Statics:
95 public:
96   // Required by the CMICmdFactory when registering *this command
97   static CMICmdBase *CreateSelf();
98
99   // Methods:
100 public:
101   /* ctor */ CMICmdCmdVarUpdate();
102
103   // Overridden:
104 public:
105   // From CMICmdInvoker::ICmd
106   bool Execute() override;
107   bool Acknowledge() override;
108   bool ParseArgs() override;
109
110   // Overridden:
111 public:
112   // From CMICmnBase
113   /* dtor */ ~CMICmdCmdVarUpdate() override;
114
115   // Methods:
116 private:
117   bool ExamineSBValueForChange(lldb::SBValue &vrwValue, bool &vrwbChanged);
118   void MIFormResponse(const CMIUtilString &vrStrVarName,
119                       const char *const vpValue,
120                       const CMIUtilString &vrStrScope);
121
122   // Attribute:
123 private:
124   const CMIUtilString m_constStrArgPrintValues;
125   const CMIUtilString m_constStrArgName;
126   bool m_bValueChanged; // True = yes value changed, false = no change
127   CMICmnMIValueList m_miValueList;
128 };
129
130 //++
131 //============================================================================
132 // Details: MI command class. MI commands derived from the command base class.
133 //          *this class implements MI command "var-delete".
134 //--
135 class CMICmdCmdVarDelete : 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 */ CMICmdCmdVarDelete();
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 */ ~CMICmdCmdVarDelete() override;
153
154   // Attribute:
155 private:
156   const CMIUtilString m_constStrArgName;
157 };
158
159 //++
160 //============================================================================
161 // Details: MI command class. MI commands derived from the command base class.
162 //          *this class implements MI command "var-assign".
163 //--
164 class CMICmdCmdVarAssign : public CMICmdBase {
165   // Statics:
166 public:
167   // Required by the CMICmdFactory when registering *this command
168   static CMICmdBase *CreateSelf();
169
170   // Methods:
171 public:
172   /* ctor */ CMICmdCmdVarAssign();
173
174   // Overridden:
175 public:
176   // From CMICmdInvoker::ICmd
177   bool Execute() override;
178   bool Acknowledge() override;
179   bool ParseArgs() override;
180   // From CMICmnBase
181   /* dtor */ ~CMICmdCmdVarAssign() override;
182
183   // Attributes:
184 private:
185   bool m_bOk; // True = success, false = failure
186   CMIUtilString m_varObjName;
187   const CMIUtilString m_constStrArgName;
188   const CMIUtilString m_constStrArgExpression;
189 };
190
191 //++
192 //============================================================================
193 // Details: MI command class. MI commands derived from the command base class.
194 //          *this class implements MI command "var-set-format".
195 //--
196 class CMICmdCmdVarSetFormat : public CMICmdBase {
197   // Statics:
198 public:
199   // Required by the CMICmdFactory when registering *this command
200   static CMICmdBase *CreateSelf();
201
202   // Methods:
203 public:
204   /* ctor */ CMICmdCmdVarSetFormat();
205
206   // Overridden:
207 public:
208   // From CMICmdInvoker::ICmd
209   bool Execute() override;
210   bool Acknowledge() override;
211   bool ParseArgs() override;
212   // From CMICmnBase
213   /* dtor */ ~CMICmdCmdVarSetFormat() override;
214
215   // Attributes:
216 private:
217   CMIUtilString m_varObjName;
218   const CMIUtilString m_constStrArgName;
219   const CMIUtilString m_constStrArgFormatSpec;
220 };
221
222 //++
223 //============================================================================
224 // Details: MI command class. MI commands derived from the command base class.
225 //          *this class implements MI command "var-list-children".
226 //--
227 class CMICmdCmdVarListChildren : public CMICmdBase {
228   // Statics:
229 public:
230   // Required by the CMICmdFactory when registering *this command
231   static CMICmdBase *CreateSelf();
232
233   // Methods:
234 public:
235   /* ctor */ CMICmdCmdVarListChildren();
236
237   // Overridden:
238 public:
239   // From CMICmdInvoker::ICmd
240   bool Execute() override;
241   bool Acknowledge() override;
242   bool ParseArgs() override;
243   // From CMICmnBase
244   /* dtor */ ~CMICmdCmdVarListChildren() override;
245
246   // Attributes:
247 private:
248   const CMIUtilString m_constStrArgPrintValues;
249   const CMIUtilString m_constStrArgName;
250   const CMIUtilString m_constStrArgFrom;
251   const CMIUtilString m_constStrArgTo;
252   bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
253   MIuint m_nChildren;
254   CMICmnMIValueList m_miValueList;
255   bool m_bHasMore;
256 };
257
258 //++
259 //============================================================================
260 // Details: MI command class. MI commands derived from the command base class.
261 //          *this class implements MI command "var-evaluate-expression".
262 //--
263 class CMICmdCmdVarEvaluateExpression : public CMICmdBase {
264   // Statics:
265 public:
266   // Required by the CMICmdFactory when registering *this command
267   static CMICmdBase *CreateSelf();
268
269   // Methods:
270 public:
271   /* ctor */ CMICmdCmdVarEvaluateExpression();
272
273   // Overridden:
274 public:
275   // From CMICmdInvoker::ICmd
276   bool Execute() override;
277   bool Acknowledge() override;
278   bool ParseArgs() override;
279   // From CMICmnBase
280   /* dtor */ ~CMICmdCmdVarEvaluateExpression() override;
281
282   // Attributes:
283 private:
284   bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
285   CMIUtilString m_varObjName;
286   const CMIUtilString m_constStrArgFormatSpec; // Not handled by *this command
287   const CMIUtilString m_constStrArgName;
288 };
289
290 //++
291 //============================================================================
292 // Details: MI command class. MI commands derived from the command base class.
293 //          *this class implements MI command "var-info-path-expression".
294 //--
295 class CMICmdCmdVarInfoPathExpression : public CMICmdBase {
296   // Statics:
297 public:
298   // Required by the CMICmdFactory when registering *this command
299   static CMICmdBase *CreateSelf();
300
301   // Methods:
302 public:
303   /* ctor */ CMICmdCmdVarInfoPathExpression();
304
305   // Overridden:
306 public:
307   // From CMICmdInvoker::ICmd
308   bool Execute() override;
309   bool Acknowledge() override;
310   bool ParseArgs() override;
311   // From CMICmnBase
312   /* dtor */ ~CMICmdCmdVarInfoPathExpression() override;
313
314   // Attributes:
315 private:
316   bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
317   CMIUtilString m_strPathExpression;
318   const CMIUtilString m_constStrArgName;
319 };
320
321 //++
322 //============================================================================
323 // Details: MI command class. MI commands derived from the command base class.
324 //          *this class implements MI command "var-show-attributes".
325 //--
326 class CMICmdCmdVarShowAttributes : public CMICmdBase {
327   // Statics:
328 public:
329   // Required by the CMICmdFactory when registering *this command
330   static CMICmdBase *CreateSelf();
331
332   // Methods:
333 public:
334   /* ctor */ CMICmdCmdVarShowAttributes();
335
336   // Overridden:
337 public:
338   // From CMICmdInvoker::ICmd
339   bool Execute() override;
340   bool Acknowledge() override;
341   bool ParseArgs() override;
342   // From CMICmnBase
343   /* dtor */ ~CMICmdCmdVarShowAttributes() override;
344
345   // Attributes:
346 private:
347   const CMIUtilString m_constStrArgName;
348 };