CommandCompletions.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. //===-- CommandCompletions.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. #ifndef LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
  9. #define LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
  10. #include <set>
  11. #include "lldb/Core/FileSpecList.h"
  12. #include "lldb/Core/SearchFilter.h"
  13. #include "lldb/Utility/CompletionRequest.h"
  14. #include "lldb/Utility/RegularExpression.h"
  15. #include "lldb/lldb-private.h"
  16. #include "llvm/ADT/Twine.h"
  17. namespace lldb_private {
  18. class TildeExpressionResolver;
  19. class CommandCompletions {
  20. public:
  21. enum CommonCompletionTypes {
  22. eNoCompletion = 0u,
  23. eSourceFileCompletion = (1u << 0),
  24. eDiskFileCompletion = (1u << 1),
  25. eDiskDirectoryCompletion = (1u << 2),
  26. eSymbolCompletion = (1u << 3),
  27. eModuleCompletion = (1u << 4),
  28. eSettingsNameCompletion = (1u << 5),
  29. ePlatformPluginCompletion = (1u << 6),
  30. eArchitectureCompletion = (1u << 7),
  31. eVariablePathCompletion = (1u << 8),
  32. eRegisterCompletion = (1u << 9),
  33. eBreakpointCompletion = (1u << 10),
  34. eProcessPluginCompletion = (1u << 11),
  35. eDisassemblyFlavorCompletion = (1u << 12),
  36. eTypeLanguageCompletion = (1u << 13),
  37. eFrameIndexCompletion = (1u << 14),
  38. eModuleUUIDCompletion = (1u << 15),
  39. eStopHookIDCompletion = (1u << 16),
  40. eThreadIndexCompletion = (1u << 17),
  41. eWatchPointIDCompletion = (1u << 18),
  42. eBreakpointNameCompletion = (1u << 19),
  43. eProcessIDCompletion = (1u << 20),
  44. eProcessNameCompletion = (1u << 21),
  45. eRemoteDiskFileCompletion = (1u << 22),
  46. eRemoteDiskDirectoryCompletion = (1u << 23),
  47. eTypeCategoryNameCompletion = (1u << 24),
  48. // This item serves two purposes. It is the last element in the enum, so
  49. // you can add custom enums starting from here in your Option class. Also
  50. // if you & in this bit the base code will not process the option.
  51. eCustomCompletion = (1u << 24)
  52. };
  53. static bool InvokeCommonCompletionCallbacks(
  54. CommandInterpreter &interpreter, uint32_t completion_mask,
  55. lldb_private::CompletionRequest &request, SearchFilter *searcher);
  56. // These are the generic completer functions:
  57. static void DiskFiles(CommandInterpreter &interpreter,
  58. CompletionRequest &request, SearchFilter *searcher);
  59. static void DiskFiles(const llvm::Twine &partial_file_name,
  60. StringList &matches, TildeExpressionResolver &Resolver);
  61. static void DiskDirectories(CommandInterpreter &interpreter,
  62. CompletionRequest &request,
  63. SearchFilter *searcher);
  64. static void DiskDirectories(const llvm::Twine &partial_file_name,
  65. StringList &matches,
  66. TildeExpressionResolver &Resolver);
  67. static void RemoteDiskFiles(CommandInterpreter &interpreter,
  68. CompletionRequest &request,
  69. SearchFilter *searcher);
  70. static void RemoteDiskDirectories(CommandInterpreter &interpreter,
  71. CompletionRequest &request,
  72. SearchFilter *searcher);
  73. static void SourceFiles(CommandInterpreter &interpreter,
  74. CompletionRequest &request, SearchFilter *searcher);
  75. static void Modules(CommandInterpreter &interpreter,
  76. CompletionRequest &request, SearchFilter *searcher);
  77. static void ModuleUUIDs(CommandInterpreter &interpreter,
  78. CompletionRequest &request, SearchFilter *searcher);
  79. static void Symbols(CommandInterpreter &interpreter,
  80. CompletionRequest &request, SearchFilter *searcher);
  81. static void SettingsNames(CommandInterpreter &interpreter,
  82. CompletionRequest &request, SearchFilter *searcher);
  83. static void PlatformPluginNames(CommandInterpreter &interpreter,
  84. CompletionRequest &request,
  85. SearchFilter *searcher);
  86. static void ArchitectureNames(CommandInterpreter &interpreter,
  87. CompletionRequest &request,
  88. SearchFilter *searcher);
  89. static void VariablePath(CommandInterpreter &interpreter,
  90. CompletionRequest &request, SearchFilter *searcher);
  91. static void Registers(CommandInterpreter &interpreter,
  92. CompletionRequest &request, SearchFilter *searcher);
  93. static void Breakpoints(CommandInterpreter &interpreter,
  94. CompletionRequest &request, SearchFilter *searcher);
  95. static void BreakpointNames(CommandInterpreter &interpreter,
  96. CompletionRequest &request,
  97. SearchFilter *searcher);
  98. static void ProcessPluginNames(CommandInterpreter &interpreter,
  99. CompletionRequest &request,
  100. SearchFilter *searcher);
  101. static void ProcessIDs(CommandInterpreter &interpreter,
  102. CompletionRequest &request, SearchFilter *searcher);
  103. static void ProcessNames(CommandInterpreter &interpreter,
  104. CompletionRequest &request, SearchFilter *searcher);
  105. static void DisassemblyFlavors(CommandInterpreter &interpreter,
  106. CompletionRequest &request,
  107. SearchFilter *searcher);
  108. static void TypeLanguages(CommandInterpreter &interpreter,
  109. CompletionRequest &request, SearchFilter *searcher);
  110. static void FrameIndexes(CommandInterpreter &interpreter,
  111. CompletionRequest &request, SearchFilter *searcher);
  112. static void StopHookIDs(CommandInterpreter &interpreter,
  113. CompletionRequest &request, SearchFilter *searcher);
  114. static void ThreadIndexes(CommandInterpreter &interpreter,
  115. CompletionRequest &request, SearchFilter *searcher);
  116. static void WatchPointIDs(CommandInterpreter &interpreter,
  117. CompletionRequest &request, SearchFilter *searcher);
  118. static void TypeCategoryNames(CommandInterpreter &interpreter,
  119. CompletionRequest &request,
  120. SearchFilter *searcher);
  121. };
  122. } // namespace lldb_private
  123. #endif // LLDB_INTERPRETER_COMMANDCOMPLETIONS_H