]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/tools/lldb-mi/MICmdCmdData.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / tools / lldb-mi / MICmdCmdData.h
1 //===-- MICmdCmdData.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:    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.
19 //
20 //              To implement new MI commands derive a new command class from the
21 //              command base
22 //              class. To enable the new command for interpretation add the new
23 //              command class
24 //              to the command factory. The files of relevance are:
25 //                  MICmdCommands.cpp
26 //                  MICmdBase.h / .cpp
27 //                  MICmdCmd.h / .cpp
28 //              For an introduction to adding a new command see
29 //              CMICmdCmdSupportInfoMiCmdQuery
30 //              command class as an example.
31 //
32
33 #pragma once
34
35 // Third party headers:
36 #include "lldb/API/SBError.h"
37
38 // In-house headers:
39 #include "MICmdBase.h"
40 #include "MICmnLLDBDebugSessionInfoVarObj.h"
41 #include "MICmnMIValueList.h"
42 #include "MICmnMIValueTuple.h"
43 #include "MICmnMIResultRecord.h"
44
45 //++
46 //============================================================================
47 // Details: MI command class. MI commands derived from the command base class.
48 //          *this class implements MI command "data-evaluate-expression".
49 //--
50 class CMICmdCmdDataEvaluateExpression : public CMICmdBase {
51   // Statics:
52 public:
53   // Required by the CMICmdFactory when registering *this command
54   static CMICmdBase *CreateSelf();
55
56   // Methods:
57 public:
58   /* ctor */ CMICmdCmdDataEvaluateExpression();
59
60   // Overridden:
61 public:
62   // From CMICmdInvoker::ICmd
63   bool Execute() override;
64   bool Acknowledge() override;
65   bool ParseArgs() override;
66   // From CMICmnBase
67   /* dtor */ ~CMICmdCmdDataEvaluateExpression() override;
68
69   // Methods:
70 private:
71   bool HaveInvalidCharacterInExpression(const CMIUtilString &vrExpr,
72                                         char &vrwInvalidChar);
73
74   // Attributes:
75 private:
76   bool m_bExpressionValid;     // True = yes is valid, false = not valid
77   bool m_bEvaluatedExpression; // True = yes is expression evaluated, false =
78                                // failed
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;
87 };
88
89 //++
90 //============================================================================
91 // Details: MI command class. MI commands derived from the command base class.
92 //          *this class implements MI command "data-disassemble".
93 //--
94 class CMICmdCmdDataDisassemble : public CMICmdBase {
95   // Statics:
96 public:
97   // Required by the CMICmdFactory when registering *this command
98   static CMICmdBase *CreateSelf();
99
100   // Methods:
101 public:
102   /* ctor */ CMICmdCmdDataDisassemble();
103
104   // Overridden:
105 public:
106   // From CMICmdInvoker::ICmd
107   bool Execute() override;
108   bool Acknowledge() override;
109   bool ParseArgs() override;
110   // From CMICmnBase
111   /* dtor */ ~CMICmdCmdDataDisassemble() override;
112
113   // Attributes:
114 private:
115   const CMIUtilString
116       m_constStrArgAddrStart; // MI spec non mandatory, *this command mandatory
117   const CMIUtilString
118       m_constStrArgAddrEnd; // MI spec non mandatory, *this command mandatory
119   const CMIUtilString m_constStrArgMode;
120   CMICmnMIValueList m_miValueList;
121 };
122
123 //++
124 //============================================================================
125 // Details: MI command class. MI commands derived from the command base class.
126 //          *this class implements MI command "data-read-memory-bytes".
127 //--
128 class CMICmdCmdDataReadMemoryBytes : public CMICmdBase {
129   // Statics:
130 public:
131   // Required by the CMICmdFactory when registering *this command
132   static CMICmdBase *CreateSelf();
133
134   // Methods:
135 public:
136   /* ctor */ CMICmdCmdDataReadMemoryBytes();
137
138   // Overridden:
139 public:
140   // From CMICmdInvoker::ICmd
141   bool Execute() override;
142   bool Acknowledge() override;
143   bool ParseArgs() override;
144   // From CMICmnBase
145   /* dtor */ ~CMICmdCmdDataReadMemoryBytes() override;
146
147   // Attributes:
148 private:
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;
155 };
156
157 //++
158 //============================================================================
159 // Details: MI command class. MI commands derived from the command base class.
160 //          *this class implements MI command "data-read-memory".
161 //--
162 class CMICmdCmdDataReadMemory : public CMICmdBase {
163   // Statics:
164 public:
165   // Required by the CMICmdFactory when registering *this command
166   static CMICmdBase *CreateSelf();
167
168   // Methods:
169 public:
170   /* ctor */ CMICmdCmdDataReadMemory();
171
172   // Overridden:
173 public:
174   // From CMICmdInvoker::ICmd
175   bool Execute() override;
176   bool Acknowledge() override;
177   // From CMICmnBase
178   /* dtor */ ~CMICmdCmdDataReadMemory() override;
179 };
180
181 //++
182 //============================================================================
183 // Details: MI command class. MI commands derived from the command base class.
184 //          *this class implements MI command "data-list-register-names".
185 //--
186 class CMICmdCmdDataListRegisterNames : public CMICmdBase {
187   // Statics:
188 public:
189   // Required by the CMICmdFactory when registering *this command
190   static CMICmdBase *CreateSelf();
191
192   // Methods:
193 public:
194   /* ctor */ CMICmdCmdDataListRegisterNames();
195
196   // Overridden:
197 public:
198   // From CMICmdInvoker::ICmd
199   bool Execute() override;
200   bool Acknowledge() override;
201   bool ParseArgs() override;
202   // From CMICmnBase
203   /* dtor */ ~CMICmdCmdDataListRegisterNames() override;
204
205   // Methods:
206 private:
207   lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
208
209   // Attributes:
210 private:
211   const CMIUtilString m_constStrArgRegNo; // Not handled by *this command
212   CMICmnMIValueList m_miValueList;
213 };
214
215 //++
216 //============================================================================
217 // Details: MI command class. MI commands derived from the command base class.
218 //          *this class implements MI command "data-list-register-values".
219 //--
220 class CMICmdCmdDataListRegisterValues : public CMICmdBase {
221   // Statics:
222 public:
223   // Required by the CMICmdFactory when registering *this command
224   static CMICmdBase *CreateSelf();
225
226   // Methods:
227 public:
228   /* ctor */ CMICmdCmdDataListRegisterValues();
229
230   // Overridden:
231 public:
232   // From CMICmdInvoker::ICmd
233   bool Execute() override;
234   bool Acknowledge() override;
235   bool ParseArgs() override;
236   // From CMICmnBase
237   /* dtor */ ~CMICmdCmdDataListRegisterValues() override;
238
239   // Methods:
240 private:
241   lldb::SBValue GetRegister(const MIuint vRegisterIndex) const;
242   void AddToOutput(const MIuint vnIndex, const lldb::SBValue &vrValue,
243                    CMICmnLLDBDebugSessionInfoVarObj::varFormat_e veVarFormat);
244
245   // Attributes:
246 private:
247   const CMIUtilString m_constStrArgSkip; // Not handled by *this command
248   const CMIUtilString m_constStrArgFormat;
249   const CMIUtilString m_constStrArgRegNo;
250   CMICmnMIValueList m_miValueList;
251 };
252
253 //++
254 //============================================================================
255 // Details: MI command class. MI commands derived from the command base class.
256 //          *this class implements MI command "data-list-changed-registers".
257 //--
258 class CMICmdCmdDataListRegisterChanged : public CMICmdBase {
259   // Statics:
260 public:
261   // Required by the CMICmdFactory when registering *this command
262   static CMICmdBase *CreateSelf();
263
264   // Methods:
265 public:
266   /* ctor */ CMICmdCmdDataListRegisterChanged();
267
268   // Overridden:
269 public:
270   // From CMICmdInvoker::ICmd
271   bool Execute() override;
272   bool Acknowledge() override;
273   // From CMICmnBase
274   /* dtor */ ~CMICmdCmdDataListRegisterChanged() override;
275 };
276
277 //++
278 //============================================================================
279 // Details: MI command class. MI commands derived from the command base class.
280 //          *this class implements MI command "data-read-memory-bytes".
281 //--
282 class CMICmdCmdDataWriteMemoryBytes : public CMICmdBase {
283   // Statics:
284 public:
285   // Required by the CMICmdFactory when registering *this command
286   static CMICmdBase *CreateSelf();
287
288   // Methods:
289 public:
290   /* ctor */ CMICmdCmdDataWriteMemoryBytes();
291
292   // Overridden:
293 public:
294   // From CMICmdInvoker::ICmd
295   bool Execute() override;
296   bool Acknowledge() override;
297   bool ParseArgs() override;
298   // From CMICmnBase
299   /* dtor */ ~CMICmdCmdDataWriteMemoryBytes() override;
300
301   // Attributes:
302 private:
303   const CMIUtilString m_constStrArgAddr;
304   const CMIUtilString m_constStrArgContents;
305   const CMIUtilString m_constStrArgCount;
306   CMIUtilString m_strContents;
307 };
308
309 //++
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.
314 //--
315 class CMICmdCmdDataWriteMemory : public CMICmdBase {
316   // Statics:
317 public:
318   // Required by the CMICmdFactory when registering *this command
319   static CMICmdBase *CreateSelf();
320
321   // Methods:
322 public:
323   /* ctor */ CMICmdCmdDataWriteMemory();
324
325   // Overridden:
326 public:
327   // From CMICmdInvoker::ICmd
328   bool Execute() override;
329   bool Acknowledge() override;
330   bool ParseArgs() override;
331   // From CMICmnBase
332   /* dtor */ ~CMICmdCmdDataWriteMemory() override;
333
334   // Attributes:
335 private:
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.
340   const CMIUtilString
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.
346   MIuint64 m_nAddr;
347   CMIUtilString m_strContents;
348   MIuint64 m_nCount;
349   unsigned char *m_pBufferMemory;
350 };
351
352 //++
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.
357 //--
358 class CMICmdCmdDataInfoLine : public CMICmdBase {
359   // Statics:
360 public:
361   // Required by the CMICmdFactory when registering *this command
362   static CMICmdBase *CreateSelf();
363
364   // Methods:
365 public:
366   /* ctor */ CMICmdCmdDataInfoLine();
367
368   // Overridden:
369 public:
370   // From CMICmdInvoker::ICmd
371   bool Execute() override;
372   bool Acknowledge() override;
373   bool ParseArgs() override;
374   // From CMICmnBase
375   /* dtor */ ~CMICmdCmdDataInfoLine() override;
376
377   // Attributes:
378 private:
379   const CMIUtilString m_constStrArgLocation;
380   CMICmnMIResultRecord m_resultRecord;
381 };