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  bool IsUserCommand() { return m_is_user_command; }
149 
150  void SetIsUserCommand(bool is_user) { m_is_user_command = is_user; }
151 
152  virtual CommandObjectMultiword *GetAsMultiwordCommand() { return nullptr; }
153 
154  virtual bool IsAlias() { return false; }
155 
156  // override this to return true if your command is somehow a "dash-dash" form
157  // of some other command (e.g. po is expr -O --); this is a powerful hint to
158  // the help system that one cannot pass options to this command
159  virtual bool IsDashDashCommand() { return false; }
160 
161  virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
162  StringList *matches = nullptr) {
163  return lldb::CommandObjectSP();
164  }
165 
166  virtual lldb::CommandObjectSP GetSubcommandSPExact(llvm::StringRef sub_cmd) {
167  return lldb::CommandObjectSP();
168  }
169 
170  virtual CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
171  StringList *matches = nullptr) {
172  return nullptr;
173  }
174 
175  void FormatLongHelpText(Stream &output_strm, llvm::StringRef long_help);
176 
178 
179  virtual void GenerateHelpText(Stream &result);
180 
181  // this is needed in order to allow the SBCommand class to transparently try
182  // and load subcommands - it will fail on anything but a multiword command,
183  // but it avoids us doing type checkings and casts
184  virtual bool LoadSubCommand(llvm::StringRef cmd_name,
185  const lldb::CommandObjectSP &command_obj) {
186  return false;
187  }
188 
189  virtual llvm::Error LoadUserSubcommand(llvm::StringRef cmd_name,
190  const lldb::CommandObjectSP &command_obj,
191  bool can_replace) {
192  return llvm::createStringError(llvm::inconvertibleErrorCode(),
193  "can only add commands to container commands");
194  }
195 
196  virtual bool WantsRawCommandString() = 0;
197 
198  // By default, WantsCompletion = !WantsRawCommandString. Subclasses who want
199  // raw command string but desire, for example, argument completion should
200  // override this method to return true.
201  virtual bool WantsCompletion() { return !WantsRawCommandString(); }
202 
203  virtual Options *GetOptions();
204 
205  static const ArgumentTableEntry *GetArgumentTable();
206 
207  static lldb::CommandArgumentType LookupArgumentName(llvm::StringRef arg_name);
208 
209  static const ArgumentTableEntry *
211 
212  int GetNumArgumentEntries();
213 
215 
216  static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type,
217  CommandInterpreter &interpreter);
218 
219  static const char *GetArgumentName(lldb::CommandArgumentType arg_type);
220 
221  // Generates a nicely formatted command args string for help command output.
222  // By default, all possible args are taken into account, for example, '<expr
223  // | variable-name>'. This can be refined by passing a second arg specifying
224  // which option set(s) we are interested, which could then, for example,
225  // produce either '<expr>' or '<variable-name>'.
227  uint32_t opt_set_mask = LLDB_OPT_SET_ALL);
228 
229  bool IsPairType(ArgumentRepetitionType arg_repeat_type);
230 
231  bool ParseOptions(Args &args, CommandReturnObject &result);
232 
233  void SetCommandName(llvm::StringRef name);
234 
235  /// This default version handles calling option argument completions and then
236  /// calls HandleArgumentCompletion if the cursor is on an argument, not an
237  /// option. Don't override this method, override HandleArgumentCompletion
238  /// instead unless you have special reasons.
239  ///
240  /// \param[in,out] request
241  /// The completion request that needs to be answered.
242  virtual void HandleCompletion(CompletionRequest &request);
243 
244  /// The input array contains a parsed version of the line.
245  ///
246  /// We've constructed the map of options and their arguments as well if that
247  /// is helpful for the completion.
248  ///
249  /// \param[in,out] request
250  /// The completion request that needs to be answered.
251  virtual void
253  OptionElementVector &opt_element_vector) {}
254 
255  bool HelpTextContainsWord(llvm::StringRef search_word,
256  bool search_short_help = true,
257  bool search_long_help = true,
258  bool search_syntax = true,
259  bool search_options = true);
260 
261  /// The flags accessor.
262  ///
263  /// \return
264  /// A reference to the Flags member variable.
265  Flags &GetFlags() { return m_flags; }
266 
267  /// The flags const accessor.
268  ///
269  /// \return
270  /// A const reference to the Flags member variable.
271  const Flags &GetFlags() const { return m_flags; }
272 
273  /// Get the command that appropriate for a "repeat" of the current command.
274  ///
275  /// \param[in] current_command_args
276  /// The command arguments.
277  ///
278  /// \return
279  /// nullptr if there is no special repeat command - it will use the
280  /// current command line.
281  /// Otherwise a pointer to the command to be repeated.
282  /// If the returned string is the empty string, the command won't be
283  /// repeated.
284  virtual const char *GetRepeatCommand(Args &current_command_args,
285  uint32_t index) {
286  return nullptr;
287  }
288 
289  bool HasOverrideCallback() const {
292  }
293 
295  void *baton) {
297  m_command_override_baton = baton;
298  }
299 
301  void *baton) {
302  m_command_override_callback = callback;
303  m_command_override_baton = baton;
304  }
305 
306  bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result) {
309  result);
312  argv);
313  else
314  return false;
315  }
316 
317  virtual bool Execute(const char *args_string,
318  CommandReturnObject &result) = 0;
319 
320 protected:
321  bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result,
322  OptionGroupOptions &group_options,
323  ExecutionContext &exe_ctx);
324 
325  virtual const char *GetInvalidTargetDescription() {
326  return "invalid target, create a target using the 'target create' command";
327  }
328 
329  virtual const char *GetInvalidProcessDescription() {
330  return "invalid process";
331  }
332 
333  virtual const char *GetInvalidThreadDescription() { return "invalid thread"; }
334 
335  virtual const char *GetInvalidFrameDescription() { return "invalid frame"; }
336 
337  virtual const char *GetInvalidRegContextDescription() {
338  return "invalid frame, no registers";
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:41
lldb_private::CommandObject::GetSelectedOrDummyTarget
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
Definition: CommandObject.cpp:941
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: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:937
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:1007
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:408
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:369
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:159
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:828
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:27
lldb_private::CommandObject::LoadSubCommand
virtual bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj)
Definition: CommandObject.h:184
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:170
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: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:452
CompletionRequest.h
lldb_private::CommandObject::GetSubcommandSPExact
virtual lldb::CommandObjectSP GetSubcommandSPExact(llvm::StringRef sub_cmd)
Definition: CommandObject.h:166
lldb_private::CommandObject::IsUserCommand
bool IsUserCommand()
Definition: CommandObject.h:148
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: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:289
lldb_private::CommandObjectMultiword
Definition: CommandObjectMultiword.h:19
Options.h
lldb_private::CommandObject::GetAsMultiwordCommand
virtual CommandObjectMultiword * GetAsMultiwordCommand()
Definition: CommandObject.h:152
lldb_private::CommandObject::GetInvalidTargetDescription
virtual const char * GetInvalidTargetDescription()
Definition: CommandObject.h:325
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:335
lldb_private::CommandObject::SetOverrideCallback
void SetOverrideCallback(lldb::CommandOverrideCallbackWithResult callback, void *baton)
Definition: CommandObject.h:300
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:391
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:284
lldb_private::Thread
Definition: Thread.h:60
lldb_private::CommandObject::IsRemovable
virtual bool IsRemovable() const
Definition: CommandObject.h:144
lldb_private::CommandObject::GetInvalidRegContextDescription
virtual const char * GetInvalidRegContextDescription()
Definition: CommandObject.h:337
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:1133
lldb_private::StringList
Definition: StringList.h:26
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:252
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: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:70
lldb_private::CommandObject::m_interpreter
CommandInterpreter & m_interpreter
Definition: CommandObject.h:368
lldb_private::CommandObject::GetDefaultThread
Thread * GetDefaultThread()
Definition: CommandObject.cpp:954
lldb_private::CommandObject::GetFlags
const Flags & GetFlags() const
The flags const accessor.
Definition: CommandObject.h:271
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:945
lldb_private::CommandObject::GetInvalidProcessDescription
virtual const char * GetInvalidProcessDescription()
Definition: CommandObject.h:329
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:154
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:294
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:542
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:900
uint32_t
lldb_private::CommandObject::GetFlags
Flags & GetFlags()
The flags accessor.
Definition: CommandObject.h:265
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: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:161
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: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::GetCommandInterpreter
CommandInterpreter & GetCommandInterpreter()
Definition: CommandObject.h:124
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:975
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
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:333
lldb_private::CommandObject::WantsCompletion
virtual bool WantsCompletion()
Definition: CommandObject.h:201
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:930
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:189
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:923
lldb_private::CommandObject::SetIsUserCommand
void SetIsUserCommand(bool is_user)
Definition: CommandObject.h:150
lldb_private::CommandObject::InvokeOverrideCallback
bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result)
Definition: CommandObject.h:306
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: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:375
lldb_private::CommandObject::GenerateHelpText
void GenerateHelpText(CommandReturnObject &result)
Definition: CommandObject.cpp:849