1 //===-- MICmdCmdVar.h -------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
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.
19 // To implement new MI commands derive a new command class from the
21 // class. To enable the new command for interpretation add the new
23 // to the command factory. The files of relevance are:
27 // For an introduction to adding a new command see
28 // CMICmdCmdSupportInfoMiCmdQuery
29 // command class as an example.
34 #include "MICmdBase.h"
35 #include "MICmnLLDBDebugSessionInfo.h"
36 #include "MICmnLLDBDebugSessionInfoVarObj.h"
37 #include "MICmnMIValueList.h"
38 #include "MICmnMIValueTuple.h"
41 class CMICmnLLDBDebugSessionInfoVarObj;
44 //============================================================================
45 // Details: MI command class. MI commands derived from the command base class.
46 // *this class implements MI command "var-create".
48 class CMICmdCmdVarCreate : public CMICmdBase {
51 // Required by the CMICmdFactory when registering *this command
52 static CMICmdBase *CreateSelf();
56 /* ctor */ CMICmdCmdVarCreate();
60 // From CMICmdInvoker::ICmd
61 bool Execute() override;
62 bool Acknowledge() override;
63 bool ParseArgs() override;
68 /* dtor */ ~CMICmdCmdVarCreate() override;
72 void CompleteSBValue(lldb::SBValue &vrwValue);
76 CMIUtilString m_strVarName;
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;
89 //============================================================================
90 // Details: MI command class. MI commands derived from the command base class.
91 // *this class implements MI command "var-update".
93 class CMICmdCmdVarUpdate : public CMICmdBase {
96 // Required by the CMICmdFactory when registering *this command
97 static CMICmdBase *CreateSelf();
101 /* ctor */ CMICmdCmdVarUpdate();
105 // From CMICmdInvoker::ICmd
106 bool Execute() override;
107 bool Acknowledge() override;
108 bool ParseArgs() override;
113 /* dtor */ ~CMICmdCmdVarUpdate() override;
117 bool ExamineSBValueForChange(lldb::SBValue &vrwValue, bool &vrwbChanged);
118 void MIFormResponse(const CMIUtilString &vrStrVarName,
119 const char *const vpValue,
120 const CMIUtilString &vrStrScope);
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;
131 //============================================================================
132 // Details: MI command class. MI commands derived from the command base class.
133 // *this class implements MI command "var-delete".
135 class CMICmdCmdVarDelete : public CMICmdBase {
138 // Required by the CMICmdFactory when registering *this command
139 static CMICmdBase *CreateSelf();
143 /* ctor */ CMICmdCmdVarDelete();
147 // From CMICmdInvoker::ICmd
148 bool Execute() override;
149 bool Acknowledge() override;
150 bool ParseArgs() override;
152 /* dtor */ ~CMICmdCmdVarDelete() override;
156 const CMIUtilString m_constStrArgName;
160 //============================================================================
161 // Details: MI command class. MI commands derived from the command base class.
162 // *this class implements MI command "var-assign".
164 class CMICmdCmdVarAssign : public CMICmdBase {
167 // Required by the CMICmdFactory when registering *this command
168 static CMICmdBase *CreateSelf();
172 /* ctor */ CMICmdCmdVarAssign();
176 // From CMICmdInvoker::ICmd
177 bool Execute() override;
178 bool Acknowledge() override;
179 bool ParseArgs() override;
181 /* dtor */ ~CMICmdCmdVarAssign() override;
185 bool m_bOk; // True = success, false = failure
186 CMIUtilString m_varObjName;
187 const CMIUtilString m_constStrArgName;
188 const CMIUtilString m_constStrArgExpression;
192 //============================================================================
193 // Details: MI command class. MI commands derived from the command base class.
194 // *this class implements MI command "var-set-format".
196 class CMICmdCmdVarSetFormat : public CMICmdBase {
199 // Required by the CMICmdFactory when registering *this command
200 static CMICmdBase *CreateSelf();
204 /* ctor */ CMICmdCmdVarSetFormat();
208 // From CMICmdInvoker::ICmd
209 bool Execute() override;
210 bool Acknowledge() override;
211 bool ParseArgs() override;
213 /* dtor */ ~CMICmdCmdVarSetFormat() override;
217 CMIUtilString m_varObjName;
218 const CMIUtilString m_constStrArgName;
219 const CMIUtilString m_constStrArgFormatSpec;
223 //============================================================================
224 // Details: MI command class. MI commands derived from the command base class.
225 // *this class implements MI command "var-list-children".
227 class CMICmdCmdVarListChildren : public CMICmdBase {
230 // Required by the CMICmdFactory when registering *this command
231 static CMICmdBase *CreateSelf();
235 /* ctor */ CMICmdCmdVarListChildren();
239 // From CMICmdInvoker::ICmd
240 bool Execute() override;
241 bool Acknowledge() override;
242 bool ParseArgs() override;
244 /* dtor */ ~CMICmdCmdVarListChildren() override;
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
254 CMICmnMIValueList m_miValueList;
259 //============================================================================
260 // Details: MI command class. MI commands derived from the command base class.
261 // *this class implements MI command "var-evaluate-expression".
263 class CMICmdCmdVarEvaluateExpression : public CMICmdBase {
266 // Required by the CMICmdFactory when registering *this command
267 static CMICmdBase *CreateSelf();
271 /* ctor */ CMICmdCmdVarEvaluateExpression();
275 // From CMICmdInvoker::ICmd
276 bool Execute() override;
277 bool Acknowledge() override;
278 bool ParseArgs() override;
280 /* dtor */ ~CMICmdCmdVarEvaluateExpression() override;
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;
291 //============================================================================
292 // Details: MI command class. MI commands derived from the command base class.
293 // *this class implements MI command "var-info-path-expression".
295 class CMICmdCmdVarInfoPathExpression : public CMICmdBase {
298 // Required by the CMICmdFactory when registering *this command
299 static CMICmdBase *CreateSelf();
303 /* ctor */ CMICmdCmdVarInfoPathExpression();
307 // From CMICmdInvoker::ICmd
308 bool Execute() override;
309 bool Acknowledge() override;
310 bool ParseArgs() override;
312 /* dtor */ ~CMICmdCmdVarInfoPathExpression() override;
316 bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
317 CMIUtilString m_strPathExpression;
318 const CMIUtilString m_constStrArgName;
322 //============================================================================
323 // Details: MI command class. MI commands derived from the command base class.
324 // *this class implements MI command "var-show-attributes".
326 class CMICmdCmdVarShowAttributes : public CMICmdBase {
329 // Required by the CMICmdFactory when registering *this command
330 static CMICmdBase *CreateSelf();
334 /* ctor */ CMICmdCmdVarShowAttributes();
338 // From CMICmdInvoker::ICmd
339 bool Execute() override;
340 bool Acknowledge() override;
341 bool ParseArgs() override;
343 /* dtor */ ~CMICmdCmdVarShowAttributes() override;
347 const CMIUtilString m_constStrArgName;