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  struct ArgumentTableEntry // Entries in the main argument information table
81  {
83  const char *arg_name;
86  const char *help_text;
87  };
88 
89  struct CommandArgumentData // Used to build individual command argument lists
90  {
93  /// This arg might be associated only with some particular option set(s). By
94  /// default the arg associates to all option sets.
96 
99  uint32_t opt_set = LLDB_OPT_SET_ALL)
100  : arg_type(type), arg_repetition(repetition),
101  arg_opt_set_association(opt_set) {}
102  };
103 
104  typedef std::vector<CommandArgumentData>
105  CommandArgumentEntry; // Used to build individual command argument lists
106 
108  [lldb::eArgTypeLastArg]; // Main argument information table
109 
110  typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;
111 
112  CommandObject(CommandInterpreter &interpreter, llvm::StringRef name,
113  llvm::StringRef help = "", llvm::StringRef syntax = "",
114  uint32_t flags = 0);
115 
116  virtual ~CommandObject() = default;
117 
118  static const char *
120 
121  static const char *
123 
126 
127  virtual llvm::StringRef GetHelp();
128 
129  virtual llvm::StringRef GetHelpLong();
130 
131  virtual llvm::StringRef GetSyntax();
132 
133  llvm::StringRef GetCommandName() const;
134 
135  virtual void SetHelp(llvm::StringRef str);
136 
137  virtual void SetHelpLong(llvm::StringRef str);
138 
139  void SetSyntax(llvm::StringRef str);
140 
141  // override this to return true if you want to enable the user to delete the
142  // Command object from the Command dictionary (aliases have their own
143  // deletion scheme, so they do not need to care about this)
144  virtual bool IsRemovable() const { return false; }
145 
146  virtual bool IsMultiwordObject() { return false; }
147 
148  virtual CommandObjectMultiword *GetAsMultiwordCommand() { return nullptr; }
149 
150  virtual bool IsAlias() { return false; }
151 
152  // override this to return true if your command is somehow a "dash-dash" form
153  // of some other command (e.g. po is expr -O --); this is a powerful hint to
154  // the help system that one cannot pass options to this command
155  virtual bool IsDashDashCommand() { return false; }
156 
157  virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
158  StringList *matches = nullptr) {
159  return lldb::CommandObjectSP();
160  }
161 
162  virtual CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
163  StringList *matches = nullptr) {
164  return nullptr;
165  }
166 
167  virtual void AproposAllSubCommands(llvm::StringRef prefix,
168  llvm::StringRef search_word,
169  StringList &commands_found,
170  StringList &commands_help) {}
171 
172  void FormatLongHelpText(Stream &output_strm, llvm::StringRef long_help);
173 
175 
176  virtual void GenerateHelpText(Stream &result);
177 
178  // this is needed in order to allow the SBCommand class to transparently try
179  // and load subcommands - it will fail on anything but a multiword command,
180  // but it avoids us doing type checkings and casts
181  virtual bool LoadSubCommand(llvm::StringRef cmd_name,
182  const lldb::CommandObjectSP &command_obj) {
183  return false;
184  }
185 
186  virtual bool WantsRawCommandString() = 0;
187 
188  // By default, WantsCompletion = !WantsRawCommandString. Subclasses who want
189  // raw command string but desire, for example, argument completion should
190  // override this method to return true.
191  virtual bool WantsCompletion() { return !WantsRawCommandString(); }
192 
193  virtual Options *GetOptions();
194 
195  static const ArgumentTableEntry *GetArgumentTable();
196 
197  static lldb::CommandArgumentType LookupArgumentName(llvm::StringRef arg_name);
198 
199  static const ArgumentTableEntry *
201 
202  int GetNumArgumentEntries();
203 
205 
206  static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type,
207  CommandInterpreter &interpreter);
208 
209  static const char *GetArgumentName(lldb::CommandArgumentType arg_type);
210 
211  // Generates a nicely formatted command args string for help command output.
212  // By default, all possible args are taken into account, for example, '<expr
213  // | variable-name>'. This can be refined by passing a second arg specifying
214  // which option set(s) we are interested, which could then, for example,
215  // produce either '<expr>' or '<variable-name>'.
217  uint32_t opt_set_mask = LLDB_OPT_SET_ALL);
218 
219  bool IsPairType(ArgumentRepetitionType arg_repeat_type);
220 
221  bool ParseOptions(Args &args, CommandReturnObject &result);
222 
223  void SetCommandName(llvm::StringRef name);
224 
225  /// This default version handles calling option argument completions and then
226  /// calls HandleArgumentCompletion if the cursor is on an argument, not an
227  /// option. Don't override this method, override HandleArgumentCompletion
228  /// instead unless you have special reasons.
229  ///
230  /// \param[in,out] request
231  /// The completion request that needs to be answered.
232  virtual void HandleCompletion(CompletionRequest &request);
233 
234  /// The input array contains a parsed version of the line.
235  ///
236  /// We've constructed the map of options and their arguments as well if that
237  /// is helpful for the completion.
238  ///
239  /// \param[in,out] request
240  /// The completion request that needs to be answered.
241  virtual void
243  OptionElementVector &opt_element_vector) {}
244 
245  bool HelpTextContainsWord(llvm::StringRef search_word,
246  bool search_short_help = true,
247  bool search_long_help = true,
248  bool search_syntax = true,
249  bool search_options = true);
250 
251  /// The flags accessor.
252  ///
253  /// \return
254  /// A reference to the Flags member variable.
255  Flags &GetFlags() { return m_flags; }
256 
257  /// The flags const accessor.
258  ///
259  /// \return
260  /// A const reference to the Flags member variable.
261  const Flags &GetFlags() const { return m_flags; }
262 
263  /// Get the command that appropriate for a "repeat" of the current command.
264  ///
265  /// \param[in] current_command_args
266  /// The command arguments.
267  ///
268  /// \return
269  /// nullptr if there is no special repeat command - it will use the
270  /// current command line.
271  /// Otherwise a pointer to the command to be repeated.
272  /// If the returned string is the empty string, the command won't be
273  /// repeated.
274  virtual const char *GetRepeatCommand(Args &current_command_args,
275  uint32_t index) {
276  return nullptr;
277  }
278 
279  bool HasOverrideCallback() const {
282  }
283 
285  void *baton) {
287  m_command_override_baton = baton;
288  }
289 
291  void *baton) {
292  m_command_override_callback = callback;
293  m_command_override_baton = baton;
294  }
295 
296  bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result) {
299  result);
302  argv);
303  else
304  return false;
305  }
306 
307  virtual bool Execute(const char *args_string,
308  CommandReturnObject &result) = 0;
309 
310 protected:
311  bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result,
312  OptionGroupOptions &group_options,
313  ExecutionContext &exe_ctx);
314 
315  virtual const char *GetInvalidTargetDescription() {
316  return "invalid target, create a target using the 'target create' command";
317  }
318 
319  virtual const char *GetInvalidProcessDescription() {
320  return "invalid process";
321  }
322 
323  virtual const char *GetInvalidThreadDescription() { return "invalid thread"; }
324 
325  virtual const char *GetInvalidFrameDescription() { return "invalid frame"; }
326 
327  virtual const char *GetInvalidRegContextDescription() {
328  return "invalid frame, no registers";
329  }
330 
331  // This is for use in the command interpreter, when you either want the
332  // selected target, or if no target is present you want to prime the dummy
333  // target with entities that will be copied over to new targets.
334  Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
337 
338  // If a command needs to use the "current" thread, use this call. Command
339  // objects will have an ExecutionContext to use, and that may or may not have
340  // a thread in it. If it does, you should use that by default, if not, then
341  // use the ExecutionContext's target's selected thread, etc... This call
342  // insulates you from the details of this calculation.
344 
345  /// Check the command to make sure anything required by this
346  /// command is available.
347  ///
348  /// \param[out] result
349  /// A command result object, if it is not okay to run the command
350  /// this will be filled in with a suitable error.
351  ///
352  /// \return
353  /// \b true if it is okay to run this command, \b false otherwise.
355 
356  void Cleanup();
357 
360  std::unique_lock<std::recursive_mutex> m_api_locker;
366  std::vector<CommandArgumentEntry> m_arguments;
370 
371  // Helper function to populate IDs or ID ranges as the command argument data
372  // to the specified command argument entry.
373  static void AddIDsArgumentData(CommandArgumentEntry &arg,
375  lldb::CommandArgumentType IDRange);
376 };
377 
379 public:
380  CommandObjectParsed(CommandInterpreter &interpreter, const char *name,
381  const char *help = nullptr, const char *syntax = nullptr,
382  uint32_t flags = 0)
383  : CommandObject(interpreter, name, help, syntax, flags) {}
384 
385  ~CommandObjectParsed() override = default;
386 
387  bool Execute(const char *args_string, CommandReturnObject &result) override;
388 
389 protected:
390  virtual bool DoExecute(Args &command, CommandReturnObject &result) = 0;
391 
392  bool WantsRawCommandString() override { return false; }
393 };
394 
396 public:
397  CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name,
398  llvm::StringRef help = "", llvm::StringRef syntax = "",
399  uint32_t flags = 0)
400  : CommandObject(interpreter, name, help, syntax, flags) {}
401 
402  ~CommandObjectRaw() override = default;
403 
404  bool Execute(const char *args_string, CommandReturnObject &result) override;
405 
406 protected:
407  virtual bool DoExecute(llvm::StringRef command,
408  CommandReturnObject &result) = 0;
409 
410  bool WantsRawCommandString() override { return true; }
411 };
412 
413 } // namespace lldb_private
414 
415 #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:41
lldb_private::CommandObject::GetSelectedOrDummyTarget
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
Definition: CommandObject.cpp:938
lldb_private::CommandObjectParsed
Definition: CommandObject.h:378
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:447
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:95
lldb_private::CommandObject::GetDummyTarget
Target & GetDummyTarget()
Definition: CommandObject.cpp:934
lldb_private::CommandObject::m_cmd_help_short
std::string m_cmd_help_short
Definition: CommandObject.h:362
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:1004
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:85
lldb_private::CommandObjectRaw::CommandObjectRaw
CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
Definition: CommandObject.h:397
lldb_private::CommandObject::ParseOptions
bool ParseOptions(Args &args, CommandReturnObject &result)
Definition: CommandObject.cpp:104
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:306
lldb_private::CommandObject::m_exe_ctx
ExecutionContext m_exe_ctx
Definition: CommandObject.h:359
lldb_private::CommandObject::ArgumentTableEntry::help_text
const char * help_text
Definition: CommandObject.h:86
lldb_private::CommandObject::GetHelpLong
virtual llvm::StringRef GetHelpLong()
Definition: CommandObject.cpp:55
lldb_private::CommandObject::IsDashDashCommand
virtual bool IsDashDashCommand()
Definition: CommandObject.h:155
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
Definition: CommandObject.h:89
lldb_private::Flags
Definition: Flags.h:22
lldb_private::CommandObject::FormatLongHelpText
void FormatLongHelpText(Stream &output_strm, llvm::StringRef long_help)
Definition: CommandObject.cpp:825
lldb_private::CommandObject::g_arguments_data
static ArgumentTableEntry g_arguments_data[lldb::eArgTypeLastArg]
Definition: CommandObject.h:108
lldb_private::CommandCompletions::CommonCompletionTypes
CommonCompletionTypes
Definition: CommandCompletions.h:26
lldb_private::CommandObject::LoadSubCommand
virtual bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj)
Definition: CommandObject.h:181
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:90
lldb_private::CommandObject::CommandArgumentData::arg_repetition
ArgumentRepetitionType arg_repetition
Definition: CommandObject.h:92
lldb_private::CommandObject::GetSubcommandObject
virtual CommandObject * GetSubcommandObject(llvm::StringRef sub_cmd, StringList *matches=nullptr)
Definition: CommandObject.h:162
lldb_private::CommandObject::m_command_override_baton
void * m_command_override_baton
Definition: CommandObject.h:369
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:86
lldb_private::CommandObject::ParseOptionsAndNotify
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
Definition: CommandObject.cpp:341
lldb_private::Target
Definition: Target.h:454
CompletionRequest.h
lldb_private::CommandObject::CheckRequirements
bool CheckRequirements(CommandReturnObject &result)
Check the command to make sure anything required by this command is available.
Definition: CommandObject.cpp:145
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:366
lldb_private::CommandObjectParsed::WantsRawCommandString
bool WantsRawCommandString() override
Definition: CommandObject.h:392
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:279
lldb_private::CommandObjectMultiword
Definition: CommandObjectMultiword.h:19
Options.h
lldb_private::CommandObject::GetAsMultiwordCommand
virtual CommandObjectMultiword * GetAsMultiwordCommand()
Definition: CommandObject.h:148
lldb_private::CommandObject::GetInvalidTargetDescription
virtual const char * GetInvalidTargetDescription()
Definition: CommandObject.h:315
lldb_private::Options
Definition: Options.h:57
ID
static char ID
Definition: IRDynamicChecks.cpp:32
lldb::CommandArgumentType
CommandArgumentType
Definition: lldb-enumerations.h:515
lldb_private::CommandObject::GetSyntax
virtual llvm::StringRef GetSyntax()
Definition: CommandObject.cpp:57
lldb_private::CommandObject::GetInvalidFrameDescription
virtual const char * GetInvalidFrameDescription()
Definition: CommandObject.h:325
lldb_private::CommandObject::SetOverrideCallback
void SetOverrideCallback(lldb::CommandOverrideCallbackWithResult callback, void *baton)
Definition: CommandObject.h:290
lldb::eArgTypeLastArg
@ eArgTypeLastArg
Definition: lldb-enumerations.h:605
lldb_private::CommandObject::GetNumArgumentEntries
int GetNumArgumentEntries()
Definition: CommandObject.cpp:356
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:380
lldb_private::CommandObject::GetRepeatCommand
virtual const char * GetRepeatCommand(Args &current_command_args, uint32_t index)
Get the command that appropriate for a "repeat" of the current command.
Definition: CommandObject.h:274
lldb_private::Thread
Definition: Thread.h:62
lldb_private::CommandObject::IsRemovable
virtual bool IsRemovable() const
Definition: CommandObject.h:144
lldb_private::CommandObject::GetInvalidRegContextDescription
virtual const char * GetInvalidRegContextDescription()
Definition: CommandObject.h:327
lldb_private::CommandObject::ArgumentHelpCallback
Definition: CommandObject.h:71
lldb_private::CommandObject::IsPairType
bool IsPairType(ArgumentRepetitionType arg_repeat_type)
Definition: CommandObject.cpp:424
lldb_private::CommandObject::SetCommandName
void SetCommandName(llvm::StringRef name)
Definition: CommandObject.cpp:82
LLDB_OPT_SET_ALL
#define LLDB_OPT_SET_ALL
Definition: lldb-defines.h:112
lldb_private::CommandObject::GetArgumentName
static const char * GetArgumentName(lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:408
lldb_private::CommandObject::GetArgumentTable
static const ArgumentTableEntry * GetArgumentTable()
Definition: CommandObject.cpp:1130
lldb_private::StringList
Definition: StringList.h:25
lldb_private::CommandObject::CommandMap
std::map< std::string, lldb::CommandObjectSP > CommandMap
Definition: CommandObject.h:110
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:242
lldb_private::CommandObject::GetCommandName
llvm::StringRef GetCommandName() const
Definition: CommandObject.cpp:80
lldb_private::CommandObject::ArgumentTableEntry::arg_type
lldb::CommandArgumentType arg_type
Definition: CommandObject.h:82
lldb_private::CommandObject::GetOptions
virtual Options * GetOptions()
Definition: CommandObject.cpp:98
lldb_private::CommandObjectRaw::WantsRawCommandString
bool WantsRawCommandString() override
Definition: CommandObject.h:410
lldb_private::CommandObject::ArgumentHelpCallbackFunction
llvm::StringRef() ArgumentHelpCallbackFunction()
Definition: CommandObject.h:69
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::CommandObject::m_interpreter
CommandInterpreter & m_interpreter
Definition: CommandObject.h:358
lldb_private::CommandObject::GetDefaultThread
Thread * GetDefaultThread()
Definition: CommandObject.cpp:951
lldb_private::CommandObject::GetFlags
const Flags & GetFlags() const
The flags const accessor.
Definition: CommandObject.h:261
lldb_private::CommandObject::CommandArgumentData::arg_type
lldb::CommandArgumentType arg_type
Definition: CommandObject.h:91
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:942
lldb_private::CommandObject::GetInvalidProcessDescription
virtual const char * GetInvalidProcessDescription()
Definition: CommandObject.h:319
lldb_private::CommandObjectRaw
Definition: CommandObject.h:395
lldb-private.h
lldb_private::CommandObject
Definition: CommandObject.h:67
lldb_private::CommandObject::IsAlias
virtual bool IsAlias()
Definition: CommandObject.h:150
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:284
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:539
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:25
lldb_private::CommandObject::AddIDsArgumentData
static void AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange)
Definition: CommandObject.cpp:897
uint32_t
lldb_private::CommandObject::GetFlags
Flags & GetFlags()
The flags accessor.
Definition: CommandObject.h:255
lldb_private::CommandObject::m_cmd_name
std::string m_cmd_name
Definition: CommandObject.h:361
lldb_private::CommandObject::IsMultiwordObject
virtual bool IsMultiwordObject()
Definition: CommandObject.h:146
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:273
lldb_private::CommandObject::GetSubcommandSP
virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches=nullptr)
Definition: CommandObject.h:157
lldb_private::CommandObject::m_api_locker
std::unique_lock< std::recursive_mutex > m_api_locker
Definition: CommandObject.h:360
lldb_private::CommandObject::SetSyntax
void SetSyntax(llvm::StringRef str)
Definition: CommandObject.cpp:94
lldb_private::CommandObject::FindArgumentDataByType
static const ArgumentTableEntry * FindArgumentDataByType(lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:367
lldb_private::CommandObject::ArgumentTableEntry
Definition: CommandObject.h:80
lldb_private::CommandObject::GetArgumentEntryAtIndex
CommandArgumentEntry * GetArgumentEntryAtIndex(int idx)
Definition: CommandObject.cpp:359
lldb_private::CommandObject::AproposAllSubCommands
virtual void AproposAllSubCommands(llvm::StringRef prefix, llvm::StringRef search_word, StringList &commands_found, StringList &commands_help)
Definition: CommandObject.h:167
lldb_private::CommandObject::GetCommandInterpreter
CommandInterpreter & GetCommandInterpreter()
Definition: CommandObject.h:124
lldb_private::CommandObject::m_cmd_help_long
std::string m_cmd_help_long
Definition: CommandObject.h:363
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:972
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:323
lldb_private::CommandObject::WantsCompletion
virtual bool WantsCompletion()
Definition: CommandObject.h:191
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:97
lldb_private::CommandObject::GetArgumentDescriptionAsCString
static const char * GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:927
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:367
lldb_private::CommandObject::CommandArgumentEntry
std::vector< CommandArgumentData > CommandArgumentEntry
Definition: CommandObject.h:105
lldb_private::CommandObject::Cleanup
void Cleanup()
Definition: CommandObject.cpp:267
lldb_private::CommandObject::GetArgumentTypeAsCString
static const char * GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type)
Definition: CommandObject.cpp:920
lldb_private::CommandObject::InvokeOverrideCallback
bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result)
Definition: CommandObject.h:296
lldb_private::CommandObject::m_command_override_callback
lldb::CommandOverrideCallbackWithResult m_command_override_callback
Definition: CommandObject.h:368
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:364
lldb_private::CommandObjectParsed::~CommandObjectParsed
~CommandObjectParsed() override=default
lldb_private::CommandObject::GetHelp
virtual llvm::StringRef GetHelp()
Definition: CommandObject.cpp:53
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::CommandObject::GetDebugger
Debugger & GetDebugger()
Definition: CommandObject.cpp:51
lldb_private::CommandObject::m_flags
Flags m_flags
Definition: CommandObject.h:365
lldb_private::CommandObject::GenerateHelpText
void GenerateHelpText(CommandReturnObject &result)
Definition: CommandObject.cpp:846