28#include "llvm/ADT/StringRef.h"
37#define LLDB_OPTIONS_source
38#include "CommandOptions.inc"
44 interpreter,
"command source",
45 "Read and execute LLDB commands from the file <filename>.",
53 uint32_t index)
override {
54 return std::string(
"");
73 switch (short_option) {
91 llvm_unreachable(
"Unimplemented option");
105 return llvm::ArrayRef(g_source_options);
119 "'%s' takes exactly one executable filename argument",
125 if (
m_options.m_cmd_relative_to_command_file) {
128 result.
AppendError(
"command source -C can only be specified "
129 "from a command file");
135 FileSpec cmd_file(command[0].ref());
139 result.
AppendError(
"command source -C can only be used "
140 "with a relative path.");
151 if (
m_options.m_stop_on_error.OptionWasSet() ||
153 m_options.m_stop_on_continue.OptionWasSet()) {
154 if (
m_options.m_stop_on_continue.OptionWasSet())
156 m_options.m_stop_on_continue.GetCurrentValue());
158 if (
m_options.m_stop_on_error.OptionWasSet())
162 if (
m_options.m_silent_run.GetCurrentValue()) {
172 m_interpreter.HandleCommandsFromFile(cmd_file, options, result);
178#pragma mark CommandObjectCommandsAlias
181#define LLDB_OPTIONS_alias
182#include "CommandOptions.inc"
185 "Enter your Python command(s). Type 'DONE' to end.\n"
186 "You must define a Python function with this signature:\n"
187 "def my_command_impl(debugger, args, exe_ctx, result, internal_dict):\n";
198 return llvm::ArrayRef(g_alias_options);
205 const int short_option =
GetDefinitions()[option_idx].short_option;
206 std::string option_str(option_value);
208 switch (short_option) {
210 m_help.SetCurrentValue(option_str);
220 llvm_unreachable(
"Unimplemented option");
243 interpreter,
"command alias",
244 "Define a custom command in terms of an existing command.") {
249 "'alias' allows the user to create a short-cut or abbreviation for long \
250commands, multi-word commands, and commands that take particular options. \
251Below are some simple examples of how one might use the 'alias' command:"
254(lldb) command alias sc script
256 Creates the abbreviation 'sc' for the 'script' command.
258(lldb) command alias bp breakpoint
261 " Creates the abbreviation 'bp' for the 'breakpoint' command. Since \
262breakpoint commands are two-word commands, the user would still need to \
263enter the second word after 'bp', e.g. 'bp enable' or 'bp delete'."
266(lldb) command alias bpl breakpoint list
268 Creates the abbreviation 'bpl' for the two-word command 'breakpoint list'.
271 "An alias can include some options for the command, with the values either \
272filled in at the time the alias is created, or specified as positional \
273arguments, to be filled in when the alias is invoked. The following example \
274shows how to create aliases with options:"
277(lldb) command alias bfl breakpoint set -f %1 -l %2
280 " Creates the abbreviation 'bfl' (for break-file-line), with the -f and -l \
281options already part of the alias. So if the user wants to set a breakpoint \
282by file and line without explicitly having to use the -f and -l options, the \
283user can now use 'bfl' instead. The '%1' and '%2' are positional placeholders \
284for the actual arguments that will be passed when the alias command is used. \
285The number in the placeholder refers to the position/order the actual value \
286occupies when the alias is used. All the occurrences of '%1' in the alias \
287will be replaced with the first argument, all the occurrences of '%2' in the \
288alias will be replaced with the second argument, and so on. This also allows \
289actual arguments to be used multiple times within an alias (see 'process \
290launch' example below)."
294 "Note: the positional arguments must substitute as whole words in the resultant \
295command, so you can't at present do something like this to append the file extension \
299(lldb) command alias bcppfl breakpoint set -f %1.cpp -l %2
302 "For more complex aliasing, use the \"command regex\" command instead. In the \
303'bfl' case above, the actual file value will be filled in with the first argument \
304following 'bfl' and the actual line number value will be filled in with the second \
305argument. The user would use this alias as follows:"
308(lldb) command alias bfl breakpoint set -f %1 -l %2
309(lldb) bfl my-file.c 137
311This would be the same as if the user had entered 'breakpoint set -f my-file.c -l 137'.
315(lldb) command alias pltty process launch -s -o %1 -e %1
316(lldb) pltty /dev/tty0
318 Interpreted as 'process launch -s -o /dev/tty0 -e /dev/tty0'
321 "If the user always wanted to pass the same value to a particular option, the \
322alias could be defined with that value directly in the alias as a constant, \
323rather than using a positional placeholder:"
326(lldb) command alias bl3 breakpoint set -f %1 -l 3
328 Always sets a breakpoint on line 3 of whatever file is indicated.
332 "If the alias abbreviation or the full alias command collides with another \
333existing command, the command resolver will prefer to use the alias over any \
334other command as far as there is only one alias command match.");
349 arg1.push_back(alias_arg);
357 arg2.push_back(cmd_arg);
365 arg3.push_back(options_arg);
376 void DoExecute(llvm::StringRef raw_command_line,
378 if (raw_command_line.empty()) {
379 result.
AppendError(
"'command alias' requires at least two arguments");
386 OptionsWithRaw args_with_suffix(raw_command_line);
388 if (args_with_suffix.HasArgs())
393 llvm::StringRef raw_command_string = args_with_suffix.GetRawPart();
394 Args args(raw_command_string);
396 if (args.GetArgumentCount() < 2) {
397 result.
AppendError(
"'command alias' requires at least two arguments");
403 auto alias_command = args[0].ref();
404 if (alias_command.starts_with(
"-")) {
405 result.
AppendError(
"aliases starting with a dash are not supported");
406 if (alias_command ==
"--help" || alias_command ==
"--long-help") {
407 result.
AppendWarning(
"if trying to pass options to 'command alias' add "
408 "a -- at the end of the options");
415 size_t pos = raw_command_string.find(alias_command);
417 raw_command_string = raw_command_string.substr(alias_command.size());
418 pos = raw_command_string.find_first_not_of(
' ');
419 if ((pos != std::string::npos) && (pos > 0))
420 raw_command_string = raw_command_string.substr(pos);
422 result.
AppendError(
"error parsing command string. No alias created");
429 "'%s' is a permanent debugger command and cannot be redefined",
434 if (
m_interpreter.UserMultiwordCommandExists(alias_command)) {
436 "'%s' is a user container command and cannot be overwritten.\n"
437 "Delete it first with 'command container delete'",
445 llvm::StringRef original_raw_command_string = raw_command_string;
447 m_interpreter.GetCommandObjectForCommand(raw_command_string);
451 "'%s' does not begin with a valid command."
453 original_raw_command_string.str().c_str());
466 llvm::StringRef raw_command_string,
468 CommandReturnObject &result) {
472 std::make_shared<OptionArgVector>();
474 const bool include_aliases =
true;
482 cmd_obj_sp = cmd_obj.shared_from_this();
487 "overwriting existing definition for '{0}'", alias_command);
490 alias_command, cmd_obj_sp, raw_command_string)) {
497 result.
AppendError(
"Unable to create requested alias.\n");
506 result.
AppendError(
"'command alias' requires at least two arguments");
511 const std::string alias_command(std::string(args[0].ref()));
512 const std::string actual_command(std::string(args[1].ref()));
522 "'%s' is a permanent debugger command and cannot be redefined",
523 alias_command.c_str());
527 if (
m_interpreter.UserMultiwordCommandExists(alias_command)) {
529 "'%s' is user container command and cannot be overwritten.\n"
530 "Delete it first with 'command container delete'",
531 alias_command.c_str());
538 bool use_subcommand =
false;
539 if (!command_obj_sp) {
541 actual_command.c_str());
547 std::make_shared<OptionArgVector>();
550 auto sub_command = args[0].ref();
551 assert(!sub_command.empty());
553 if (!subcommand_obj_sp) {
555 "'%s' is not a valid sub-command of '%s'. "
556 "Unable to create alias",
557 args[0].c_str(), actual_command.c_str());
561 sub_cmd_obj = subcommand_obj_sp.get();
562 use_subcommand =
true;
564 cmd_obj = sub_cmd_obj;
569 std::string args_string;
583 "overwriting existing definition for '{0}'", alias_command);
587 alias_command, use_subcommand ? subcommand_obj_sp : command_obj_sp,
595 result.
AppendError(
"Unable to create requested alias.\n");
603#pragma mark CommandObjectCommandsUnalias
610 interpreter,
"command unalias",
611 "Delete one or more custom commands defined by 'command alias'.",
634 result.
AppendError(
"must call 'unalias' with a valid alias");
638 auto command_name = args[0].ref();
642 "'%s' is not a known command.\nTry 'help' to see a "
643 "current list of commands",
651 "'%s' is not an alias, it is a debugger command which can be "
652 "removed using the 'command delete' command",
656 "'%s' is a permanent debugger command and cannot be removed",
665 "Error occurred while attempting to unalias '%s'", args[0].c_str());
676#pragma mark CommandObjectCommandsDelete
683 interpreter,
"command delete",
684 "Delete one or more custom commands defined by 'command regex'.",
698 if (ent.second->IsRemovable())
707 "defined regular expression command names",
712 auto command_name = args[0].ref();
715 const bool generate_upropos =
true;
716 const bool generate_type_lookup =
false;
718 &error_msg_stream, command_name, llvm::StringRef(), llvm::StringRef(),
719 generate_upropos, generate_type_lookup);
726 "'%s' is a permanent debugger command and cannot be removed",
737#define LLDB_OPTIONS_regex
738#include "CommandOptions.inc"
740#pragma mark CommandObjectCommandsAddRegex
747 interpreter,
"command regex",
748 "Define a custom command in terms of "
749 "existing commands by matching "
750 "regular expressions.",
751 "command regex <cmd-name> [s/<regex>/<subst>/ ...]"),
757 "This command allows the user to create powerful regular expression commands \
758with substitutions. The regular expressions and substitutions are specified \
759using the regular expression substitution format of:"
765 "<regex> is a regular expression that can use parenthesis to capture regular \
766expression input and substitute the captured matches in the output using %1 \
767for the first match, %2 for the second, and so on."
771 "The regular expressions can all be specified on the command line if more than \
772one argument is provided. If just the command name is provided on the command \
773line, then the regular expressions and substitutions can be entered on separate \
774lines, followed by an empty line to terminate the command definition."
780 "The following example will define a regular expression command named 'f' that \
781will call 'finish' if there are no arguments, or 'frame select <frame-idx>' if \
782a number follows 'f':"
785 (lldb) command regex f s/^$/finish/ 's/([0-9]+)/frame select %1/')");
798 "Enter one or more sed substitution commands in "
799 "the form: 's/<regex>/<subst>/'.\nTerminate the "
800 "substitution list with an empty line.\n");
806 std::string &data)
override {
811 bool check_only =
false;
812 for (
const std::string &line : lines) {
823 m_interpreter.AddCommand(cmd_sp->GetCommandName(), cmd_sp,
true);
828 void DoExecute(Args &command, CommandReturnObject &result)
override {
831 result.
AppendError(
"usage: 'command regex <command-name> "
832 "[s/<regex1>/<subst1>/ s/<regex2>/<subst2>/ ...]'\n");
837 auto name = command[0].ref();
845 const bool multiple_lines =
true;
847 debugger, IOHandler::Type::Other,
849 llvm::StringRef(
"> "),
851 multiple_lines, color_prompt,
860 for (
auto &entry : command.
entries().drop_front()) {
861 bool check_only =
false;
867 if (
error.Success()) {
882 return Status::FromErrorStringWithFormat(
883 "invalid regular expression command object for: '%.*s'",
884 (
int)regex_sed.size(), regex_sed.data());
888 size_t regex_sed_size = regex_sed.size();
890 if (regex_sed_size <= 1) {
891 return Status::FromErrorStringWithFormat(
892 "regular expression substitution string is too short: '%.*s'",
893 (
int)regex_sed.size(), regex_sed.data());
897 if (regex_sed[0] !=
's') {
898 return Status::FromErrorStringWithFormat(
899 "regular expression substitution string "
900 "doesn't start with 's': '%.*s'",
901 (
int)regex_sed.size(), regex_sed.data());
904 const size_t first_separator_char_pos = 1;
907 const char separator_char = regex_sed[first_separator_char_pos];
908 const size_t second_separator_char_pos =
909 regex_sed.find(separator_char, first_separator_char_pos + 1);
911 if (second_separator_char_pos == std::string::npos) {
912 return Status::FromErrorStringWithFormat(
913 "missing second '%c' separator char after '%.*s' in '%.*s'",
915 (
int)(regex_sed.size() - first_separator_char_pos - 1),
916 regex_sed.data() + (first_separator_char_pos + 1),
917 (
int)regex_sed.size(), regex_sed.data());
921 const size_t third_separator_char_pos =
922 regex_sed.find(separator_char, second_separator_char_pos + 1);
924 if (third_separator_char_pos == std::string::npos) {
925 return Status::FromErrorStringWithFormat(
926 "missing third '%c' separator char after '%.*s' in '%.*s'",
928 (
int)(regex_sed.size() - second_separator_char_pos - 1),
929 regex_sed.data() + (second_separator_char_pos + 1),
930 (
int)regex_sed.size(), regex_sed.data());
934 if (third_separator_char_pos != regex_sed_size - 1) {
936 if (regex_sed.find_first_not_of(
"\t\n\v\f\r ",
937 third_separator_char_pos + 1) !=
939 return Status::FromErrorStringWithFormat(
940 "extra data found after the '%.*s' regular expression substitution "
942 (
int)third_separator_char_pos + 1, regex_sed.data(),
943 (
int)(regex_sed.size() - third_separator_char_pos - 1),
944 regex_sed.data() + (third_separator_char_pos + 1));
947 }
else if (first_separator_char_pos + 1 == second_separator_char_pos) {
948 return Status::FromErrorStringWithFormat(
949 "<regex> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
950 separator_char, separator_char, separator_char, (
int)regex_sed.size(),
953 }
else if (second_separator_char_pos + 1 == third_separator_char_pos) {
954 return Status::FromErrorStringWithFormat(
955 "<subst> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
956 separator_char, separator_char, separator_char, (
int)regex_sed.size(),
962 std::string regex(std::string(regex_sed.substr(
963 first_separator_char_pos + 1,
964 second_separator_char_pos - first_separator_char_pos - 1)));
965 std::string subst(std::string(regex_sed.substr(
966 second_separator_char_pos + 1,
967 third_separator_char_pos - second_separator_char_pos - 1)));
977 m_interpreter.AddCommand(cmd_sp->GetCommandName(), cmd_sp,
true);
992 ExecutionContext *execution_context)
override {
996 switch (short_option) {
998 m_help.assign(std::string(option_arg));
1001 m_syntax.assign(std::string(option_arg));
1004 llvm_unreachable(
"Unimplemented option");
1016 return llvm::ArrayRef(g_regex_options);
1038 std::string funct, std::string help,
1047 stream.
Printf(
"For more information run 'help %s'", name.c_str());
1068 std::string docstring;
1071 if (!docstring.empty())
1132 stream.
Printf(
"For more information run 'help %s'", name.c_str());
1154 uint32_t index)
override {
1156 return std::nullopt;
1166 std::string docstring;
1168 if (!docstring.empty())
1181 std::string docstring;
1183 if (!docstring.empty())
1245 "SetOptionValue called with empty cmd_obj.");
1250 "SetOptionValue called before options definitions "
1257 const char *long_option =
1260 execution_context, long_option, option_arg);
1263 "Error setting option: {0} to {1}", long_option, option_arg);
1281 size_t counter, uint32_t &usage_mask) {
1297 obj_sp->GetAsUnsignedInteger();
1300 uint32_t value = uint_val->
GetValue();
1303 "0 is not a valid group for option {0}", counter);
1305 usage_mask = (1 << (value - 1));
1312 "required field is not a array for option {0}", counter);
1316 auto groups_accumulator
1317 = [counter, &usage_mask, &
error]
1321 uint32_t value = int_val->
GetValue();
1324 "0 is not a valid group for element {0}", counter);
1327 usage_mask |= (1 << (value - 1));
1333 "Group element not an int or array of integers for element {0}",
1337 size_t num_range_elem = arr_val->
GetSize();
1338 if (num_range_elem != 2) {
1340 "Subranges of a group not a start and a stop for element {0}",
1347 "Start element of a subrange of a "
1348 "group not unsigned int for element {0}",
1352 uint32_t start = int_val->
GetValue();
1356 "End element of a subrange of a group"
1357 " not unsigned int for element {0}",
1361 uint32_t end = int_val->
GetValue();
1362 if (start == 0 || end == 0 || start > end) {
1364 "Invalid subrange of a group: {0} - "
1365 "{1} for element {2}",
1366 start, end, counter);
1369 for (uint32_t i = start; i <= end; i++) {
1370 usage_mask |= (1 << (i - 1));
1374 array_val->
ForEach(groups_accumulator);
1390 size_t short_opt_counter = 0;
1392 auto add_element = [
this, &
error, &counter, &short_opt_counter]
1397 "Value in options dictionary is not a dictionary");
1429 "'required' field is not a boolean "
1442 llvm::StringRef short_str = obj_sp->GetStringValue();
1443 if (short_str.empty()) {
1445 "short_option field empty for "
1449 }
else if (short_str.size() != 1) {
1451 "short_option field has extra "
1452 "characters for option {0}",
1456 short_option = (int) short_str[0];
1460 short_option = short_opt_counter++;
1465 if (long_option.empty()) {
1467 "empty long_option for option {0}", counter);
1471 option_def.
long_option = ((*(inserted.first)).data());
1477 = obj_sp->GetAsUnsignedInteger();
1480 "Value type must be an unsigned "
1484 uint64_t val_type = uint_val->
GetValue();
1488 "CommandArgumentType bounds",
1505 "Completion type must be an "
1506 "unsigned integer for option {0}",
1510 uint64_t completion_type = uint_val->
GetValue();
1513 "Completion type for option {0} "
1514 "beyond the CompletionType bounds",
1526 "required usage missing from option "
1531 llvm::StringRef usage_stref;
1532 usage_stref = obj_sp->GetStringValue();
1533 if (usage_stref.empty()) {
1535 "empty usage text for option {0}", counter);
1548 "enum values must be an array for "
1553 size_t num_elem = array->
GetSize();
1554 size_t enum_ctr = 0;
1555 m_enum_storage[counter] = std::vector<EnumValueStorage>(num_elem);
1556 std::vector<EnumValueStorage> &curr_elem =
m_enum_storage[counter];
1562 auto add_enum = [&enum_ctr, &curr_elem, counter, &
error]
1567 "Enum values for option {0} not "
1572 size_t num_enum_elements = enum_arr->
GetSize();
1573 if (num_enum_elements != 2) {
1575 "Wrong number of elements: {0} "
1576 "for enum {1} in option {2}",
1577 num_enum_elements, enum_ctr, counter);
1582 llvm::StringRef val_stref = obj_sp->GetStringValue();
1583 std::string value_cstr_str = val_stref.str().c_str();
1589 "No usage for enum {0} in option "
1594 llvm::StringRef usage_stref = obj_sp->GetStringValue();
1595 std::string usage_cstr_str = usage_stref.str().c_str();
1597 usage_cstr_str, enum_ctr);
1604 if (!
error.Success())
1608 for (
auto &elem : curr_elem)
1634 for (
auto option_elem : option_vec) {
1635 int cur_defs_index = option_elem.opt_defs_index;
1641 bool option_has_arg = opt_defs[cur_defs_index].option_has_arg;
1642 llvm::StringRef cur_arg_value;
1643 if (option_has_arg) {
1644 int cur_arg_pos = option_elem.opt_arg_pos;
1662 assert(completion_dict_sp &&
"Must have valid completion dict");
1664 llvm::StringRef completion;
1666 if (completion_dict_sp->GetValueForKeyAsString(
"no-completion",
1670 if (completion_dict_sp->GetValueForKeyAsString(
"completion",
1672 llvm::StringRef mode_str;
1674 if (completion_dict_sp->GetValueForKeyAsString(
"mode", mode_str)) {
1675 if (mode_str ==
"complete")
1677 else if (mode_str ==
"partial")
1690 if (completion_dict_sp->GetValueForKeyAsArray(
"values", completions)) {
1691 completion_dict_sp->GetValueForKeyAsArray(
"descriptions", descriptions);
1692 size_t num_completions = completions->
GetSize();
1693 for (
size_t idx = 0; idx < num_completions; idx++) {
1711 int opt_element_index,
1721 size_t defs_index = option_vec[opt_element_index].opt_defs_index;
1722 llvm::StringRef option_name = defs[defs_index].long_option;
1723 bool is_enum = defs[defs_index].enum_values.size() != 0;
1724 if (option_name.empty())
1733 if (!completion_dict_sp) {
1735 opt_element_index, interpreter);
1745 element.string_value =
"value not set";
1746 element.usage =
"usage not set";
1751 size_t in_value) :
value(std::move(in_str_val)),
usage(std::move(in_usage)) {
1802 interpreter, name, cmd_interface_sp, synch));
1810 if (opt_error.
Fail())
1813 if (arg_error.
Fail())
1815 opt_error.
Fail() ?
", also " :
"",
1845 if (options_object_sp) {
1850 options_object_sp->GetAsDictionary();
1866 if (args_object_sp) {
1881 size_t elem_counter = 0;
1882 auto args_adder = [
this, counter, &elem_counter, &this_entry]
1888 uint32_t arg_opt_set_association;
1890 auto report_error = [
this, elem_counter,
1891 counter](
const char *err_txt) ->
bool {
1893 "element {} of arguments list element {}: {}", elem_counter,
1900 report_error(
"is not a dictionary.");
1908 = obj_sp->GetAsUnsignedInteger();
1910 report_error(
"value type must be an unsigned integer");
1913 uint64_t arg_type_int = uint_val->
GetValue();
1915 report_error(
"value type beyond ArgumentRepetitionType bounds");
1922 std::optional<ArgumentRepetitionType> repeat;
1924 llvm::StringRef repeat_str = obj_sp->GetStringValue();
1925 if (repeat_str.empty()) {
1926 report_error(
"repeat value is empty");
1931 report_error(
"invalid repeat value");
1934 arg_repetition = *repeat;
1940 counter, arg_opt_set_association);
1941 this_entry.emplace_back(arg_type, arg_repetition,
1942 arg_opt_set_association);
1950 "{0} is not an array",
1954 args_array->
ForEach(args_adder);
1957 if (this_entry.empty()) {
1969 args_array->
ForEach(arg_array_adder);
2011 : llvm::ArrayRef<OptionDefinition>();
2013 std::unordered_set<size_t> option_slots;
2014 for (
const auto &elem : option_vec) {
2015 if (elem.opt_defs_index == -1)
2017 option_slots.insert(elem.opt_pos);
2018 if (defs[elem.opt_defs_index].option_has_arg)
2019 option_slots.insert(elem.opt_arg_pos);
2022 std::vector<std::string> args_vec;
2026 size_t args_elem_pos = cursor_idx;
2028 for (
size_t idx = 0; idx < num_args; idx++) {
2029 if (option_slots.count(idx) == 0)
2030 args_vec.push_back(args[idx].ref().str());
2031 else if (idx < cursor_idx)
2038 if (!completion_dict_sp) {
2043 m_options.ProcessCompletionDict(request, completion_dict_sp);
2051 uint32_t index)
override {
2053 return std::nullopt;
2063 std::string docstring;
2065 if (!docstring.empty())
2078 std::string docstring;
2080 if (!docstring.empty())
2123std::unordered_set<std::string>
2127#define LLDB_OPTIONS_script_import
2128#include "CommandOptions.inc"
2134 "Import a scripting module in LLDB.", nullptr) {
2154 switch (short_option) {
2165 llvm_unreachable(
"Unimplemented option");
2176 return llvm::ArrayRef(g_script_import_options);
2183 if (command.
empty()) {
2184 result.
AppendError(
"command script import needs one or more arguments");
2189 if (
m_options.relative_to_command_file) {
2192 result.
AppendError(
"command script import -c can only be specified "
2193 "from a command file");
2198 for (
auto &entry : command.
entries()) {
2215 entry.c_str(), options,
error,
nullptr,
2228#define LLDB_OPTIONS_script_add
2229#include "CommandOptions.inc"
2236 "Add a scripted function as an LLDB command.",
2237 "Add a scripted function as an lldb command. "
2238 "If you provide a single argument, the command "
2239 "will be added at the root level of the command "
2240 "hierarchy. If there are more arguments they "
2241 "must be a path to a user-added container "
2242 "command, and the last element will be the new "
2256 opt_element_vector);
2271 switch (short_option) {
2273 if (!option_arg.empty())
2277 if (!option_arg.empty())
2281 if (!option_arg.empty())
2294 if (!
error.Success())
2296 "unrecognized value for synchronicity '%s'",
2297 option_arg.str().c_str());
2305 if (!
error.Success())
2307 "unrecognized value for command completion type '%s'",
2308 option_arg.str().c_str());
2312 llvm_unreachable(
"Unimplemented option");
2329 return llvm::ArrayRef(g_script_add_options);
2355 std::string &data)
override {
2363 std::string funct_name_str;
2365 if (funct_name_str.empty()) {
2368 "error: unable to obtain a function name, didn't "
2369 "add python command.\n");
2382 "error: unable to add selected command: '%s'",
2386 llvm::Error llvm_error =
m_container->LoadUserSubcommand(
2391 "error: unable to add selected command: '%s'",
2392 llvm::toString(std::move(llvm_error)).c_str());
2399 "error: unable to create function, didn't add python command\n");
2404 "error: empty function, didn't add python command\n");
2409 "error: script interpreter missing, didn't add python command\n");
2417 result.
AppendError(
"only scripting language supported for scripted "
2418 "commands is currently Python");
2423 result.
AppendError(
"'command script add' requires at least one argument");
2441 command,
true, path_error);
2443 if (path_error.
Fail()) {
2454 m_cmd_name = std::string(command[num_args - 1].ref());
2472 new_cmd_sp = std::make_shared<CommandObjectPythonFunction>(
2478 result.
AppendError(
"cannot find ScriptInterpreter");
2484 if (!cmd_interface_sp) {
2485 result.
AppendError(
"cannot create ScriptedCommandInterface");
2489 auto obj_or_err = cmd_interface_sp->CreatePluginObject(
2495 llvm::toString(obj_or_err.takeError()));
2506 new_cmd_sp = std::make_shared<CommandObjectScriptingObjectRaw>(
2516 if (add_error.
Fail())
2520 llvm::Error llvm_error =
2524 "cannot add command: %s",
2525 llvm::toString(std::move(llvm_error)).c_str());
2545 "List defined top-level scripted commands.",
2563 "Delete all scripted commands.", nullptr) {}
2581 interpreter,
"command script delete",
2582 "Delete a scripted command by specifying the path to the command.",
2599 llvm::StringRef root_cmd = command[0].ref();
2602 if (root_cmd.empty()) {
2609 "but no user defined commands found");
2616 command[0].c_str());
2619 if (!cmd_sp->IsUserCommand()) {
2621 command[0].c_str());
2624 if (cmd_sp->GetAsMultiwordCommand() && num_args == 1) {
2626 "Delete with \"command container delete\"",
2627 command[0].c_str());
2651 command[0].c_str());
2654 const char *leaf_cmd = command[num_args - 1].c_str();
2655 llvm::Error llvm_error =
2660 "could not delete command '%s': %s", leaf_cmd,
2661 llvm::toString(std::move(llvm_error)).c_str());
2667 out_stream <<
"Deleted command:";
2668 for (
size_t idx = 0; idx < num_args; idx++) {
2670 out_stream << command[idx].c_str();
2677#pragma mark CommandObjectMultiwordCommandsScript
2685 interpreter,
"command script",
2686 "Commands for managing custom "
2687 "commands implemented by "
2688 "interpreter scripts.",
2689 "command script <subcommand> [<subcommand-options>]") {
2708#pragma mark CommandObjectCommandContainer
2709#define LLDB_OPTIONS_container_add
2710#include "CommandOptions.inc"
2716 interpreter,
"command container add",
2717 "Add a container command to lldb. Adding to built-"
2718 "in container commands is not allowed.",
2719 "command container add [[path1]...] container-name") {
2746 switch (short_option) {
2748 if (!option_arg.empty())
2755 if (!option_arg.empty())
2759 llvm_unreachable(
"Unimplemented option");
2772 return llvm::ArrayRef(g_container_add_options);
2784 if (num_args == 0) {
2789 if (num_args == 1) {
2795 cmd_sp->GetAsMultiwordCommand()->SetRemovable(
true);
2797 cmd_name, cmd_sp,
m_options.m_overwrite);
2798 if (add_error.
Fail()) {
2823 llvm::Error llvm_error =
2827 llvm::toString(std::move(llvm_error)).c_str());
2838#define LLDB_OPTIONS_multiword_delete
2839#include "CommandOptions.inc"
2844 interpreter,
"command container delete",
2845 "Delete a container command previously added to "
2847 "command container delete [[path1] ...] container-cmd") {
2864 if (num_args == 0) {
2869 if (num_args == 1) {
2881 if (!cmd_sp->IsUserCommand()) {
2883 "container command %s is not a user command", cmd_name);
2886 if (!cmd_sp->GetAsMultiwordCommand()) {
2914 llvm::Error llvm_error =
2918 llvm::toString(std::move(llvm_error)).c_str());
2929 interpreter,
"command container",
2930 "Commands for adding container commands to lldb. "
2931 "Container commands are containers for other commands. You can "
2932 "add nested container commands by specifying a command path, "
2933 "but you can't add commands into the built-in command hierarchy.",
2934 "command container <subcommand> [<subcommand-options>]") {
2945#pragma mark CommandObjectMultiwordCommands
2952 "Commands for managing custom LLDB commands.",
2953 "command <subcommand> [<subcommand-options>]") {
static const char * g_python_command_instructions
static llvm::raw_ostream & error(Stream &strm)
static bool LoadScriptingModule(const FileSpec &scripting_fspec, ScriptInterpreter &script_interpreter, Target &target, Status &error)
CommandObjectCommandContainer(CommandInterpreter &interpreter)
~CommandObjectCommandContainer() override=default
llvm::StringRef GetSyntax()
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
llvm::StringRef GetHelp()
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
std::unique_ptr< CommandObjectRegexCommand > m_regex_cmd_up
void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override
Called when a line or lines have been retrieved.
~CommandObjectCommandsAddRegex() override=default
CommandObjectCommandsAddRegex(CommandInterpreter &interpreter)
Options * GetOptions() override
Status AppendRegexSubstitution(const llvm::StringRef ®ex_sed, bool check_only)
void DoExecute(Args &command, CommandReturnObject &result) override
void IOHandlerActivated(IOHandler &io_handler, bool interactive) override
void AddRegexCommandToInterpreter()
~CommandOptions() override=default
OptionValueString m_long_help
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
bool HandleAliasingNormalCommand(Args &args, CommandReturnObject &result)
OptionGroupOptions m_option_group
CommandOptions m_command_options
void DoExecute(llvm::StringRef raw_command_line, CommandReturnObject &result) override
~CommandObjectCommandsAlias() override=default
Options * GetOptions() override
bool HandleAliasingRawCommand(llvm::StringRef alias_command, llvm::StringRef raw_command_string, CommandObject &cmd_obj, CommandReturnObject &result)
CommandObjectCommandsAlias(CommandInterpreter &interpreter)
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandObjectCommandsContainerAdd() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
Options * GetOptions() override
CommandObjectCommandsContainerAdd(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectCommandsContainerDelete(CommandInterpreter &interpreter)
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
~CommandObjectCommandsContainerDelete() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectCommandsDelete(CommandInterpreter &interpreter)
void DoExecute(Args &args, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
~CommandObjectCommandsDelete() override=default
LazyBool m_overwrite_lazy
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
CompletionType m_completion_type
ScriptedCommandSynchronicity m_synchronicity
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void IOHandlerActivated(IOHandler &io_handler, bool interactive) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectCommandsScriptAdd() override=default
void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override
Called when a line or lines have been retrieved.
CompletionType m_completion_type
ScriptedCommandSynchronicity m_synchronicity
Options * GetOptions() override
CommandObjectMultiword * m_container
CommandObjectCommandsScriptAdd(CommandInterpreter &interpreter)
CommandObjectCommandsScriptClear(CommandInterpreter &interpreter)
~CommandObjectCommandsScriptClear() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectCommandsScriptDelete() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectCommandsScriptDelete(CommandInterpreter &interpreter)
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
void OptionParsingStarting(ExecutionContext *execution_context) override
bool relative_to_command_file
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
CommandObjectCommandsScriptImport(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
~CommandObjectCommandsScriptImport() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectCommandsScriptList() override=default
CommandObjectCommandsScriptList(CommandInterpreter &interpreter)
OptionValueBoolean m_cmd_relative_to_command_file
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
OptionValueBoolean m_stop_on_error
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
OptionValueBoolean m_stop_on_continue
OptionValueBoolean m_silent_run
std::optional< std::string > GetRepeatCommand(Args ¤t_command_args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
CommandObjectCommandsSource(CommandInterpreter &interpreter)
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectCommandsSource() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
void DoExecute(Args &args, CommandReturnObject &result) override
CommandObjectCommandsUnalias(CommandInterpreter &interpreter)
~CommandObjectCommandsUnalias() override=default
~CommandObjectMultiwordCommandsScript() override=default
CommandObjectMultiwordCommandsScript(CommandInterpreter &interpreter)
std::string m_function_name
void DoExecute(llvm::StringRef raw_command_line, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
bool IsRemovable() const override
ScriptedCommandSynchronicity GetSynchronicity()
bool WantsCompletion() override
CommandObjectPythonFunction(CommandInterpreter &interpreter, std::string name, std::string funct, std::string help, ScriptedCommandSynchronicity synch, CompletionType completion_type)
ScriptedCommandSynchronicity m_synchro
llvm::StringRef GetHelpLong() override
const std::string & GetFunctionName()
CompletionType m_completion_type
~CommandObjectPythonFunction() override=default
static Status ParseUsageMaskFromArray(StructuredData::ObjectSP obj_sp, size_t counter, uint32_t &usage_mask)
std::vector< std::string > m_usage_container
std::unique_ptr< OptionDefinition > m_options_definition_up
CommandOptions(lldb::ScriptedCommandInterfaceSP cmd_interface_sp)
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
void HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request, OptionElementVector &option_vec, int opt_element_index, CommandInterpreter &interpreter) override
Handles the generic bits of figuring out whether we are in an option, and if so completing it.
static std::unordered_set< std::string > g_string_storer
lldb::ScriptedCommandInterfaceSP m_cmd_interface_sp
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
std::vector< std::vector< OptionEnumValueElement > > m_enum_vector
void ProcessCompletionDict(CompletionRequest &request, StructuredData::DictionarySP &completion_dict_sp)
std::vector< std::vector< EnumValueStorage > > m_enum_storage
void PrepareOptionsForCompletion(CompletionRequest &request, OptionElementVector &option_vec, ExecutionContext *exe_ctx)
Status SetOptionsFromArray(StructuredData::Dictionary &options)
static CommandObjectSP Create(CommandInterpreter &interpreter, std::string name, lldb::ScriptedCommandInterfaceSP cmd_interface_sp, ScriptedCommandSynchronicity synch, CommandReturnObject &result)
llvm::StringRef GetHelpLong() override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &option_vec) override
The default version handles argument definitions that have only one argument type,...
bool IsRemovable() const override
CommandObjectScriptingObjectParsed(CommandInterpreter &interpreter, std::string name, lldb::ScriptedCommandInterfaceSP cmd_interface_sp, ScriptedCommandSynchronicity synch)
void DoExecute(Args &args, CommandReturnObject &result) override
Options * GetOptions() override
llvm::StringRef GetHelp() override
std::optional< std::string > GetRepeatCommand(Args &args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
~CommandObjectScriptingObjectParsed() override=default
void PrepareOptionsForCompletion(CompletionRequest &request, OptionElementVector &option_vec)
bool m_fetched_help_short
lldb::ScriptedCommandInterfaceSP m_cmd_interface_sp
bool WantsCompletion() override
ScriptedCommandSynchronicity m_synchro
ScriptedCommandSynchronicity GetSynchronicity()
CompletionType m_completion_type
bool WantsCompletion() override
llvm::StringRef GetHelp() override
CommandObjectScriptingObjectRaw(CommandInterpreter &interpreter, std::string name, lldb::ScriptedCommandInterfaceSP cmd_interface_sp, ScriptedCommandSynchronicity synch, CompletionType completion_type)
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
std::optional< std::string > GetRepeatCommand(Args &args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
llvm::StringRef GetHelpLong() override
ScriptedCommandSynchronicity m_synchro
~CommandObjectScriptingObjectRaw() override=default
lldb::ScriptedCommandInterfaceSP m_cmd_interface_sp
bool m_fetched_help_short
bool IsRemovable() const override
ScriptedCommandSynchronicity GetSynchronicity()
void DoExecute(llvm::StringRef raw_command_line, CommandReturnObject &result) override
A command line argument class.
void Shift()
Shifts the first argument C string value of the array off the argument array.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
llvm::ArrayRef< ArgEntry > entries() const
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
bool GetCommandString(std::string &command) const
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
static void CompleteModifiableCmdPathArgs(CommandInterpreter &interpreter, CompletionRequest &request, OptionElementVector &opt_element_vector)
This completer works for commands whose only arguments are a command path.
void SetStopOnContinue(bool stop_on_continue)
void SetSilent(bool silent)
void SetPrintErrors(bool print_errors)
void SetEchoCommands(bool echo_commands)
void SetStopOnError(bool stop_on_error)
void SetPrintResults(bool print_results)
void SetEchoCommentCommands(bool echo_comments)
@ eCommandTypesUserDef
scripted commands
CommandObjectMultiword * VerifyUserMultiwordCmdPath(Args &path, bool leaf_is_command, Status &result)
Look up the command pointed to by path encoded in the arguments of the incoming command object.
Status AddUserCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
bool GetRequireCommandOverwrite() const
lldb::CommandObjectSP GetCommandSPExact(llvm::StringRef cmd, bool include_aliases=false) const
ExecutionContext GetExecutionContext(bool adopt_dummy_target=true) const
Returns the execution context the interpreter should run a command in.
bool RemoveUserMultiword(llvm::StringRef multiword_name)
FileSpec GetCurrentSourceDir()
static void GenerateAdditionalHelpAvenuesMessage(Stream *s, llvm::StringRef command, llvm::StringRef prefix, llvm::StringRef subcommand, bool include_upropos=true, bool include_type_lookup=true)
~CommandObjectMultiwordCommands() override
CommandObjectMultiwordCommands(CommandInterpreter &interpreter)
llvm::Error LoadUserSubcommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj, bool can_replace) override
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
llvm::Error RemoveUserSubcommand(llvm::StringRef cmd_name, bool multiword_okay)
CommandObjectMultiword(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
friend class CommandInterpreter
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
std::vector< CommandArgumentData > CommandArgumentEntry
virtual void SetHelpLong(llvm::StringRef str)
virtual bool WantsRawCommandString()=0
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
virtual llvm::StringRef GetHelpLong()
llvm::StringRef GetCommandName() const
static std::optional< ArgumentRepetitionType > ArgRepetitionFromString(llvm::StringRef string)
virtual bool IsMultiwordObject()
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
CommandObject(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
Flags & GetFlags()
The flags accessor.
virtual void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector)
The default version handles argument definitions that have only one argument type,...
virtual bool IsRemovable() const
virtual llvm::StringRef GetHelp()
virtual void SetHelp(llvm::StringRef str)
virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches=nullptr)
void AppendError(llvm::StringRef in_string)
llvm::StringRef GetOutputString() const
void AppendWarningWithFormatv(const char *format, Args &&...args)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
lldb::ReturnStatus GetStatus() const
void AppendWarning(llvm::StringRef in_string)
void AppendErrorWithFormatv(const char *format, Args &&...args)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
const Args & GetParsedLine() const
size_t GetCursorCharPos() const
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
size_t GetCursorIndex() const
CommandInterpreter & GetCommandInterpreter()
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
lldb::StreamUP GetAsyncOutputStream()
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool IsRelative() const
Returns true if the filespec represents a relative path.
void MakeAbsolute(const FileSpec &dir)
Make the FileSpec absolute by treating it relative to dir.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
IOHandlerDelegateMultiline(llvm::StringRef end_line, Completion completion=Completion::None)
A delegate class for use with IOHandler subclasses.
lldb::LockableStreamFileSP GetErrorStreamFileSP()
lldb::LockableStreamFileSP GetOutputStreamFileSP()
LoadScriptOptions & SetInitSession(bool b)
LoadScriptOptions & SetSilent(bool b)
A command line option parsing protocol class.
virtual void HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request, OptionElementVector &opt_element_vector, int opt_element_index, CommandInterpreter &interpreter)
Handles the generic bits of figuring out whether we are in an option, and if so completing it.
virtual Status OptionParsingFinished(ExecutionContext *execution_context)
virtual llvm::ArrayRef< OptionDefinition > GetDefinitions()
std::vector< Option > m_getopt_table
virtual lldb::ScriptedCommandInterfaceSP CreateScriptedCommandInterface()
virtual bool RunScriptBasedCommand(const char *impl_function, llvm::StringRef args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
virtual bool GenerateScriptAliasFunction(StringList &input, std::string &output)
virtual bool GetDocumentationForItem(const char *item, std::string &dest)
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t SplitIntoLines(const std::string &lines)
ObjectSP GetItemAtIndex(size_t idx) const
bool ForEach(std::function< bool(Object *object)> const &foreach_callback) const
std::optional< llvm::StringRef > GetItemAtIndexAsString(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
void ForEach(std::function< bool(llvm::StringRef key, Object *object)> const &callback) const
Dictionary * GetAsDictionary()
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
Integer< uint64_t > UnsignedInteger
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
std::shared_ptr< OptionArgVector > OptionArgVectorSP
@ Partial
The current token has been partially completed.
@ Normal
The current token has been completed.
ScriptedCommandSynchronicity
@ eScriptedCommandSynchronicitySynchronous
std::shared_ptr< lldb_private::IOHandler > IOHandlerSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
std::shared_ptr< lldb_private::ScriptedCommandInterface > ScriptedCommandInterfaceSP
std::shared_ptr< lldb_private::LockableStreamFile > LockableStreamFileSP
OptionEnumValueElement element
EnumValueStorage(const EnumValueStorage &in)
EnumValueStorage & operator=(const EnumValueStorage &in)
void SetElement(size_t in_value)
EnumValueStorage(std::string in_str_val, std::string in_usage, size_t in_value)
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
OptionValidator * validator
If non-NULL, option is valid iff |validator->IsValid()|, otherwise always valid.
const char * long_option
Full name for this option.
const char * usage_text
Full text explaining what this options does and what (if any) argument to pass it.
bool required
This option is required (in the current usage level).
uint32_t completion_type
The kind of completion for this option.
int option_has_arg
no_argument, required_argument or optional_argument
uint32_t usage_mask
Used to mark options that can be used together.
lldb::CommandArgumentType argument_type
Type of argument this option takes.
OptionEnumValues enum_values
If not empty, an array of enum values.
int short_option
Single character for this option.