LLDB  mainline
CommandObject.h
Go to the documentation of this file.
1 //===-- CommandObject.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 #ifndef LLDB_INTERPRETER_COMMANDOBJECT_H
10 #define LLDB_INTERPRETER_COMMANDOBJECT_H
11 
12 #include <map>
13 #include <string>
14 #include <vector>
15 
16 #include "lldb/Utility/Flags.h"
17 
21 #include "lldb/Utility/Args.h"
24 #include "lldb/lldb-private.h"
25 
26 namespace lldb_private {
27 
28 // This function really deals with CommandObjectLists, but we didn't make a
29 // CommandObjectList class, so I'm sticking it here. But we really should have
30 // such a class. Anyway, it looks up the commands in the map that match the
31 // partial string cmd_str, inserts the matches into matches, and returns the
32 // number added.
33 
34 template <typename ValueType>
36  const std::map<std::string, ValueType> &in_map, llvm::StringRef cmd_str,
37  StringList &matches, StringList *descriptions = nullptr) {
38  int number_added = 0;
39 
40  const bool add_all = cmd_str.empty();
41 
42  for (auto iter = in_map.begin(), end = in_map.end(); iter != end; iter++) {
43  if (add_all || (iter->first.find(std::string(cmd_str), 0) == 0)) {
44  ++number_added;
45  matches.AppendString(iter->first.c_str());
46  if (descriptions)
47  descriptions->AppendString(iter->second->GetHelp());
48  }
49  }
50 
51  return number_added;
52 }
53 
54 template <typename ValueType>
55 size_t FindLongestCommandWord(std::map<std::string, ValueType> &dict) {
56  auto end = dict.end();
57  size_t max_len = 0;
58 
59  for (auto pos = dict.begin(); pos != end; ++pos) {
60  size_t len = pos->first.size();
61  if (max_len < len)
62  max_len = len;
63  }
64  return max_len;
65 }
66 
68 public:
69  typedef llvm::StringRef(ArgumentHelpCallbackFunction)();
70 
74 
75  llvm::StringRef operator()() const { return (*help_callback)(); }
76 
77  explicit operator bool() const { return (help_callback != nullptr); }
78  };
79 
80  /// Entries in the main argument information table.
83  const char *arg_name;
85  OptionEnumValues enum_values;
87  const char *help_text;
88  };
89 
90  /// Used to build individual command argument lists.
94  /// This arg might be associated only with some particular option set(s). By
95  /// default the arg associates to all option sets.
97 
100  uint32_t opt_set = LLDB_OPT_SET_ALL)
101  : arg_type(type), arg_repetition(repetition),
102  arg_opt_set_association(opt_set) {}
103  };
104 
105  typedef std::vector<CommandArgumentData>
106  CommandArgumentEntry; // Used to build individual command argument lists
107 
108  typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;
109 
110  CommandObject(CommandInterpreter &interpreter, llvm::StringRef name,
111  llvm::StringRef help = "", llvm::StringRef syntax = "",
112  uint32_t flags = 0);
113 
114  virtual ~CommandObject() = default;
115 
116  static const char *
118 
119  static const char *
121 
124 
125  virtual llvm::StringRef GetHelp();
126 
127  virtual llvm::StringRef GetHelpLong();
128 
129  virtual llvm::StringRef GetSyntax();
130 
131  llvm::StringRef GetCommandName() const;
132 
133  virtual void SetHelp(llvm::StringRef str);
134 
135  virtual void SetHelpLong(llvm::StringRef str);
136 
137  void SetSyntax(llvm::StringRef str);
138 
139  // override this to return true if you want to enable the user to delete the
140  // Command object from the Command dictionary (aliases have their own
141  // deletion scheme, so they do not need to care about this)
142  virtual bool IsRemovable() const { return false; }
143 
144  virtual bool IsMultiwordObject() { return false; }
145 
146  bool IsUserCommand() { return m_is_user_command; }
147 
148  void SetIsUserCommand(bool is_user) { m_is_user_command = is_user; }
149 
150  virtual CommandObjectMultiword *GetAsMultiwordCommand() { return nullptr; }
151 
152  virtual bool IsAlias() { return false; }
153 
154  // override this to return true if your command is somehow a "dash-dash" form
155  // of some other command (e.g. po is expr -O --); this is a powerful hint to
156  // the help system that one cannot pass options to this command
157  virtual bool IsDashDashCommand() { return false; }
158 
159  virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
160  StringList *matches = nullptr) {
161  return lldb::CommandObjectSP();
162  }
163 
164  virtual lldb::CommandObjectSP GetSubcommandSPExact(llvm::StringRef sub_cmd) {
165  return lldb::CommandObjectSP();
166  }
167 
168  virtual CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
169  StringList *matches = nullptr) {
170  return nullptr;
171  }
172 
173  void FormatLongHelpText(Stream &output_strm, llvm::StringRef long_help);
174 
176 
177  virtual void GenerateHelpText(Stream &result);
178 
179  // this is needed in order to allow the SBCommand class to transparently try
180  // and load subcommands - it will fail on anything but a multiword command,
181  // but it avoids us doing type checkings and casts
182  virtual bool LoadSubCommand(llvm::StringRef cmd_name,
183  const lldb::CommandObjectSP &command_obj) {
184  return false;
185  }
186 
187  virtual llvm::Error LoadUserSubcommand(llvm::StringRef cmd_name,
188  const lldb::CommandObjectSP &command_obj,
189  bool can_replace) {
190  return llvm::createStringError(llvm::inconvertibleErrorCode(),
191  "can only add commands to container commands");
192  }
193 
194  virtual bool WantsRawCommandString() = 0;
195 
196  // By default, WantsCompletion = !WantsRawCommandString. Subclasses who want
197  // raw command string but desire, for example, argument completion should
198  // override this method to return true.
199  virtual bool WantsCompletion() { return !WantsRawCommandString(); }
200 
201  virtual Options *GetOptions();
202 
203  static lldb::CommandArgumentType LookupArgumentName(llvm::StringRef arg_name);
204 
205  static const ArgumentTableEntry *
207 
208  int GetNumArgumentEntries();
209 
211 
212  static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type,
213  CommandInterpreter &interpreter);
214 
215  static const char *GetArgumentName(lldb::CommandArgumentType arg_type);
216 
217  // Generates a nicely formatted command args string for help command output.
218  // By default, all possible args are taken into account, for example, '<expr
219  // | variable-name>'. This can be refined by passing a second arg specifying
220  // which option set(s) we are interested, which could then, for example,
221  // produce either '<expr>' or '<variable-name>'.
223  uint32_t opt_set_mask = LLDB_OPT_SET_ALL);
224 
225  bool IsPairType(ArgumentRepetitionType arg_repeat_type);
226 
227  bool ParseOptions(Args &args, CommandReturnObject &result);
228 
229  void SetCommandName(llvm::StringRef name);
230 
231  /// This default version handles calling option argument completions and then
232  /// calls HandleArgumentCompletion if the cursor is on an argument, not an
233  /// option. Don't override this method, override HandleArgumentCompletion
234  /// instead unless you have special reasons.
235  ///
236  /// \param[in,out] request
237  /// The completion request that needs to be answered.
238  virtual void HandleCompletion(CompletionRequest &request);
239 
240  /// The input array contains a parsed version of the line.
241  ///
242  /// We've constructed the map of options and their arguments as well if that
243  /// is helpful for the completion.
244  ///
245  /// \param[in,out] request
246  /// The completion request that needs to be answered.
247  virtual void
249  OptionElementVector &opt_element_vector) {}
250 
251  bool HelpTextContainsWord(llvm::StringRef search_word,
252  bool search_short_help = true,
253  bool search_long_help = true,
254  bool search_syntax = true,
255  bool search_options = true);
256 
257  /// The flags accessor.
258  ///
259  /// \return
260  /// A reference to the Flags member variable.
261  Flags &GetFlags() { return m_flags; }
262 
263  /// The flags const accessor.
264  ///
265  /// \return
266  /// A const reference to the Flags member variable.
267  const Flags &GetFlags() const { return m_flags; }
268 
269  /// Get the command that appropriate for a "repeat" of the current command.
270  ///
271  /// \param[in] current_command_args
272  /// The command arguments.
273  ///
274  /// \return
275  /// llvm::None if there is no special repeat command - it will use the
276  /// current command line.
277  /// Otherwise a std::string containing the command to be repeated.
278  /// If the string is empty, the command won't be allow repeating.
279  virtual llvm::Optional<std::string>
280  GetRepeatCommand(Args &current_command_args, uint32_t index) {
281  return llvm::None;
282  }
283 
284  bool HasOverrideCallback() const {
287  }
288 
290  void *baton) {
292  m_command_override_baton = baton;
293  }
294 
296  void *baton) {
297  m_command_override_callback = callback;
298  m_command_override_baton = baton;
299  }
300 
301  bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result) {
304  result);
307  argv);
308  else
309  return false;
310  }
311 
312  virtual bool Execute(const char *args_string,
313  CommandReturnObject &result) = 0;
314 
315 protected:
316  bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result,
317  OptionGroupOptions &group_options,
318  ExecutionContext &exe_ctx);
319 
320  virtual const char *GetInvalidTargetDescription() {
321  return "invalid target, create a target using the 'target create' command";
322  }
323 
324  virtual const char *GetInvalidProcessDescription() {
325  return "Command requires a current process.";
326  }
327 
328  virtual const char *GetInvalidThreadDescription() {
329  return "Command requires a process which is currently stopped.";
330  }
331 
332  virtual const char *GetInvalidFrameDescription() {
333  return "Command requires a process, which is currently stopped.";
334  }
335 
336  virtual const char *GetInvalidRegContextDescription() {
337  return "invalid frame, no registers, command requires a process which is "
338  "currently stopped.";
339  }
340 
341  // This is for use in the command interpreter, when you either want the
342  // selected target, or if no target is present you want to prime the dummy
343  // target with entities that will be copied over to new targets.
344  Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
347 
348  // If a command needs to use the "current" thread, use this call. Command
349  // objects will have an ExecutionContext to use, and that may or may not have
350  // a thread in it. If it does, you should use that by default, if not, then
351  // use the ExecutionContext's target's selected thread, etc... This call
352  // insulates you from the details of this calculation.
354 
355  /// Check the command to make sure anything required by this
356  /// command is available.
357  ///
358  /// \param[out] result
359  /// A command result object, if it is not okay to run the command
360  /// this will be filled in with a suitable error.
361  ///
362  /// \return
363  /// \b true if it is okay to run this command, \b false otherwise.
365 
366  void Cleanup();
367 
370  std::unique_lock<std::recursive_mutex> m_api_locker;
376  std::vector<CommandArgumentEntry> m_arguments;
380  bool m_is_user_command = false;
381 
382  // Helper function to populate IDs or ID ranges as the command argument data
383  // to the specified command argument entry.
384  static void AddIDsArgumentData(CommandArgumentEntry &arg,
386  lldb::CommandArgumentType IDRange);
387 };
388 
390 public:
391  CommandObjectParsed(CommandInterpreter &interpreter, const char *name,
392  const char *help = nullptr, const char *syntax = nullptr,
393  uint32_t flags = 0)
394  : CommandObject(interpreter, name, help, syntax, flags) {}
395 
396  ~CommandObjectParsed() override = default;
397 
398  bool Execute(const char *args_string, CommandReturnObject &result) override;
399 
400 protected:
401  virtual bool DoExecute(Args &command, CommandReturnObject &result) = 0;
402 
403  bool WantsRawCommandString() override { return false; }
404 };
405 
407 public:
408  CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name,
409  llvm::StringRef help = "", llvm::StringRef syntax = "",
410  uint32_t flags = 0)
411  : CommandObject(interpreter, name, help, syntax, flags) {}
412 
413  ~CommandObjectRaw() override = default;
414 
415  bool Execute(const char *args_string, CommandReturnObject &result) override;
416 
417 protected:
418  virtual bool DoExecute(llvm::StringRef command,
419  CommandReturnObject &result) = 0;
420 
421  bool WantsRawCommandString() override { return true; }
422 };
423 
424 } // namespace lldb_private
425 
426 #endif // LLDB_INTERPRETER_COMMANDOBJECT_H
lldb_private::CommandObject::CommandObject
CommandObject(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
Definition: CommandObject.cpp:43
lldb_private::CommandObject::GetSelectedOrDummyTarget
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
Definition: CommandObject.cpp:684
lldb_private::CommandObjectParsed
Definition: CommandObject.h:389
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::CommandObject::GetFormattedCommandArguments
void GetFormattedCommandArguments(Stream &str, uint32_t opt_set_mask=LLDB_OPT_SET_ALL)
Definition: CommandObject.cpp:464
lldb_private::CommandObject::CommandArgumentData::arg_opt_set_association
uint32_t arg_opt_set_association
This arg might be associated only with some particular option set(s).
Definition: CommandObject.h:96
lldb_private::CommandObject::GetDummyTarget
Target & GetDummyTarget()
Definition: CommandObject.cpp:680
lldb_private::CommandObject::m_cmd_help_short
std::string m_cmd_help_short
Definition: CommandObject.h:372
lldb_private::eArgRepeatPlain
@ eArgRepeatPlain
Definition: lldb-private-enumerations.h:95
lldb_private::CommandObject::Execute
virtual bool Execute(const char *args_string, CommandReturnObject &result)=0
lldb_private::CommandObjectRaw::Execute
bool Execute(const char *args_string, CommandReturnObject &result) override
Definition: CommandObject.cpp:756
lldb_private::CommandObject::ArgumentHelpCallback::help_callback
ArgumentHelpCallbackFunction * help_callback
Definition: CommandObject.h:72
lldb_private::CommandObject::ArgumentTableEntry::help_function
ArgumentHelpCallback help_function
Definition: CommandObject.h:86
lldb_private::CommandObjectRaw::CommandObjectRaw
CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
Definition: CommandObject.h:408
lldb_private::CommandObject::ParseOptions
bool ParseOptions(Args &args, CommandReturnObject &result)
Definition: CommandObject.cpp:106
lldb_private::CommandObject::ArgumentTableEntry::completion_type
CommandCompletions::CommonCompletionTypes completion_type
Definition: CommandObject.h:84
lldb_private::CommandObject::HelpTextContainsWord
bool HelpTextContainsWord(llvm::StringRef search_word, bool search_short_help=true, bool search_long_help=true, bool search_syntax=true, bool search_options=true)
Definition: CommandObject.cpp:308
lldb_private::CommandObject::m_exe_ctx
ExecutionContext m_exe_ctx
Definition: CommandObject.h:369
lldb_private::CommandObject::ArgumentTableEntry::help_text
const char * help_text
Definition: CommandObject.h:87
lldb_private::CommandObject::GetHelpLong
virtual llvm::StringRef GetHelpLong()
Definition: CommandObject.cpp:57
lldb_private::CommandObject::IsDashDashCommand
virtual bool IsDashDashCommand()
Definition: CommandObject.h:157
lldb_private::StringList::AppendString
void AppendString(const std::string &s)
Definition: StringList.cpp:43
lldb_private::OptionGroupOptions
Definition: Options.h:255
lldb_private::CommandObjectRaw::~CommandObjectRaw
~CommandObjectRaw() override=default
lldb_private::CommandObject::CommandArgumentData
Used to build individual command argument lists.
Definition: CommandObject.h:91
lldb_private::Flags
Definition: Flags.h:22
lldb_private::CommandObject::FormatLongHelpText
void FormatLongHelpText(Stream &output_strm, llvm::StringRef long_help)
Definition: CommandObject.cpp:571
lldb_private::CommandCompletions::CommonCompletionTypes
CommonCompletionTypes
Definition: CommandCompletions.h:27
lldb_private::CommandObject::LoadSubCommand
virtual bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj)
Definition: CommandObject.h:182
lldb_private::CommandObject::ArgumentHelpCallback::operator()
llvm::StringRef operator()() const
Definition: CommandObject.h:75
lldb_private::CommandObject::SetHelpLong
virtual void SetHelpLong(llvm::StringRef str)
Definition: CommandObject.cpp:92
lldb_private::CommandObject::CommandArgumentData::arg_repetition
ArgumentRepetitionType arg_repetition
Definition: CommandObject.h:93
lldb_private::CommandObject::GetSubcommandObject
virtual CommandObject * GetSubcommandObject(llvm::StringRef sub_cmd, StringList *matches=nullptr)
Definition: CommandObject.h:168
lldb_private::CommandObject::m_command_override_baton
void * m_command_override_baton
Definition: CommandObject.h:379
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Args
Definition: Args.h:33
lldb_private::CommandObject::SetHelp
virtual void SetHelp(llvm::StringRef str)
Definition: CommandObject.cpp:88
lldb_private::CommandObject::ParseOptionsAndNotify
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
Definition: CommandObject.cpp:343
lldb_private::Target
Definition: Target.h:469
CompletionRequest.h
lldb_private::CommandObject::GetSubcommandSPExact
virtual lldb::CommandObjectSP GetSubcommandSPExact(llvm::StringRef sub_cmd)
Definition: CommandObject.h:164
lldb_private::CommandObject::ArgumentTableEntry::enum_values
OptionEnumValues enum_values
Definition: CommandObject.h:85
lldb_private::CommandObject::IsUserCommand
bool IsUserCommand()
Definition: CommandObject.h:146
lldb_private::CommandObject::CheckRequirements
bool CheckRequirements(CommandReturnObject &result)
Check the command to make sure anything required by this command is available.
Definition: CommandObject.cpp:147
lldb_private::CommandObject::ArgumentHelpCallback::self_formatting
bool self_formatting
Definition: CommandObject.h:73
lldb_private::CommandObject::m_arguments
std::vector< CommandArgumentEntry > m_arguments
Definition: CommandObject.h:376
lldb_private::CommandObjectParsed::WantsRawCommandString
bool WantsRawCommandString() override
Definition: CommandObject.h:403
lldb_private::CommandObject::GetArgumentHelp
static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type, CommandInterpreter &interpreter)
Definition: CommandObject.cpp:377
lldb_private::CommandObject::HasOverrideCallback
bool HasOverrideCallback() const
Definition: CommandObject.h:284
lldb_private::CommandObjectMultiword
Definition: CommandObjectMultiword.h:19
Options.h
lldb_private::CommandObject::GetAsMultiwordCommand
virtual CommandObjectMultiword * GetAsMultiwordCommand()
Definition: CommandObject.h:150
lldb_private::CommandObject::GetInvalidTargetDescription
virtual const char * GetInvalidTargetDescription()
Definition: CommandObject.h:320
lldb_private::Options
Definition: Options.h:57
bool
ID
static char ID
Definition: IRDynamicChecks.cpp:33
lldb::CommandArgumentType
CommandArgumentType
Definition: lldb-enumerations.h:515
lldb_private::CommandObject::GetSyntax
virtual llvm::StringRef GetSyntax()
Definition: CommandObject.cpp:59
lldb_private::CommandObject::GetInvalidFrameDescription
virtual const char * GetInvalidFrameDescription()
Definition: CommandObject.h:332
lldb_private::CommandObject::SetOverrideCallback
void SetOverrideCallback(lldb::CommandOverrideCallbackWithResult callback, void *baton)
Definition: CommandObject.h:295
lldb_private::CommandObject::GetNumArgumentEntries
int GetNumArgumentEntries()
Definition: CommandObject.cpp:358
Args.h
lldb_private::CommandObjectParsed::CommandObjectParsed
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
Definition: CommandObject.h:391
lldb_private::Thread
Definition: Thread.h:61
lldb_private::CommandObject::IsRemovable
virtual bool IsRemovable() const
Definition: CommandObject.h:142
lldb_private::CommandObject::GetInvalidRegContextDescription
virtual const char * GetInvalidRegContextDescription()
Definition: CommandObject.h:336
lldb_private::CommandObject::ArgumentHelpCallback
Definition: CommandObject.h:71
lldb_private::CommandObject::IsPairType
bool IsPairType(ArgumentRepetitionType arg_repeat_type)
Definition: CommandObject.cpp:441
lldb_private::CommandObject::SetCommandName
void SetCommandName(llvm::StringRef name)
Definition: CommandObject.cpp:84
LLDB_OPT_SET_ALL
#define LLDB_OPT_SET_ALL
Definition: lldb-defines.h:101
lldb_private::CommandObject::GetArgumentName
static const char * GetArgumentName(lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:426
lldb_private::StringList
Definition: StringList.h:26
lldb_private::CommandObject::CommandMap
std::map< std::string, lldb::CommandObjectSP > CommandMap
Definition: CommandObject.h:108
lldb_private::CommandObject::HandleArgumentCompletion
virtual void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector)
The input array contains a parsed version of the line.
Definition: CommandObject.h:248
lldb_private::CommandObject::GetRepeatCommand
virtual llvm::Optional< std::string > GetRepeatCommand(Args &current_command_args, uint32_t index)
Get the command that appropriate for a "repeat" of the current command.
Definition: CommandObject.h:280
lldb_private::CommandObject::GetCommandName
llvm::StringRef GetCommandName() const
Definition: CommandObject.cpp:82
lldb_private::CommandObject::ArgumentTableEntry::arg_type
lldb::CommandArgumentType arg_type
Definition: CommandObject.h:82
lldb_private::CommandObject::GetOptions
virtual Options * GetOptions()
Definition: CommandObject.cpp:100
lldb_private::CommandObjectRaw::WantsRawCommandString
bool WantsRawCommandString() override
Definition: CommandObject.h:421
lldb_private::CommandObject::ArgumentHelpCallbackFunction
llvm::StringRef() ArgumentHelpCallbackFunction()
Definition: CommandObject.h:69
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
lldb_private::Debugger
Definition: Debugger.h:74
lldb_private::CommandObject::m_interpreter
CommandInterpreter & m_interpreter
Definition: CommandObject.h:368
lldb_private::CommandObject::GetDefaultThread
Thread * GetDefaultThread()
Definition: CommandObject.cpp:697
lldb_private::CommandObject::GetFlags
const Flags & GetFlags() const
The flags const accessor.
Definition: CommandObject.h:267
lldb_private::CommandObject::CommandArgumentData::arg_type
lldb::CommandArgumentType arg_type
Definition: CommandObject.h:92
lldb_private::OptionElementVector
std::vector< OptionArgElement > OptionElementVector
Definition: Options.h:42
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
StringList.h
lldb_private::CommandObject::GetSelectedTarget
Target & GetSelectedTarget()
Definition: CommandObject.cpp:688
lldb_private::CommandObject::GetInvalidProcessDescription
virtual const char * GetInvalidProcessDescription()
Definition: CommandObject.h:324
lldb_private::CommandObjectRaw
Definition: CommandObject.h:406
lldb-private.h
lldb_private::CommandObject
Definition: CommandObject.h:67
lldb_private::CommandObject::IsAlias
virtual bool IsAlias()
Definition: CommandObject.h:152
lldb_private::ArgumentRepetitionType
ArgumentRepetitionType
Definition: lldb-private-enumerations.h:94
lldb_private::CommandObjectRaw::DoExecute
virtual bool DoExecute(llvm::StringRef command, CommandReturnObject &result)=0
lldb_private::CommandObject::SetOverrideCallback
void SetOverrideCallback(lldb::CommandOverrideCallback callback, void *baton)
Definition: CommandObject.h:289
lldb_private::AddNamesMatchingPartialString
int AddNamesMatchingPartialString(const std::map< std::string, ValueType > &in_map, llvm::StringRef cmd_str, StringList &matches, StringList *descriptions=nullptr)
Definition: CommandObject.h:35
lldb_private::CommandObject::LookupArgumentName
static lldb::CommandArgumentType LookupArgumentName(llvm::StringRef arg_name)
Definition: CommandObject.cpp:559
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:26
lldb_private::CommandObject::AddIDsArgumentData
static void AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange)
Definition: CommandObject.cpp:643
uint32_t
lldb_private::CommandObject::GetFlags
Flags & GetFlags()
The flags accessor.
Definition: CommandObject.h:261
lldb_private::CommandObject::m_cmd_name
std::string m_cmd_name
Definition: CommandObject.h:371
lldb_private::CommandObject::IsMultiwordObject
virtual bool IsMultiwordObject()
Definition: CommandObject.h:144
lldb::eArgTypeNone
@ eArgTypeNone
Definition: lldb-enumerations.h:595
lldb_private::FindLongestCommandWord
size_t FindLongestCommandWord(std::map< std::string, ValueType > &dict)
Definition: CommandObject.h:55
lldb_private::CommandObject::HandleCompletion
virtual void HandleCompletion(CompletionRequest &request)
This default version handles calling option argument completions and then calls HandleArgumentComplet...
Definition: CommandObject.cpp:275
lldb_private::CommandObject::GetSubcommandSP
virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches=nullptr)
Definition: CommandObject.h:159
lldb_private::CommandObject::m_api_locker
std::unique_lock< std::recursive_mutex > m_api_locker
Definition: CommandObject.h:370
lldb_private::CommandObject::SetSyntax
void SetSyntax(llvm::StringRef str)
Definition: CommandObject.cpp:96
lldb_private::CommandObject::FindArgumentDataByType
static const ArgumentTableEntry * FindArgumentDataByType(lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:369
lldb_private::CommandObject::ArgumentTableEntry
Entries in the main argument information table.
Definition: CommandObject.h:81
lldb_private::CommandObject::GetArgumentEntryAtIndex
CommandArgumentEntry * GetArgumentEntryAtIndex(int idx)
Definition: CommandObject.cpp:361
lldb_private::CommandObject::GetCommandInterpreter
CommandInterpreter & GetCommandInterpreter()
Definition: CommandObject.h:122
lldb_private::CommandObject::m_cmd_help_long
std::string m_cmd_help_long
Definition: CommandObject.h:373
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::CommandObject::~CommandObject
virtual ~CommandObject()=default
lldb_private::CommandObjectParsed::Execute
bool Execute(const char *args_string, CommandReturnObject &result) override
Definition: CommandObject.cpp:718
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:30
lldb_private::CommandObjectParsed::DoExecute
virtual bool DoExecute(Args &command, CommandReturnObject &result)=0
lldb::CommandOverrideCallback
bool(* CommandOverrideCallback)(void *baton, const char **argv)
Definition: lldb-types.h:71
lldb_private::CommandObject::GetInvalidThreadDescription
virtual const char * GetInvalidThreadDescription()
Definition: CommandObject.h:328
lldb_private::CommandObject::WantsCompletion
virtual bool WantsCompletion()
Definition: CommandObject.h:199
lldb_private::CommandObject::CommandArgumentData::CommandArgumentData
CommandArgumentData(lldb::CommandArgumentType type=lldb::eArgTypeNone, ArgumentRepetitionType repetition=eArgRepeatPlain, uint32_t opt_set=LLDB_OPT_SET_ALL)
Definition: CommandObject.h:98
lldb_private::CommandObject::GetArgumentDescriptionAsCString
static const char * GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:673
Flags.h
lldb_private::CommandObject::ArgumentTableEntry::arg_name
const char * arg_name
Definition: CommandObject.h:83
lldb::CommandOverrideCallbackWithResult
bool(* CommandOverrideCallbackWithResult)(void *baton, const char **argv, lldb_private::CommandReturnObject &result)
Definition: lldb-types.h:72
lldb_private::CommandObject::m_deprecated_command_override_callback
lldb::CommandOverrideCallback m_deprecated_command_override_callback
Definition: CommandObject.h:377
lldb_private::CommandObject::LoadUserSubcommand
virtual llvm::Error LoadUserSubcommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj, bool can_replace)
Definition: CommandObject.h:187
lldb_private::CommandObject::CommandArgumentEntry
std::vector< CommandArgumentData > CommandArgumentEntry
Definition: CommandObject.h:106
lldb_private::CommandObject::Cleanup
void Cleanup()
Definition: CommandObject.cpp:269
lldb_private::CommandObject::GetArgumentTypeAsCString
static const char * GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:666
lldb_private::CommandObject::SetIsUserCommand
void SetIsUserCommand(bool is_user)
Definition: CommandObject.h:148
lldb_private::CommandObject::InvokeOverrideCallback
bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result)
Definition: CommandObject.h:301
lldb_private::CommandObject::m_is_user_command
bool m_is_user_command
Definition: CommandObject.h:380
lldb_private::CommandObject::m_command_override_callback
lldb::CommandOverrideCallbackWithResult m_command_override_callback
Definition: CommandObject.h:378
lldb_private::CommandObject::WantsRawCommandString
virtual bool WantsRawCommandString()=0
ExecutionContext.h
CommandCompletions.h
lldb_private::CommandObject::m_cmd_syntax
std::string m_cmd_syntax
Definition: CommandObject.h:374
lldb_private::CommandObjectParsed::~CommandObjectParsed
~CommandObjectParsed() override=default
lldb_private::CommandObject::GetHelp
virtual llvm::StringRef GetHelp()
Definition: CommandObject.cpp:55
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::CommandObject::GetDebugger
Debugger & GetDebugger()
Definition: CommandObject.cpp:53
lldb_private::CommandObject::m_flags
Flags m_flags
Definition: CommandObject.h:375
lldb_private::CommandObject::GenerateHelpText
void GenerateHelpText(CommandReturnObject &result)
Definition: CommandObject.cpp:592