1 //===-- MICmdCmdData.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Overview: CMICmdCmdDataEvaluateExpression interface.
11 // CMICmdCmdDataDisassemble interface.
12 // CMICmdCmdDataReadMemoryBytes interface.
13 // CMICmdCmdDataReadMemory interface.
14 // CMICmdCmdDataListRegisterNames interface.
15 // CMICmdCmdDataListRegisterValues interface.
16 // CMICmdCmdDataListRegisterChanged interface.
17 // CMICmdCmdDataWriteMemoryBytes interface.
18 // CMICmdCmdDataWriteMemory interface.
19 // CMICmdCmdDataInfoLine interface.
21 // To implement new MI commands derive a new command class from the
23 // class. To enable the new command for interpretation add the new
25 // to the command factory. The files of relevance are:
29 // For an introduction to adding a new command see
30 // CMICmdCmdSupportInfoMiCmdQuery
31 // command class as an example.
36 // Third party headers:
37 #include "lldb/API/SBCommandReturnObject.h"
38 #include "lldb/API/SBError.h"
41 #include "MICmdBase.h"
42 #include "MICmnLLDBDebugSessionInfoVarObj.h"
43 #include "MICmnMIValueList.h"
44 #include "MICmnMIValueTuple.h"
47 //============================================================================
48 // Details: MI command class. MI commands derived from the command base class.
49 // *this class implements MI command "data-evaluate-expression".
51 class CMICmdCmdDataEvaluateExpression : public CMICmdBase {
54 // Required by the CMICmdFactory when registering *this command
55 static CMICmdBase *CreateSelf();
59 /* ctor */ CMICmdCmdDataEvaluateExpression();
63 // From CMICmdInvoker::ICmd
64 bool Execute() override;
65 bool Acknowledge() override;
66 bool ParseArgs() override;
68 /* dtor */ ~CMICmdCmdDataEvaluateExpression() override;
72 bool HaveInvalidCharacterInExpression(const CMIUtilString &vrExpr,
73 char &vrwInvalidChar);
77 bool m_bExpressionValid; // True = yes is valid, false = not valid
78 bool m_bEvaluatedExpression; // True = yes is expression evaluated, false =
80 lldb::SBError m_Error; // Error object, which is examined when
81 // m_bEvaluatedExpression is false
82 CMIUtilString m_strValue;
83 CMICmnMIValueTuple m_miValueTuple;
84 bool m_bFoundInvalidChar; // True = yes found unexpected character in the
85 // expression, false = all ok
86 char m_cExpressionInvalidChar;
87 const CMIUtilString m_constStrArgExpr;
91 //============================================================================
92 // Details: MI command class. MI commands derived from the command base class.
93 // *this class implements MI command "data-disassemble".
95 class CMICmdCmdDataDisassemble : public CMICmdBase {
98 // Required by the CMICmdFactory when registering *this command
99 static CMICmdBase *CreateSelf();
103 /* ctor */ CMICmdCmdDataDisassemble();
107 // From CMICmdInvoker::ICmd
108 bool Execute() override;
109 bool Acknowledge() override;
110 bool ParseArgs() override;
112 /* dtor */ ~CMICmdCmdDataDisassemble() override;
117 m_constStrArgAddrStart; // MI spec non mandatory, *this command mandatory
119 m_constStrArgAddrEnd; // MI spec non mandatory, *this command mandatory
120 const CMIUtilString m_constStrArgMode;
121 CMICmnMIValueList m_miValueList;
125 //============================================================================
126 // Details: MI command class. MI commands derived from the command base class.
127 // *this class implements MI command "data-read-memory-bytes".
129 class CMICmdCmdDataReadMemoryBytes : public CMICmdBase {
132 // Required by the CMICmdFactory when registering *this command
133 static CMICmdBase *CreateSelf();
137 /* ctor */ CMICmdCmdDataReadMemoryBytes();
141 // From CMICmdInvoker::ICmd
142 bool Execute() override;
143 bool Acknowledge() override;
144 bool ParseArgs() override;
146 /* dtor */ ~CMICmdCmdDataReadMemoryBytes() override;
150 const CMIUtilString m_constStrArgByteOffset;
151 const CMIUtilString m_constStrArgAddrExpr;
152 const CMIUtilString m_constStrArgNumBytes;
153 unsigned char *m_pBufferMemory;
154 MIuint64 m_nAddrStart;
155 MIuint64 m_nAddrNumBytesToRead;
159 //============================================================================
160 // Details: MI command class. MI commands derived from the command base class.
161 // *this class implements MI command "data-read-memory".
163 class CMICmdCmdDataReadMemory : public CMICmdBase {
166 // Required by the CMICmdFactory when registering *this command
167 static CMICmdBase *CreateSelf();
171 /* ctor */ CMICmdCmdDataReadMemory();
175 // From CMICmdInvoker::ICmd
176 bool Execute() override;
177 bool Acknowledge() override;
179 /* dtor */ ~CMICmdCmdDataReadMemory() override;
183 //============================================================================
184 // Details: MI command class. MI commands derived from the command base class.
185 // *this class implements MI command "data-list-register-names".
187 class CMICmdCmdDataListRegisterNames : public CMICmdBase {
190 // Required by the CMICmdFactory when registering *this command
191 static CMICmdBase *CreateSelf();
195 /* ctor */ CMICmdCmdDataListRegisterNames();
199 // From CMICmdInvoker::ICmd
200 bool Execute() override;
201 bool Acknowledge() override;
202 bool ParseArgs() override;
204 /* dtor */ ~CMICmdCmdDataListRegisterNames() override;
208 lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
212 const CMIUtilString m_constStrArgRegNo; // Not handled by *this command
213 CMICmnMIValueList m_miValueList;
217 //============================================================================
218 // Details: MI command class. MI commands derived from the command base class.
219 // *this class implements MI command "data-list-register-values".
221 class CMICmdCmdDataListRegisterValues : public CMICmdBase {
224 // Required by the CMICmdFactory when registering *this command
225 static CMICmdBase *CreateSelf();
229 /* ctor */ CMICmdCmdDataListRegisterValues();
233 // From CMICmdInvoker::ICmd
234 bool Execute() override;
235 bool Acknowledge() override;
236 bool ParseArgs() override;
238 /* dtor */ ~CMICmdCmdDataListRegisterValues() override;
242 lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
243 void AddToOutput(const MIuint vnIndex, const lldb::SBValue &vrValue,
244 CMICmnLLDBDebugSessionInfoVarObj::varFormat_e veVarFormat);
248 const CMIUtilString m_constStrArgSkip; // Not handled by *this command
249 const CMIUtilString m_constStrArgFormat;
250 const CMIUtilString m_constStrArgRegNo;
251 CMICmnMIValueList m_miValueList;
255 //============================================================================
256 // Details: MI command class. MI commands derived from the command base class.
257 // *this class implements MI command "data-list-changed-registers".
259 class CMICmdCmdDataListRegisterChanged : public CMICmdBase {
262 // Required by the CMICmdFactory when registering *this command
263 static CMICmdBase *CreateSelf();
267 /* ctor */ CMICmdCmdDataListRegisterChanged();
271 // From CMICmdInvoker::ICmd
272 bool Execute() override;
273 bool Acknowledge() override;
275 /* dtor */ ~CMICmdCmdDataListRegisterChanged() override;
279 //============================================================================
280 // Details: MI command class. MI commands derived from the command base class.
281 // *this class implements MI command "data-read-memory-bytes".
283 class CMICmdCmdDataWriteMemoryBytes : public CMICmdBase {
286 // Required by the CMICmdFactory when registering *this command
287 static CMICmdBase *CreateSelf();
291 /* ctor */ CMICmdCmdDataWriteMemoryBytes();
295 // From CMICmdInvoker::ICmd
296 bool Execute() override;
297 bool Acknowledge() override;
298 bool ParseArgs() override;
300 /* dtor */ ~CMICmdCmdDataWriteMemoryBytes() override;
304 const CMIUtilString m_constStrArgAddr;
305 const CMIUtilString m_constStrArgContents;
306 const CMIUtilString m_constStrArgCount;
307 CMIUtilString m_strContents;
311 //============================================================================
312 // Details: MI command class. MI commands derived from the command base class.
313 // *this class implements MI command "data-read-memory".
314 // Not specified in MI spec but Eclipse gives *this command.
316 class CMICmdCmdDataWriteMemory : public CMICmdBase {
319 // Required by the CMICmdFactory when registering *this command
320 static CMICmdBase *CreateSelf();
324 /* ctor */ CMICmdCmdDataWriteMemory();
328 // From CMICmdInvoker::ICmd
329 bool Execute() override;
330 bool Acknowledge() override;
331 bool ParseArgs() override;
333 /* dtor */ ~CMICmdCmdDataWriteMemory() override;
337 const CMIUtilString m_constStrArgOffset; // Not specified in MI spec but
338 // Eclipse gives this option.
339 const CMIUtilString m_constStrArgAddr; // Not specified in MI spec but Eclipse
340 // gives this option.
342 m_constStrArgD; // Not specified in MI spec but Eclipse gives this option.
343 const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but
344 // Eclipse gives this option.
345 const CMIUtilString m_constStrArgContents; // Not specified in MI spec but
346 // Eclipse gives this option.
348 CMIUtilString m_strContents;
350 unsigned char *m_pBufferMemory;
354 //============================================================================
355 // Details: MI command class. MI commands derived from the command base class.
356 // *this class implements MI command "data-info-line".
357 // See MIExtensions.txt for details.
359 class CMICmdCmdDataInfoLine : public CMICmdBase {
362 // Required by the CMICmdFactory when registering *this command
363 static CMICmdBase *CreateSelf();
367 /* ctor */ CMICmdCmdDataInfoLine();
371 // From CMICmdInvoker::ICmd
372 bool Execute() override;
373 bool Acknowledge() override;
374 bool ParseArgs() override;
376 /* dtor */ ~CMICmdCmdDataInfoLine() override;
380 lldb::SBCommandReturnObject m_lldbResult;
381 const CMIUtilString m_constStrArgLocation;