LLDB  mainline
SBCommandInterpreter.cpp
Go to the documentation of this file.
1 //===-- SBCommandInterpreter.cpp --------------------------------*- 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 #include "lldb/lldb-types.h"
10 
11 #include "SBReproducerPrivate.h"
15 #include "lldb/Target/Target.h"
16 #include "lldb/Utility/Listener.h"
17 
18 #include "lldb/API/SBBroadcaster.h"
21 #include "lldb/API/SBEvent.h"
23 #include "lldb/API/SBListener.h"
24 #include "lldb/API/SBProcess.h"
25 #include "lldb/API/SBStream.h"
26 #include "lldb/API/SBStringList.h"
27 #include "lldb/API/SBTarget.h"
28 
29 #include <memory>
30 
31 using namespace lldb;
32 using namespace lldb_private;
33 
36 
37  m_opaque_up.reset(new CommandInterpreterRunOptions());
38 }
39 
41 
44  GetStopOnContinue);
45 
46  return m_opaque_up->GetStopOnContinue();
47 }
48 
50  LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetStopOnContinue,
51  (bool), stop_on_continue);
52 
53  m_opaque_up->SetStopOnContinue(stop_on_continue);
54 }
55 
58  GetStopOnError);
59 
60  return m_opaque_up->GetStopOnError();
61 }
62 
65  (bool), stop_on_error);
66 
67  m_opaque_up->SetStopOnError(stop_on_error);
68 }
69 
72  GetStopOnCrash);
73 
74  return m_opaque_up->GetStopOnCrash();
75 }
76 
79  (bool), stop_on_crash);
80 
81  m_opaque_up->SetStopOnCrash(stop_on_crash);
82 }
83 
86  GetEchoCommands);
87 
88  return m_opaque_up->GetEchoCommands();
89 }
90 
93  (bool), echo_commands);
94 
95  m_opaque_up->SetEchoCommands(echo_commands);
96 }
97 
100  GetEchoCommentCommands);
101 
102  return m_opaque_up->GetEchoCommentCommands();
103 }
104 
107  SetEchoCommentCommands, (bool), echo);
108 
109  m_opaque_up->SetEchoCommentCommands(echo);
110 }
111 
114  GetPrintResults);
115 
116  return m_opaque_up->GetPrintResults();
117 }
118 
120  LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetPrintResults,
121  (bool), print_results);
122 
123  m_opaque_up->SetPrintResults(print_results);
124 }
125 
128  GetAddToHistory);
129 
130  return m_opaque_up->GetAddToHistory();
131 }
132 
134  LLDB_RECORD_METHOD(void, SBCommandInterpreterRunOptions, SetAddToHistory,
135  (bool), add_to_history);
136 
137  m_opaque_up->SetAddToHistory(add_to_history);
138 }
139 
141 SBCommandInterpreterRunOptions::get() const {
142  return m_opaque_up.get();
143 }
144 
146 SBCommandInterpreterRunOptions::ref() const {
147  return *m_opaque_up;
148 }
149 
151 public:
153  const char *name,
155  const char *help = nullptr,
156  const char *syntax = nullptr,
157  uint32_t flags = 0)
158  : CommandObjectParsed(interpreter, name, help, syntax, flags),
159  m_backend(backend) {}
160 
161  bool IsRemovable() const override { return true; }
162 
163 protected:
164  bool DoExecute(Args &command, CommandReturnObject &result) override {
165  SBCommandReturnObject sb_return(&result);
166  SBCommandInterpreter sb_interpreter(&m_interpreter);
167  SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
168  bool ret = m_backend->DoExecute(
169  debugger_sb, (char **)command.GetArgumentVector(), sb_return);
170  sb_return.Release();
171  return ret;
172  }
173  std::shared_ptr<lldb::SBCommandPluginInterface> m_backend;
174 };
175 
177  : m_opaque_ptr(interpreter) {
179  (lldb_private::CommandInterpreter *), interpreter);
180 
181 }
182 
184  : m_opaque_ptr(rhs.m_opaque_ptr) {
186  (const lldb::SBCommandInterpreter &), rhs);
187 }
188 
190 
196  rhs);
197 
198  m_opaque_ptr = rhs.m_opaque_ptr;
199  return LLDB_RECORD_RESULT(*this);
200 }
201 
204  return this->operator bool();
205 }
206 SBCommandInterpreter::operator bool() const {
208 
209  return m_opaque_ptr != nullptr;
210 }
211 
212 bool SBCommandInterpreter::CommandExists(const char *cmd) {
214  cmd);
215 
216  return (((cmd != nullptr) && IsValid()) ? m_opaque_ptr->CommandExists(cmd)
217  : false);
218 }
219 
220 bool SBCommandInterpreter::AliasExists(const char *cmd) {
221  LLDB_RECORD_METHOD(bool, SBCommandInterpreter, AliasExists, (const char *),
222  cmd);
223 
224  return (((cmd != nullptr) && IsValid()) ? m_opaque_ptr->AliasExists(cmd)
225  : false);
226 }
227 
230 
231  return (IsValid() ? m_opaque_ptr->IsActive() : false);
232 }
233 
236 
237  return (IsValid() ? m_opaque_ptr->WasInterrupted() : false);
238 }
239 
242  GetIOHandlerControlSequence, (char), ch);
243 
244  return (IsValid()
245  ? m_opaque_ptr->GetDebugger()
247  .GetCString()
248  : nullptr);
249 }
250 
252 SBCommandInterpreter::HandleCommand(const char *command_line,
253  SBCommandReturnObject &result,
254  bool add_to_history) {
256  (const char *, lldb::SBCommandReturnObject &, bool),
257  command_line, result, add_to_history);
258 
259  SBExecutionContext sb_exe_ctx;
260  return HandleCommand(command_line, sb_exe_ctx, result, add_to_history);
261 }
262 
264  const char *command_line, SBExecutionContext &override_context,
265  SBCommandReturnObject &result, bool add_to_history) {
267  (const char *, lldb::SBExecutionContext &,
269  command_line, override_context, result, add_to_history);
270 
271 
272  ExecutionContext ctx, *ctx_ptr;
273  if (override_context.get()) {
274  ctx = override_context.get()->Lock(true);
275  ctx_ptr = &ctx;
276  } else
277  ctx_ptr = nullptr;
278 
279  result.Clear();
280  if (command_line && IsValid()) {
281  result.ref().SetInteractive(false);
282  m_opaque_ptr->HandleCommand(command_line,
283  add_to_history ? eLazyBoolYes : eLazyBoolNo,
284  result.ref(), ctx_ptr);
285  } else {
286  result->AppendError(
287  "SBCommandInterpreter or the command line is not valid");
289  }
290 
291 
292  return result.GetStatus();
293 }
294 
296  lldb::SBFileSpec &file, lldb::SBExecutionContext &override_context,
303  file, override_context, options, result);
304 
305  if (!IsValid()) {
306  result->AppendError("SBCommandInterpreter is not valid.");
308  return;
309  }
310 
311  if (!file.IsValid()) {
312  SBStream s;
313  file.GetDescription(s);
314  result->AppendErrorWithFormat("File is not valid: %s.", s.GetData());
316  }
317 
318  FileSpec tmp_spec = file.ref();
319  ExecutionContext ctx, *ctx_ptr;
320  if (override_context.get()) {
321  ctx = override_context.get()->Lock(true);
322  ctx_ptr = &ctx;
323  } else
324  ctx_ptr = nullptr;
325 
326  m_opaque_ptr->HandleCommandsFromFile(tmp_spec, ctx_ptr, options.ref(),
327  result.ref());
328 }
329 
331  const char *current_line, const char *cursor, const char *last_char,
332  int match_start_point, int max_return_elements, SBStringList &matches) {
334  (const char *, const char *, const char *, int, int,
336  current_line, cursor, last_char, match_start_point,
337  max_return_elements, matches);
338 
339  SBStringList dummy_descriptions;
341  current_line, cursor, last_char, match_start_point, max_return_elements,
342  matches, dummy_descriptions);
343 }
344 
346  const char *current_line, const char *cursor, const char *last_char,
347  int match_start_point, int max_return_elements, SBStringList &matches,
348  SBStringList &descriptions) {
351  (const char *, const char *, const char *, int, int,
353  current_line, cursor, last_char, match_start_point,
354  max_return_elements, matches, descriptions);
355 
356  int num_completions = 0;
357 
358  // Sanity check the arguments that are passed in: cursor & last_char have to
359  // be within the current_line.
360  if (current_line == nullptr || cursor == nullptr || last_char == nullptr)
361  return 0;
362 
363  if (cursor < current_line || last_char < current_line)
364  return 0;
365 
366  size_t current_line_size = strlen(current_line);
367  if (cursor - current_line > static_cast<ptrdiff_t>(current_line_size) ||
368  last_char - current_line > static_cast<ptrdiff_t>(current_line_size))
369  return 0;
370 
371 
372  if (IsValid()) {
373  lldb_private::StringList lldb_matches, lldb_descriptions;
374  num_completions = m_opaque_ptr->HandleCompletion(
375  current_line, cursor, last_char, match_start_point, max_return_elements,
376  lldb_matches, lldb_descriptions);
377 
378  SBStringList temp_matches_list(&lldb_matches);
379  matches.AppendList(temp_matches_list);
380  SBStringList temp_descriptions_list(&lldb_descriptions);
381  descriptions.AppendList(temp_descriptions_list);
382  }
383 
384  return num_completions;
385 }
386 
388  const char *current_line, uint32_t cursor_pos, int match_start_point,
389  int max_return_elements, SBStringList &matches,
390  SBStringList &descriptions) {
393  (const char *, uint32_t, int, int, lldb::SBStringList &,
395  current_line, cursor_pos, match_start_point,
396  max_return_elements, matches, descriptions);
397 
398  const char *cursor = current_line + cursor_pos;
399  const char *last_char = current_line + strlen(current_line);
401  current_line, cursor, last_char, match_start_point, max_return_elements,
402  matches, descriptions);
403 }
404 
405 int SBCommandInterpreter::HandleCompletion(const char *current_line,
406  uint32_t cursor_pos,
407  int match_start_point,
408  int max_return_elements,
409  lldb::SBStringList &matches) {
411  (const char *, uint32_t, int, int, lldb::SBStringList &),
412  current_line, cursor_pos, match_start_point,
413  max_return_elements, matches);
414 
415  const char *cursor = current_line + cursor_pos;
416  const char *last_char = current_line + strlen(current_line);
417  return HandleCompletion(current_line, cursor, last_char, match_start_point,
418  max_return_elements, matches);
419 }
420 
423 
424  return (IsValid() ? m_opaque_ptr->HasCommands() : false);
425 }
426 
429 
430  return (IsValid() ? m_opaque_ptr->HasAliases() : false);
431 }
432 
435 
436  return (IsValid() ? m_opaque_ptr->HasAliasOptions() : false);
437 }
438 
441 
442  SBProcess sb_process;
443  ProcessSP process_sp;
444  if (IsValid()) {
445  TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
446  if (target_sp) {
447  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
448  process_sp = target_sp->GetProcessSP();
449  sb_process.SetSP(process_sp);
450  }
451  }
452 
453  return LLDB_RECORD_RESULT(sb_process);
454 }
455 
458  GetDebugger);
459 
460  SBDebugger sb_debugger;
461  if (IsValid())
462  sb_debugger.reset(m_opaque_ptr->GetDebugger().shared_from_this());
463 
464  return LLDB_RECORD_RESULT(sb_debugger);
465 }
466 
469 
470  return (IsValid() ? m_opaque_ptr->GetPromptOnQuit() : false);
471 }
472 
475 
476  if (IsValid())
477  m_opaque_ptr->SetPromptOnQuit(b);
478 }
479 
482  allow);
483 
484  if (m_opaque_ptr)
485  m_opaque_ptr->AllowExitCodeOnQuit(allow);
486 }
487 
490 
491  bool exited = false;
492  if (m_opaque_ptr)
493  m_opaque_ptr->GetQuitExitCode(exited);
494  return exited;
495 }
496 
499 
500  bool exited = false;
501  return (m_opaque_ptr ? m_opaque_ptr->GetQuitExitCode(exited) : 0);
502 }
503 
504 void SBCommandInterpreter::ResolveCommand(const char *command_line,
505  SBCommandReturnObject &result) {
507  (const char *, lldb::SBCommandReturnObject &),
508  command_line, result);
509 
510  result.Clear();
511  if (command_line && IsValid()) {
512  m_opaque_ptr->ResolveCommand(command_line, result.ref());
513  } else {
514  result->AppendError(
515  "SBCommandInterpreter or the command line is not valid");
517  }
518 }
519 
521 
523  assert(m_opaque_ptr);
524  return *m_opaque_ptr;
525 }
526 
528  lldb_private::CommandInterpreter *interpreter) {
529  m_opaque_ptr = interpreter;
530 }
531 
533  SBCommandReturnObject &result) {
535  (lldb::SBCommandReturnObject &), result);
536 
537  result.Clear();
538  if (IsValid()) {
539  TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
540  std::unique_lock<std::recursive_mutex> lock;
541  if (target_sp)
542  lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
543  m_opaque_ptr->SourceInitFile(false, result.ref());
544  } else {
545  result->AppendError("SBCommandInterpreter is not valid");
547  }
548 }
549 
551  SBCommandReturnObject &result) {
554  (lldb::SBCommandReturnObject &), result);
555 
556  result.Clear();
557  if (IsValid()) {
558  TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
559  std::unique_lock<std::recursive_mutex> lock;
560  if (target_sp)
561  lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
562  m_opaque_ptr->SourceInitFile(true, result.ref());
563  } else {
564  result->AppendError("SBCommandInterpreter is not valid");
566  }
567 }
568 
572 
573 
574  SBBroadcaster broadcaster(m_opaque_ptr, false);
575 
576 
577  return LLDB_RECORD_RESULT(broadcaster);
578 }
579 
583 
584  return CommandInterpreter::GetStaticBroadcasterClass().AsCString();
585 }
586 
588  const lldb::CommandArgumentType arg_type) {
591  (const lldb::CommandArgumentType), arg_type);
592 
593  return CommandObject::GetArgumentTypeAsCString(arg_type);
594 }
595 
597  const lldb::CommandArgumentType arg_type) {
600  (const lldb::CommandArgumentType), arg_type);
601 
602  return CommandObject::GetArgumentDescriptionAsCString(arg_type);
603 }
604 
606  const lldb::SBEvent &event) {
609  (const lldb::SBEvent &), event);
610 
611  return event.GetBroadcasterClass() ==
613 }
614 
616  const char *command_name, lldb::CommandOverrideCallback callback,
617  void *baton) {
619  (const char *, lldb::CommandOverrideCallback, void *),
620  command_name, callback, baton);
621 
622  if (command_name && command_name[0] && IsValid()) {
623  llvm::StringRef command_name_str = command_name;
624  CommandObject *cmd_obj =
625  m_opaque_ptr->GetCommandObjectForCommand(command_name_str);
626  if (cmd_obj) {
627  assert(command_name_str.empty());
628  cmd_obj->SetOverrideCallback(callback, baton);
629  return true;
630  }
631  }
632  return false;
633 }
634 
636  const char *help) {
638  (const char *, const char *), name, help);
639 
640  CommandObjectMultiword *new_command =
641  new CommandObjectMultiword(*m_opaque_ptr, name, help);
642  new_command->SetRemovable(true);
643  lldb::CommandObjectSP new_command_sp(new_command);
644  if (new_command_sp &&
645  m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
646  return LLDB_RECORD_RESULT(lldb::SBCommand(new_command_sp));
648 }
649 
651  const char *name, lldb::SBCommandPluginInterface *impl, const char *help) {
654  (const char *, lldb::SBCommandPluginInterface *, const char *), name,
655  impl, help);
656 
657  lldb::CommandObjectSP new_command_sp;
658  new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
659  *m_opaque_ptr, name, impl, help);
660 
661  if (new_command_sp &&
662  m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
663  return LLDB_RECORD_RESULT(lldb::SBCommand(new_command_sp));
665 }
666 
670  const char *help, const char *syntax) {
672  (const char *, lldb::SBCommandPluginInterface *,
673  const char *, const char *),
674  name, impl, help, syntax);
675 
676  lldb::CommandObjectSP new_command_sp;
677  new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
678  *m_opaque_ptr, name, impl, help, syntax);
679 
680  if (new_command_sp &&
681  m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
682  return LLDB_RECORD_RESULT(lldb::SBCommand(new_command_sp));
684 }
685 
687 
688 SBCommand::SBCommand(lldb::CommandObjectSP cmd_sp) : m_opaque_sp(cmd_sp) {}
689 
692  return this->operator bool();
693 }
694 SBCommand::operator bool() const {
695  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommand, operator bool);
696 
697  return m_opaque_sp.get() != nullptr;
698 }
699 
700 const char *SBCommand::GetName() {
701  LLDB_RECORD_METHOD_NO_ARGS(const char *, SBCommand, GetName);
702 
703  return (IsValid() ? ConstString(m_opaque_sp->GetCommandName()).AsCString() : nullptr);
704 }
705 
706 const char *SBCommand::GetHelp() {
707  LLDB_RECORD_METHOD_NO_ARGS(const char *, SBCommand, GetHelp);
708 
709  return (IsValid() ? ConstString(m_opaque_sp->GetHelp()).AsCString()
710  : nullptr);
711 }
712 
713 const char *SBCommand::GetHelpLong() {
714  LLDB_RECORD_METHOD_NO_ARGS(const char *, SBCommand, GetHelpLong);
715 
716  return (IsValid() ? ConstString(m_opaque_sp->GetHelpLong()).AsCString()
717  : nullptr);
718 }
719 
720 void SBCommand::SetHelp(const char *help) {
721  LLDB_RECORD_METHOD(void, SBCommand, SetHelp, (const char *), help);
722 
723  if (IsValid())
724  m_opaque_sp->SetHelp(help);
725 }
726 
727 void SBCommand::SetHelpLong(const char *help) {
728  LLDB_RECORD_METHOD(void, SBCommand, SetHelpLong, (const char *), help);
729 
730  if (IsValid())
731  m_opaque_sp->SetHelpLong(help);
732 }
733 
735  const char *help) {
737  (const char *, const char *), name, help);
738 
739  if (!IsValid())
741  if (!m_opaque_sp->IsMultiwordObject())
744  m_opaque_sp->GetCommandInterpreter(), name, help);
745  new_command->SetRemovable(true);
746  lldb::CommandObjectSP new_command_sp(new_command);
747  if (new_command_sp && m_opaque_sp->LoadSubCommand(name, new_command_sp))
748  return LLDB_RECORD_RESULT(lldb::SBCommand(new_command_sp));
750 }
751 
754  const char *help) {
757  (const char *, lldb::SBCommandPluginInterface *, const char *), name,
758  impl, help);
759 
760  if (!IsValid())
762  if (!m_opaque_sp->IsMultiwordObject())
764  lldb::CommandObjectSP new_command_sp;
765  new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
766  m_opaque_sp->GetCommandInterpreter(), name, impl, help);
767  if (new_command_sp && m_opaque_sp->LoadSubCommand(name, new_command_sp))
768  return LLDB_RECORD_RESULT(lldb::SBCommand(new_command_sp));
770 }
771 
774  const char *help, const char *syntax) {
776  (const char *, lldb::SBCommandPluginInterface *,
777  const char *, const char *),
778  name, impl, help, syntax);
779 
780  if (!IsValid())
782  if (!m_opaque_sp->IsMultiwordObject())
784  lldb::CommandObjectSP new_command_sp;
785  new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
786  m_opaque_sp->GetCommandInterpreter(), name, impl, help, syntax);
787  if (new_command_sp && m_opaque_sp->LoadSubCommand(name, new_command_sp))
788  return LLDB_RECORD_RESULT(lldb::SBCommand(new_command_sp));
790 }
791 
794 
795  return (IsValid() ? m_opaque_sp->GetFlags().Get() : 0);
796 }
797 
799  LLDB_RECORD_METHOD(void, SBCommand, SetFlags, (uint32_t), flags);
800 
801  if (IsValid())
802  m_opaque_sp->GetFlags().Set(flags);
803 }
804 
805 namespace lldb_private {
806 namespace repro {
807 
808 template <>
812  GetStopOnContinue, ());
814  SetStopOnContinue, (bool));
816  GetStopOnError, ());
818  (bool));
820  GetStopOnCrash, ());
822  (bool));
824  GetEchoCommands, ());
826  (bool));
828  GetEchoCommentCommands, ());
830  SetEchoCommentCommands, (bool));
832  GetPrintResults, ());
834  (bool));
836  GetAddToHistory, ());
838  (bool));
842  (const lldb::SBCommandInterpreter &));
845  SBCommandInterpreter, operator=,(const lldb::SBCommandInterpreter &));
847  LLDB_REGISTER_METHOD_CONST(bool, SBCommandInterpreter, operator bool, ());
849  (const char *));
851  (const char *));
858  (const char *, lldb::SBCommandReturnObject &, bool));
861  (const char *, lldb::SBExecutionContext &,
862  lldb::SBCommandReturnObject &, bool));
868  (const char *, const char *, const char *, int, int,
869  lldb::SBStringList &));
872  (const char *, const char *, const char *, int, int,
876  (const char *, uint32_t, int, int,
880  (const char *, uint32_t, int, int, lldb::SBStringList &));
886  ());
890  (bool));
894  (const char *, lldb::SBCommandReturnObject &));
902  GetBroadcaster, ());
904  GetBroadcasterClass, ());
907  (const lldb::CommandArgumentType));
910  (const lldb::CommandArgumentType));
913  (const lldb::SBEvent &));
915  AddMultiwordCommand, (const char *, const char *));
918  (const char *, lldb::SBCommandPluginInterface *, const char *));
920  (const char *, lldb::SBCommandPluginInterface *,
921  const char *, const char *));
924  LLDB_REGISTER_METHOD_CONST(bool, SBCommand, operator bool, ());
925  LLDB_REGISTER_METHOD(const char *, SBCommand, GetName, ());
926  LLDB_REGISTER_METHOD(const char *, SBCommand, GetHelp, ());
927  LLDB_REGISTER_METHOD(const char *, SBCommand, GetHelpLong, ());
928  LLDB_REGISTER_METHOD(void, SBCommand, SetHelp, (const char *));
929  LLDB_REGISTER_METHOD(void, SBCommand, SetHelpLong, (const char *));
931  (const char *, const char *));
934  (const char *, lldb::SBCommandPluginInterface *, const char *));
936  (const char *, lldb::SBCommandPluginInterface *,
937  const char *, const char *));
938  LLDB_REGISTER_METHOD(uint32_t, SBCommand, GetFlags, ());
939  LLDB_REGISTER_METHOD(void, SBCommand, SetFlags, (uint32_t));
940 }
941 
942 }
943 }
int GetQuitExitCode(bool &exited) const
Returns the exit code that the user has specified when running the &#39;quit&#39; command.
int GetQuitStatus()
Returns the exit code that the user has specified when running the &#39;quit&#39; command.
bool DoExecute(Args &command, CommandReturnObject &result) override
The registry contains a unique mapping between functions and their ID.
A command line argument class.
Definition: Args.h:32
void AllowExitCodeOnQuit(bool allow)
Sets whether the command interpreter should allow custom exit codes for the &#39;quit&#39; command...
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
void SetSP(const lldb::ProcessSP &process_sp)
Definition: SBProcess.cpp:108
lldb_private::CommandReturnObject * Release()
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
static const char * GetBroadcasterClass()
#define LLDB_RECORD_STATIC_METHOD(Result, Class, Method, Signature,...)
#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature,...)
The LLDB_RECORD_DUMMY macro is special because it doesn&#39;t actually record anything.
char ** GetArgumentVector()
Gets the argument vector.
Definition: Args.cpp:268
lldb::SBCommand AddMultiwordCommand(const char *name, const char *help)
#define LLDB_RECORD_STATIC_METHOD_NO_ARGS(Result, Class, Method)
bool SetCommandOverrideCallback(const char *command_name, lldb::CommandOverrideCallback callback, void *baton)
A file utility class.
Definition: FileSpec.h:55
void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result)
lldb::ReturnStatus HandleCommand(const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history=false)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
lldb_private::ExecutionContextRef * get() const
int HandleCompletion(const char *current_line, const char *cursor, const char *last_char, int match_start_point, int max_return_elements, StringList &matches, StringList &descriptions)
void RegisterMethods< SBCommandInterpreterRunOptions >(Registry &R)
lldb::SBCommand AddMultiwordCommand(const char *name, const char *help=nullptr)
#define LLDB_REGISTER_STATIC_METHOD(Result, Class, Method, Signature)
bool AddUserCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
void SetHelp(const char *)
const char * GetIOHandlerControlSequence(char ch)
Get the string that needs to be written to the debugger stdin file handle when a control character is...
bool GetDescription(lldb::SBStream &description) const
Definition: SBFileSpec.cpp:174
bool IsValid() const
Definition: SBFileSpec.cpp:79
const char * GetHelpLong()
lldb_private::CommandInterpreter * get()
const char * GetData()
Definition: SBStream.cpp:42
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
bool CommandExists(const char *cmd)
void HandleCommandsFromFile(FileSpec &file, ExecutionContext *context, CommandInterpreterRunOptions &options, CommandReturnObject &result)
Execute a list of commands from a file.
lldb::SBCommand AddCommand(const char *name, lldb::SBCommandPluginInterface *impl, const char *help)
void SourceInitFileInCurrentWorkingDirectory(lldb::SBCommandReturnObject &result)
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
bool AliasExists(const char *cmd)
lldb_private::CommandInterpreter & ref()
lldb::SBCommand AddCommand(const char *name, lldb::SBCommandPluginInterface *impl, const char *help=nullptr)
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
bool(* CommandOverrideCallback)(void *baton, const char **argv)
Definition: lldb-types.h:71
static const char * GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type)
ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const
Create an ExecutionContext object from this object.
void reset(lldb_private::CommandInterpreter *)
bool HasCustomQuitExitCode()
Returns true if the user has called the &#39;quit&#39; command with a custom exit code.
ConstString GetTopIOHandlerControlSequence(char ch)
Definition: Debugger.cpp:1016
const lldb::SBCommandInterpreter & operator=(const lldb::SBCommandInterpreter &rhs)
void HandleCommandsFromFile(lldb::SBFileSpec &file, lldb::SBExecutionContext &override_context, lldb::SBCommandInterpreterRunOptions &options, lldb::SBCommandReturnObject result)
void SetOverrideCallback(lldb::CommandOverrideCallback callback, void *baton)
int HandleCompletion(const char *current_line, const char *cursor, const char *last_char, int match_start_point, int max_return_elements, lldb::SBStringList &matches)
void AllowExitCodeOnQuit(bool allow)
Specify if the command interpreter should allow that the user can specify a custom exit code when cal...
CommandPluginInterfaceImplementation(CommandInterpreter &interpreter, const char *name, lldb::SBCommandPluginInterface *backend, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
lldb_private::CommandReturnObject & ref() const
void void AppendError(llvm::StringRef in_string)
void AppendList(const char **strv, int strc)
bool AliasExists(llvm::StringRef cmd) const
A uniqued constant string class.
Definition: ConstString.h:38
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:247
SBCommandInterpreter(const lldb::SBCommandInterpreter &rhs)
int HandleCompletionWithDescriptions(const char *current_line, const char *cursor, const char *last_char, int match_start_point, int max_return_elements, lldb::SBStringList &matches, lldb::SBStringList &descriptions)
Definition: SBAddress.h:15
bool HandleCommand(const char *command_line, LazyBool add_to_history, CommandReturnObject &result, ExecutionContext *override_context=nullptr, bool repeat_on_empty_command=true, bool no_context_switching=false)
void SetFlags(uint32_t flags)
lldb::SBBroadcaster GetBroadcaster()
void ResolveCommand(const char *command_line, SBCommandReturnObject &result)
Resolve the command just as HandleCommand would, expanding abbreviations and aliases.
bool CommandExists(llvm::StringRef cmd) const
void SetHelpLong(const char *)
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
void ResolveCommand(const char *command_line, CommandReturnObject &result)
static const char * GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type)
lldb::TargetSP GetSelectedTarget()
Definition: Debugger.h:167
std::shared_ptr< lldb::SBCommandPluginInterface > m_backend
CommandObject * GetCommandObjectForCommand(llvm::StringRef &command_line)
static bool EventIsCommandInterpreterEvent(const lldb::SBEvent &event)
#define LLDB_RECORD_RESULT(Result)
void SetStatus(lldb::ReturnStatus status)
void SourceInitFile(bool in_cwd, CommandReturnObject &result)
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
bool IsActive()
Return true if the command interpreter is the active IO handler.