1 //===-- MICmdCmdData.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: CMICmdCmdDataEvaluateExpression interface.
10 // CMICmdCmdDataDisassemble interface.
11 // CMICmdCmdDataReadMemoryBytes interface.
12 // CMICmdCmdDataReadMemory interface.
13 // CMICmdCmdDataListRegisterNames interface.
14 // CMICmdCmdDataListRegisterValues interface.
15 // CMICmdCmdDataListRegisterChanged interface.
16 // CMICmdCmdDataWriteMemoryBytes interface.
17 // CMICmdCmdDataWriteMemory interface.
18 // CMICmdCmdDataInfoLine interface.
20 // To implement new MI commands derive a new command class from the
22 // class. To enable the new command for interpretation add the new
24 // to the command factory. The files of relevance are:
28 // For an introduction to adding a new command see
29 // CMICmdCmdSupportInfoMiCmdQuery
30 // command class as an example.
35 // Third party headers:
36 #include "lldb/API/SBError.h"
39 #include "MICmdBase.h"
40 #include "MICmnLLDBDebugSessionInfoVarObj.h"
41 #include "MICmnMIValueList.h"
42 #include "MICmnMIValueTuple.h"
43 #include "MICmnMIResultRecord.h"
46 //============================================================================
47 // Details: MI command class. MI commands derived from the command base class.
48 // *this class implements MI command "data-evaluate-expression".
50 class CMICmdCmdDataEvaluateExpression : public CMICmdBase {
53 // Required by the CMICmdFactory when registering *this command
54 static CMICmdBase *CreateSelf();
58 /* ctor */ CMICmdCmdDataEvaluateExpression();
62 // From CMICmdInvoker::ICmd
63 bool Execute() override;
64 bool Acknowledge() override;
65 bool ParseArgs() override;
67 /* dtor */ ~CMICmdCmdDataEvaluateExpression() override;
71 bool HaveInvalidCharacterInExpression(const CMIUtilString &vrExpr,
72 char &vrwInvalidChar);
76 bool m_bExpressionValid; // True = yes is valid, false = not valid
77 bool m_bEvaluatedExpression; // True = yes is expression evaluated, false =
79 lldb::SBError m_Error; // Status object, which is examined when
80 // m_bEvaluatedExpression is false
81 CMIUtilString m_strValue;
82 CMICmnMIValueTuple m_miValueTuple;
83 bool m_bFoundInvalidChar; // True = yes found unexpected character in the
84 // expression, false = all ok
85 char m_cExpressionInvalidChar;
86 const CMIUtilString m_constStrArgExpr;
90 //============================================================================
91 // Details: MI command class. MI commands derived from the command base class.
92 // *this class implements MI command "data-disassemble".
94 class CMICmdCmdDataDisassemble : public CMICmdBase {
97 // Required by the CMICmdFactory when registering *this command
98 static CMICmdBase *CreateSelf();
102 /* ctor */ CMICmdCmdDataDisassemble();
106 // From CMICmdInvoker::ICmd
107 bool Execute() override;
108 bool Acknowledge() override;
109 bool ParseArgs() override;
111 /* dtor */ ~CMICmdCmdDataDisassemble() override;
116 m_constStrArgAddrStart; // MI spec non mandatory, *this command mandatory
118 m_constStrArgAddrEnd; // MI spec non mandatory, *this command mandatory
119 const CMIUtilString m_constStrArgMode;
120 CMICmnMIValueList m_miValueList;
124 //============================================================================
125 // Details: MI command class. MI commands derived from the command base class.
126 // *this class implements MI command "data-read-memory-bytes".
128 class CMICmdCmdDataReadMemoryBytes : public CMICmdBase {
131 // Required by the CMICmdFactory when registering *this command
132 static CMICmdBase *CreateSelf();
136 /* ctor */ CMICmdCmdDataReadMemoryBytes();
140 // From CMICmdInvoker::ICmd
141 bool Execute() override;
142 bool Acknowledge() override;
143 bool ParseArgs() override;
145 /* dtor */ ~CMICmdCmdDataReadMemoryBytes() override;
149 const CMIUtilString m_constStrArgByteOffset;
150 const CMIUtilString m_constStrArgAddrExpr;
151 const CMIUtilString m_constStrArgNumBytes;
152 unsigned char *m_pBufferMemory;
153 MIuint64 m_nAddrStart;
154 MIuint64 m_nAddrNumBytesToRead;
158 //============================================================================
159 // Details: MI command class. MI commands derived from the command base class.
160 // *this class implements MI command "data-read-memory".
162 class CMICmdCmdDataReadMemory : public CMICmdBase {
165 // Required by the CMICmdFactory when registering *this command
166 static CMICmdBase *CreateSelf();
170 /* ctor */ CMICmdCmdDataReadMemory();
174 // From CMICmdInvoker::ICmd
175 bool Execute() override;
176 bool Acknowledge() override;
178 /* dtor */ ~CMICmdCmdDataReadMemory() override;
182 //============================================================================
183 // Details: MI command class. MI commands derived from the command base class.
184 // *this class implements MI command "data-list-register-names".
186 class CMICmdCmdDataListRegisterNames : public CMICmdBase {
189 // Required by the CMICmdFactory when registering *this command
190 static CMICmdBase *CreateSelf();
194 /* ctor */ CMICmdCmdDataListRegisterNames();
198 // From CMICmdInvoker::ICmd
199 bool Execute() override;
200 bool Acknowledge() override;
201 bool ParseArgs() override;
203 /* dtor */ ~CMICmdCmdDataListRegisterNames() override;
207 lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
211 const CMIUtilString m_constStrArgRegNo; // Not handled by *this command
212 CMICmnMIValueList m_miValueList;
216 //============================================================================
217 // Details: MI command class. MI commands derived from the command base class.
218 // *this class implements MI command "data-list-register-values".
220 class CMICmdCmdDataListRegisterValues : public CMICmdBase {
223 // Required by the CMICmdFactory when registering *this command
224 static CMICmdBase *CreateSelf();
228 /* ctor */ CMICmdCmdDataListRegisterValues();
232 // From CMICmdInvoker::ICmd
233 bool Execute() override;
234 bool Acknowledge() override;
235 bool ParseArgs() override;
237 /* dtor */ ~CMICmdCmdDataListRegisterValues() override;
241 lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
242 void AddToOutput(const MIuint vnIndex, const lldb::SBValue &vrValue,
243 CMICmnLLDBDebugSessionInfoVarObj::varFormat_e veVarFormat);
247 const CMIUtilString m_constStrArgSkip; // Not handled by *this command
248 const CMIUtilString m_constStrArgFormat;
249 const CMIUtilString m_constStrArgRegNo;
250 CMICmnMIValueList m_miValueList;
254 //============================================================================
255 // Details: MI command class. MI commands derived from the command base class.
256 // *this class implements MI command "data-list-changed-registers".
258 class CMICmdCmdDataListRegisterChanged : public CMICmdBase {
261 // Required by the CMICmdFactory when registering *this command
262 static CMICmdBase *CreateSelf();
266 /* ctor */ CMICmdCmdDataListRegisterChanged();
270 // From CMICmdInvoker::ICmd
271 bool Execute() override;
272 bool Acknowledge() override;
274 /* dtor */ ~CMICmdCmdDataListRegisterChanged() override;
278 //============================================================================
279 // Details: MI command class. MI commands derived from the command base class.
280 // *this class implements MI command "data-read-memory-bytes".
282 class CMICmdCmdDataWriteMemoryBytes : public CMICmdBase {
285 // Required by the CMICmdFactory when registering *this command
286 static CMICmdBase *CreateSelf();
290 /* ctor */ CMICmdCmdDataWriteMemoryBytes();
294 // From CMICmdInvoker::ICmd
295 bool Execute() override;
296 bool Acknowledge() override;
297 bool ParseArgs() override;
299 /* dtor */ ~CMICmdCmdDataWriteMemoryBytes() override;
303 const CMIUtilString m_constStrArgAddr;
304 const CMIUtilString m_constStrArgContents;
305 const CMIUtilString m_constStrArgCount;
306 CMIUtilString m_strContents;
310 //============================================================================
311 // Details: MI command class. MI commands derived from the command base class.
312 // *this class implements MI command "data-read-memory".
313 // Not specified in MI spec but Eclipse gives *this command.
315 class CMICmdCmdDataWriteMemory : public CMICmdBase {
318 // Required by the CMICmdFactory when registering *this command
319 static CMICmdBase *CreateSelf();
323 /* ctor */ CMICmdCmdDataWriteMemory();
327 // From CMICmdInvoker::ICmd
328 bool Execute() override;
329 bool Acknowledge() override;
330 bool ParseArgs() override;
332 /* dtor */ ~CMICmdCmdDataWriteMemory() override;
336 const CMIUtilString m_constStrArgOffset; // Not specified in MI spec but
337 // Eclipse gives this option.
338 const CMIUtilString m_constStrArgAddr; // Not specified in MI spec but Eclipse
339 // gives this option.
341 m_constStrArgD; // Not specified in MI spec but Eclipse gives this option.
342 const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but
343 // Eclipse gives this option.
344 const CMIUtilString m_constStrArgContents; // Not specified in MI spec but
345 // Eclipse gives this option.
347 CMIUtilString m_strContents;
349 unsigned char *m_pBufferMemory;
353 //============================================================================
354 // Details: MI command class. MI commands derived from the command base class.
355 // *this class implements MI command "data-info-line".
356 // See MIExtensions.txt for details.
358 class CMICmdCmdDataInfoLine : public CMICmdBase {
361 // Required by the CMICmdFactory when registering *this command
362 static CMICmdBase *CreateSelf();
366 /* ctor */ CMICmdCmdDataInfoLine();
370 // From CMICmdInvoker::ICmd
371 bool Execute() override;
372 bool Acknowledge() override;
373 bool ParseArgs() override;
375 /* dtor */ ~CMICmdCmdDataInfoLine() override;
379 const CMIUtilString m_constStrArgLocation;
380 CMICmnMIResultRecord m_resultRecord;