LLDB  mainline
CommandObjectMultiword.cpp
Go to the documentation of this file.
1 //===-- CommandObjectMultiword.cpp ----------------------------------------===//
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 
13 
14 using namespace lldb;
15 using namespace lldb_private;
16 
17 // CommandObjectMultiword
18 
19 CommandObjectMultiword::CommandObjectMultiword(CommandInterpreter &interpreter,
20  const char *name,
21  const char *help,
22  const char *syntax,
23  uint32_t flags)
24  : CommandObject(interpreter, name, help, syntax, flags),
25  m_can_be_removed(false) {}
26 
28 
29 CommandObjectSP
31  if (m_subcommand_dict.empty())
32  return {};
33 
34  auto pos = m_subcommand_dict.find(std::string(sub_cmd));
35  if (pos == m_subcommand_dict.end())
36  return {};
37 
38  return pos->second;
39 }
40 
41 CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd,
42  StringList *matches) {
43  if (m_subcommand_dict.empty())
44  return {};
45 
46  CommandObjectSP return_cmd_sp = GetSubcommandSPExact(sub_cmd);
47  if (return_cmd_sp) {
48  if (matches)
49  matches->AppendString(sub_cmd);
50  return return_cmd_sp;
51  }
52 
53  CommandObject::CommandMap::iterator pos;
54 
55  StringList local_matches;
56  if (matches == nullptr)
57  matches = &local_matches;
58  int num_matches =
60 
61  if (num_matches == 1) {
62  // Cleaner, but slightly less efficient would be to call back into this
63  // function, since I now know I have an exact match...
64 
65  sub_cmd = matches->GetStringAtIndex(0);
66  pos = m_subcommand_dict.find(std::string(sub_cmd));
67  if (pos != m_subcommand_dict.end())
68  return_cmd_sp = pos->second;
69  }
70 
71  return return_cmd_sp;
72 }
73 
76  StringList *matches) {
77  return GetSubcommandSP(sub_cmd, matches).get();
78 }
79 
80 bool CommandObjectMultiword::LoadSubCommand(llvm::StringRef name,
81  const CommandObjectSP &cmd_obj_sp) {
82  if (cmd_obj_sp)
83  lldbassert((&GetCommandInterpreter() == &cmd_obj_sp->GetCommandInterpreter()) &&
84  "tried to add a CommandObject from a different interpreter");
85 
86  CommandMap::iterator pos;
87  bool success = true;
88 
89  pos = m_subcommand_dict.find(std::string(name));
90  if (pos == m_subcommand_dict.end()) {
91  m_subcommand_dict[std::string(name)] = cmd_obj_sp;
92  } else
93  success = false;
94 
95  return success;
96 }
97 
99  llvm::StringRef name, const CommandObjectSP &cmd_obj_sp, bool can_replace) {
100  Status result;
101  if (cmd_obj_sp)
102  lldbassert((&GetCommandInterpreter() == &cmd_obj_sp->GetCommandInterpreter()) &&
103  "tried to add a CommandObject from a different interpreter");
104  if (!IsUserCommand()) {
105  return llvm::createStringError(llvm::inconvertibleErrorCode(),
106  "can't add a user subcommand to a builtin container command.");
107  }
108  // Make sure this a user command if it isn't already:
109  cmd_obj_sp->SetIsUserCommand(true);
110 
111  std::string str_name(name);
112 
113  auto pos = m_subcommand_dict.find(str_name);
114  if (pos == m_subcommand_dict.end()) {
115  m_subcommand_dict[str_name] = cmd_obj_sp;
116  return llvm::Error::success();
117  }
118 
119  const char *error_str = nullptr;
120  if (!can_replace)
121  error_str = "sub-command already exists";
122  if (!(*pos).second->IsUserCommand())
123  error_str = "can't replace a builtin subcommand";
124 
125  if (error_str) {
126  return llvm::createStringError(llvm::inconvertibleErrorCode(), error_str);
127  }
128  m_subcommand_dict[str_name] = cmd_obj_sp;
129  return llvm::Error::success();
130 }
131 
133  bool must_be_multiword) {
134  CommandMap::iterator pos;
135  std::string str_name(cmd_name);
136 
137  pos = m_subcommand_dict.find(str_name);
138  if (pos == m_subcommand_dict.end()) {
139  return llvm::createStringError(llvm::inconvertibleErrorCode(),"subcommand '%s' not found.",
140  str_name.c_str());
141  }
142  if (!(*pos).second->IsUserCommand()) {
143  return llvm::createStringError(llvm::inconvertibleErrorCode(),"subcommand '%s' not a user command.",
144  str_name.c_str());
145  }
146 
147  if (must_be_multiword && !(*pos).second->IsMultiwordObject()) {
148  return llvm::createStringError(llvm::inconvertibleErrorCode(),"subcommand '%s' is not a container command",
149  str_name.c_str());
150  }
151  if (!must_be_multiword && (*pos).second->IsMultiwordObject()) {
152  return llvm::createStringError(llvm::inconvertibleErrorCode(),"subcommand '%s' is not a user command",
153  str_name.c_str());
154  }
155 
156  m_subcommand_dict.erase(pos);
157 
158  return llvm::Error::success();
159 }
160 
161 bool CommandObjectMultiword::Execute(const char *args_string,
162  CommandReturnObject &result) {
163  Args args(args_string);
164  const size_t argc = args.GetArgumentCount();
165  if (argc == 0) {
166  this->CommandObject::GenerateHelpText(result);
167  return result.Succeeded();
168  }
169 
170  auto sub_command = args[0].ref();
171  if (sub_command.empty()) {
172  result.AppendError("Need to specify a non-empty subcommand.");
173  return result.Succeeded();
174  }
175 
176  if (sub_command.equals_insensitive("help")) {
177  this->CommandObject::GenerateHelpText(result);
178  return result.Succeeded();
179  }
180 
181  if (m_subcommand_dict.empty()) {
182  result.AppendErrorWithFormat("'%s' does not have any subcommands.\n",
183  GetCommandName().str().c_str());
184  return false;
185  }
186 
187  StringList matches;
188  CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches);
189  if (sub_cmd_obj != nullptr) {
190  // Now call CommandObject::Execute to process options in `rest_of_line`.
191  // From there the command-specific version of Execute will be called, with
192  // the processed arguments.
193 
194  args.Shift();
195  sub_cmd_obj->Execute(args_string, result);
196  return result.Succeeded();
197  }
198 
199  std::string error_msg;
200  const size_t num_subcmd_matches = matches.GetSize();
201  if (num_subcmd_matches > 0)
202  error_msg.assign("ambiguous command ");
203  else
204  error_msg.assign("invalid command ");
205 
206  error_msg.append("'");
207  error_msg.append(std::string(GetCommandName()));
208  error_msg.append(" ");
209  error_msg.append(std::string(sub_command));
210  error_msg.append("'.");
211 
212  if (num_subcmd_matches > 0) {
213  error_msg.append(" Possible completions:");
214  for (const std::string &match : matches) {
215  error_msg.append("\n\t");
216  error_msg.append(match);
217  }
218  }
219  error_msg.append("\n");
220  result.AppendRawError(error_msg.c_str());
221  return false;
222 }
223 
225  // First time through here, generate the help text for the object and push it
226  // to the return result object as well
227 
228  CommandObject::GenerateHelpText(output_stream);
229  output_stream.PutCString("\nThe following subcommands are supported:\n\n");
230 
231  CommandMap::iterator pos;
233 
234  if (max_len)
235  max_len += 4; // Indent the output by 4 spaces.
236 
237  for (pos = m_subcommand_dict.begin(); pos != m_subcommand_dict.end(); ++pos) {
238  std::string indented_command(" ");
239  indented_command.append(pos->first);
240  if (pos->second->WantsRawCommandString()) {
241  std::string help_text(std::string(pos->second->GetHelp()));
242  help_text.append(" Expects 'raw' input (see 'help raw-input'.)");
243  m_interpreter.OutputFormattedHelpText(output_stream, indented_command,
244  "--", help_text, max_len);
245  } else
246  m_interpreter.OutputFormattedHelpText(output_stream, indented_command,
247  "--", pos->second->GetHelp(),
248  max_len);
249  }
250 
251  output_stream.PutCString("\nFor more help on any particular subcommand, type "
252  "'help <command> <subcommand>'.\n");
253 }
254 
256  auto arg0 = request.GetParsedLine()[0].ref();
257  if (request.GetCursorIndex() == 0) {
258  StringList new_matches, descriptions;
260  &descriptions);
261  request.AddCompletions(new_matches, descriptions);
262 
263  if (new_matches.GetSize() == 1 &&
264  new_matches.GetStringAtIndex(0) != nullptr &&
265  (arg0 == new_matches.GetStringAtIndex(0))) {
266  StringList temp_matches;
267  CommandObject *cmd_obj = GetSubcommandObject(arg0, &temp_matches);
268  if (cmd_obj != nullptr) {
269  if (request.GetParsedLine().GetArgumentCount() != 1) {
270  request.GetParsedLine().Shift();
271  request.AppendEmptyArgument();
272  cmd_obj->HandleCompletion(request);
273  }
274  }
275  }
276  return;
277  }
278 
279  StringList new_matches;
280  CommandObject *sub_command_object = GetSubcommandObject(arg0, &new_matches);
281  if (sub_command_object == nullptr) {
282  request.AddCompletions(new_matches);
283  return;
284  }
285 
286  // Remove the one match that we got from calling GetSubcommandObject.
287  new_matches.DeleteStringAtIndex(0);
288  request.AddCompletions(new_matches);
289  request.ShiftArguments();
290  sub_command_object->HandleCompletion(request);
291 }
292 
293 const char *CommandObjectMultiword::GetRepeatCommand(Args &current_command_args,
294  uint32_t index) {
295  index++;
296  if (current_command_args.GetArgumentCount() <= index)
297  return nullptr;
298  CommandObject *sub_command_object =
299  GetSubcommandObject(current_command_args[index].ref());
300  if (sub_command_object == nullptr)
301  return nullptr;
302  return sub_command_object->GetRepeatCommand(current_command_args, index);
303 }
304 
306  const char *name, const char *help,
307  const char *syntax, uint32_t flags)
308  : CommandObject(interpreter, name, help, syntax, flags) {}
309 
311 
313  CommandObject *proxy_command = GetProxyCommandObject();
314  if (proxy_command)
315  return proxy_command->GetOptions();
316  return CommandObject::GetOptions();
317 }
318 
319 llvm::StringRef CommandObjectProxy::GetHelp() {
320  CommandObject *proxy_command = GetProxyCommandObject();
321  if (proxy_command)
322  return proxy_command->GetHelp();
323  return CommandObject::GetHelp();
324 }
325 
326 llvm::StringRef CommandObjectProxy::GetSyntax() {
327  CommandObject *proxy_command = GetProxyCommandObject();
328  if (proxy_command)
329  return proxy_command->GetSyntax();
330  return CommandObject::GetSyntax();
331 }
332 
334  CommandObject *proxy_command = GetProxyCommandObject();
335  if (proxy_command)
336  return proxy_command->GetHelpLong();
338 }
339 
341  const CommandObject *proxy_command =
342  const_cast<CommandObjectProxy *>(this)->GetProxyCommandObject();
343  if (proxy_command)
344  return proxy_command->IsRemovable();
345  return false;
346 }
347 
349  CommandObject *proxy_command = GetProxyCommandObject();
350  if (proxy_command)
351  return proxy_command->IsMultiwordObject();
352  return false;
353 }
354 
356  CommandObject *proxy_command = GetProxyCommandObject();
357  if (proxy_command)
358  return proxy_command->GetAsMultiwordCommand();
359  return nullptr;
360 }
361 
363  CommandObject *proxy_command = GetProxyCommandObject();
364  if (proxy_command)
365  proxy_command->GenerateHelpText(result);
366  else
368 }
369 
370 lldb::CommandObjectSP
371 CommandObjectProxy::GetSubcommandSP(llvm::StringRef sub_cmd,
372  StringList *matches) {
373  CommandObject *proxy_command = GetProxyCommandObject();
374  if (proxy_command)
375  return proxy_command->GetSubcommandSP(sub_cmd, matches);
376  return lldb::CommandObjectSP();
377 }
378 
380  StringList *matches) {
381  CommandObject *proxy_command = GetProxyCommandObject();
382  if (proxy_command)
383  return proxy_command->GetSubcommandObject(sub_cmd, matches);
384  return nullptr;
385 }
386 
388  llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_sp) {
389  CommandObject *proxy_command = GetProxyCommandObject();
390  if (proxy_command)
391  return proxy_command->LoadSubCommand(cmd_name, command_sp);
392  return false;
393 }
394 
396  CommandObject *proxy_command = GetProxyCommandObject();
397  if (proxy_command)
398  return proxy_command->WantsRawCommandString();
399  return false;
400 }
401 
403  CommandObject *proxy_command = GetProxyCommandObject();
404  if (proxy_command)
405  return proxy_command->WantsCompletion();
406  return false;
407 }
408 
410  CommandObject *proxy_command = GetProxyCommandObject();
411  if (proxy_command)
412  proxy_command->HandleCompletion(request);
413 }
414 
416  CompletionRequest &request, OptionElementVector &opt_element_vector) {
417  CommandObject *proxy_command = GetProxyCommandObject();
418  if (proxy_command)
419  proxy_command->HandleArgumentCompletion(request, opt_element_vector);
420 }
421 
422 const char *CommandObjectProxy::GetRepeatCommand(Args &current_command_args,
423  uint32_t index) {
424  CommandObject *proxy_command = GetProxyCommandObject();
425  if (proxy_command)
426  return proxy_command->GetRepeatCommand(current_command_args, index);
427  return nullptr;
428 }
429 
431  return "command is not implemented";
432 }
433 
434 bool CommandObjectProxy::Execute(const char *args_string,
435  CommandReturnObject &result) {
436  CommandObject *proxy_command = GetProxyCommandObject();
437  if (proxy_command)
438  return proxy_command->Execute(args_string, result);
440  return false;
441 }
lldb_private::CommandObjectProxy::IsMultiwordObject
bool IsMultiwordObject() override
Definition: CommandObjectMultiword.cpp:348
lldb_private::CommandObjectMultiword::m_subcommand_dict
CommandObject::CommandMap m_subcommand_dict
Definition: CommandObjectMultiword.h:72
lldb_private::CommandObjectProxy::HandleArgumentCompletion
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
Definition: CommandObjectMultiword.cpp:415
lldb_private::CommandObjectProxy::GetOptions
Options * GetOptions() override
Definition: CommandObjectMultiword.cpp:312
lldb_private::CommandObject::Execute
virtual bool Execute(const char *args_string, CommandReturnObject &result)=0
lldb_private::CommandObjectProxy::WantsRawCommandString
bool WantsRawCommandString() override
Definition: CommandObjectMultiword.cpp:395
lldb_private::CommandObjectProxy::GetHelpLong
llvm::StringRef GetHelpLong() override
Definition: CommandObjectMultiword.cpp:333
lldb_private::CompletionRequest::GetParsedLine
const Args & GetParsedLine() const
Definition: CompletionRequest.h:134
lldb_private::CommandObject::GetHelpLong
virtual llvm::StringRef GetHelpLong()
Definition: CommandObject.cpp:55
lldb_private::Args::Shift
void Shift()
Shifts the first argument C string value of the array off the argument array.
Definition: Args.cpp:281
lldb_private::CommandObjectProxy::~CommandObjectProxy
~CommandObjectProxy() override
lldb_private::CommandObjectProxy::GetHelp
llvm::StringRef GetHelp() override
Definition: CommandObjectMultiword.cpp:319
lldb_private::StringList::AppendString
void AppendString(const std::string &s)
Definition: StringList.cpp:43
lldb_private::CommandReturnObject::AppendRawError
void AppendRawError(llvm::StringRef in_string)
Definition: CommandReturnObject.cpp:115
lldb_private::CommandObject::LoadSubCommand
virtual bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj)
Definition: CommandObject.h:184
lldb_private::CommandObject::GetSubcommandObject
virtual CommandObject * GetSubcommandObject(llvm::StringRef sub_cmd, StringList *matches=nullptr)
Definition: CommandObject.h:170
lldb_private::Stream
Definition: Stream.h:28
lldb_private::CompletionRequest::AppendEmptyArgument
void AppendEmptyArgument()
Adds an empty argument at the end of the argument list and moves the cursor to this new argument.
Definition: CompletionRequest.h:150
lldb_private::Args
Definition: Args.h:33
lldb_private::CommandReturnObject::Succeeded
bool Succeeded() const
Definition: CommandReturnObject.cpp:125
lldb_private::CommandObjectMultiword::GetSubcommandSP
lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches=nullptr) override
Definition: CommandObjectMultiword.cpp:41
lldb_private::CommandObjectProxy::CommandObjectProxy
CommandObjectProxy(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
Definition: CommandObjectMultiword.cpp:305
CommandReturnObject.h
lldb_private::StringList::GetSize
size_t GetSize() const
Definition: StringList.cpp:74
lldb_private::CommandObject::IsUserCommand
bool IsUserCommand()
Definition: CommandObject.h:148
lldb_private::CommandObjectMultiword
Definition: CommandObjectMultiword.h:19
Options.h
lldb_private::CommandObject::GetAsMultiwordCommand
virtual CommandObjectMultiword * GetAsMultiwordCommand()
Definition: CommandObject.h:152
lldb_private::Options
Definition: Options.h:57
lldb_private::StringList::GetStringAtIndex
const char * GetStringAtIndex(size_t idx) const
Definition: StringList.cpp:86
lldb_private::CommandObjectProxy::GetSyntax
llvm::StringRef GetSyntax() override
Definition: CommandObjectMultiword.cpp:326
lldb_private::CommandObjectMultiword::LoadUserSubcommand
llvm::Error LoadUserSubcommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj, bool can_replace) override
Definition: CommandObjectMultiword.cpp:98
lldb_private::CommandObject::GetSyntax
virtual llvm::StringRef GetSyntax()
Definition: CommandObject.cpp:57
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::CommandObjectMultiword::LoadSubCommand
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
Definition: CommandObjectMultiword.cpp:80
lldb_private::CommandObject::IsRemovable
virtual bool IsRemovable() const
Definition: CommandObject.h:144
lldb_private::CommandObjectProxy::GetUnsupportedError
virtual llvm::StringRef GetUnsupportedError()
Definition: CommandObjectMultiword.cpp:430
lldb_private::CommandObjectProxy::Execute
bool Execute(const char *args_string, CommandReturnObject &result) override
Definition: CommandObjectMultiword.cpp:434
lldb_private::CommandObjectProxy::LoadSubCommand
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
Definition: CommandObjectMultiword.cpp:387
lldb_private::CommandObjectProxy::GetSubcommandSP
lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches=nullptr) override
Definition: CommandObjectMultiword.cpp:371
lldb_private::StringList
Definition: StringList.h:26
lldb_private::CommandObjectMultiword::HandleCompletion
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
Definition: CommandObjectMultiword.cpp:255
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::GetOptions
virtual Options * GetOptions()
Definition: CommandObject.cpp:98
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
CommandObjectMultiword.h
lldb_private::CommandObject::m_interpreter
CommandInterpreter & m_interpreter
Definition: CommandObject.h:368
lldb_private::OptionElementVector
std::vector< OptionArgElement > OptionElementVector
Definition: Options.h:42
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::CompletionRequest::AddCompletions
void AddCompletions(const StringList &completions)
Adds multiple possible completion strings.
Definition: CompletionRequest.h:196
lldb_private::CommandObjectProxy::GetRepeatCommand
const char * GetRepeatCommand(Args &current_command_args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
Definition: CommandObjectMultiword.cpp:422
lldb_private::CommandObjectProxy::GetProxyCommandObject
virtual CommandObject * GetProxyCommandObject()=0
lldb_private::CommandObjectMultiword::GenerateHelpText
void GenerateHelpText(Stream &output_stream) override
Definition: CommandObjectMultiword.cpp:224
lldb_private::CommandObjectProxy::WantsCompletion
bool WantsCompletion() override
Definition: CommandObjectMultiword.cpp:402
lldb_private::CommandObject
Definition: CommandObject.h:67
lldbassert
#define lldbassert(x)
Definition: LLDBAssert.h:15
lldb_private::CommandObjectProxy
Definition: CommandObjectMultiword.h:76
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::Status
Definition: Status.h:44
lldb_private::CommandObjectMultiword::GetSubcommandSPExact
lldb::CommandObjectSP GetSubcommandSPExact(llvm::StringRef sub_cmd) override
Definition: CommandObjectMultiword.cpp:30
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:25
uint32_t
lldb_private::CommandObject::IsMultiwordObject
virtual bool IsMultiwordObject()
Definition: CommandObject.h:146
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::CommandObjectMultiword::GetRepeatCommand
const char * GetRepeatCommand(Args &current_command_args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
Definition: CommandObjectMultiword.cpp:293
lldb_private::CommandObjectMultiword::GetSubcommandObject
CommandObject * GetSubcommandObject(llvm::StringRef sub_cmd, StringList *matches=nullptr) override
Definition: CommandObjectMultiword.cpp:75
lldb_private::CommandObjectProxy::IsRemovable
bool IsRemovable() const override
Definition: CommandObjectMultiword.cpp:340
lldb_private::CommandObjectMultiword::~CommandObjectMultiword
~CommandObjectMultiword() override
lldb_private::CommandObject::GetSubcommandSP
virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches=nullptr)
Definition: CommandObject.h:161
lldb_private::CompletionRequest::ShiftArguments
void ShiftArguments()
Drops the first argument from the argument list.
Definition: CompletionRequest.h:143
lldb_private::StringList::DeleteStringAtIndex
void DeleteStringAtIndex(size_t id)
Definition: StringList.cpp:147
lldb_private::CommandObject::GetCommandInterpreter
CommandInterpreter & GetCommandInterpreter()
Definition: CommandObject.h:124
lldb_private::CommandReturnObject::AppendErrorWithFormat
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
Definition: CommandReturnObject.cpp:46
lldb_private::CompletionRequest::GetCursorIndex
size_t GetCursorIndex() const
Definition: CompletionRequest.h:156
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::CommandObjectProxy::GetSubcommandObject
CommandObject * GetSubcommandObject(llvm::StringRef sub_cmd, StringList *matches=nullptr) override
Definition: CommandObjectMultiword.cpp:379
lldb_private::CommandObjectMultiword::RemoveUserSubcommand
llvm::Error RemoveUserSubcommand(llvm::StringRef cmd_name, bool multiword_okay)
Definition: CommandObjectMultiword.cpp:132
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
lldb_private::CommandObject::WantsCompletion
virtual bool WantsCompletion()
Definition: CommandObject.h:201
CommandInterpreter.h
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::CommandInterpreter::OutputFormattedHelpText
void OutputFormattedHelpText(Stream &strm, llvm::StringRef prefix, llvm::StringRef help_text)
lldb_private::CommandObjectProxy::GetAsMultiwordCommand
CommandObjectMultiword * GetAsMultiwordCommand() override
Definition: CommandObjectMultiword.cpp:355
lldb_private::CommandReturnObject::AppendError
void void AppendError(llvm::StringRef in_string)
Definition: CommandReturnObject.cpp:100
lldb_private::Args::GetArgumentCount
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
Definition: Args.h:118
lldb
Definition: SBAddress.h:15
lldb_private::CommandObjectProxy::HandleCompletion
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
Definition: CommandObjectMultiword.cpp:409
lldb_private::CommandObjectProxy::GenerateHelpText
void GenerateHelpText(Stream &result) override
Definition: CommandObjectMultiword.cpp:362
lldb_private::CommandObject::WantsRawCommandString
virtual bool WantsRawCommandString()=0
lldb_private::CommandObject::GetHelp
virtual llvm::StringRef GetHelp()
Definition: CommandObject.cpp:53
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::CommandObjectMultiword::Execute
bool Execute(const char *args_string, CommandReturnObject &result) override
Definition: CommandObjectMultiword.cpp:161
lldb_private::CommandObject::GenerateHelpText
void GenerateHelpText(CommandReturnObject &result)
Definition: CommandObject.cpp:849