26#include "llvm/ADT/StringRef.h"
34#define LLDB_OPTIONS_source
35#include "CommandOptions.inc"
41 interpreter,
"command source",
42 "Read and execute LLDB commands from the file <filename>.",
50 uint32_t index)
override {
51 return std::string(
"");
70 switch (short_option) {
88 llvm_unreachable(
"Unimplemented option");
102 return llvm::ArrayRef(g_source_options);
116 "'%s' takes exactly one executable filename argument.\n",
125 result.
AppendError(
"command source -C can only be specified "
126 "from a command file");
132 FileSpec cmd_file(command[0].ref());
136 result.
AppendError(
"command source -C can only be used "
137 "with a relative path.");
175#pragma mark CommandObjectCommandsAlias
178#define LLDB_OPTIONS_alias
179#include "CommandOptions.inc"
182 "Enter your Python command(s). Type 'DONE' to end.\n"
183 "You must define a Python function with this signature:\n"
184 "def my_command_impl(debugger, args, exe_ctx, result, internal_dict):\n";
195 return llvm::ArrayRef(g_alias_options);
202 const int short_option =
GetDefinitions()[option_idx].short_option;
203 std::string option_str(option_value);
205 switch (short_option) {
217 llvm_unreachable(
"Unimplemented option");
240 interpreter,
"command alias",
241 "Define a custom command in terms of an existing command.") {
246 "'alias' allows the user to create a short-cut or abbreviation for long \
247commands, multi-word commands, and commands that take particular options. \
248Below are some simple examples of how one might use the 'alias' command:"
251(lldb) command alias sc script
253 Creates the abbreviation 'sc' for the 'script' command.
255(lldb) command alias bp breakpoint
258 " Creates the abbreviation 'bp' for the 'breakpoint' command. Since \
259breakpoint commands are two-word commands, the user would still need to \
260enter the second word after 'bp', e.g. 'bp enable' or 'bp delete'."
263(lldb) command alias bpl breakpoint list
265 Creates the abbreviation 'bpl' for the two-word command 'breakpoint list'.
268 "An alias can include some options for the command, with the values either \
269filled in at the time the alias is created, or specified as positional \
270arguments, to be filled in when the alias is invoked. The following example \
271shows how to create aliases with options:"
274(lldb) command alias bfl breakpoint set -f %1 -l %2
277 " Creates the abbreviation 'bfl' (for break-file-line), with the -f and -l \
278options already part of the alias. So if the user wants to set a breakpoint \
279by file and line without explicitly having to use the -f and -l options, the \
280user can now use 'bfl' instead. The '%1' and '%2' are positional placeholders \
281for the actual arguments that will be passed when the alias command is used. \
282The number in the placeholder refers to the position/order the actual value \
283occupies when the alias is used. All the occurrences of '%1' in the alias \
284will be replaced with the first argument, all the occurrences of '%2' in the \
285alias will be replaced with the second argument, and so on. This also allows \
286actual arguments to be used multiple times within an alias (see 'process \
287launch' example below)."
291 "Note: the positional arguments must substitute as whole words in the resultant \
292command, so you can't at present do something like this to append the file extension \
296(lldb) command alias bcppfl breakpoint set -f %1.cpp -l %2
299 "For more complex aliasing, use the \"command regex\" command instead. In the \
300'bfl' case above, the actual file value will be filled in with the first argument \
301following 'bfl' and the actual line number value will be filled in with the second \
302argument. The user would use this alias as follows:"
305(lldb) command alias bfl breakpoint set -f %1 -l %2
306(lldb) bfl my-file.c 137
308This would be the same as if the user had entered 'breakpoint set -f my-file.c -l 137'.
312(lldb) command alias pltty process launch -s -o %1 -e %1
313(lldb) pltty /dev/tty0
315 Interpreted as 'process launch -s -o /dev/tty0 -e /dev/tty0'
318 "If the user always wanted to pass the same value to a particular option, the \
319alias could be defined with that value directly in the alias as a constant, \
320rather than using a positional placeholder:"
323(lldb) command alias bl3 breakpoint set -f %1 -l 3
325 Always sets a breakpoint on line 3 of whatever file is indicated.
329 "If the alias abbreviation or the full alias command collides with another \
330existing command, the command resolver will prefer to use the alias over any \
331other command as far as there is only one alias command match.");
346 arg1.push_back(alias_arg);
354 arg2.push_back(cmd_arg);
362 arg3.push_back(options_arg);
373 void DoExecute(llvm::StringRef raw_command_line,
375 if (raw_command_line.empty()) {
376 result.
AppendError(
"'command alias' requires at least two arguments");
385 if (args_with_suffix.HasArgs())
390 llvm::StringRef raw_command_string = args_with_suffix.GetRawPart();
391 Args args(raw_command_string);
393 if (args.GetArgumentCount() < 2) {
394 result.
AppendError(
"'command alias' requires at least two arguments");
400 auto alias_command = args[0].ref();
401 if (alias_command.starts_with(
"-")) {
402 result.
AppendError(
"aliases starting with a dash are not supported");
403 if (alias_command ==
"--help" || alias_command ==
"--long-help") {
404 result.
AppendWarning(
"if trying to pass options to 'command alias' add "
405 "a -- at the end of the options");
412 size_t pos = raw_command_string.find(alias_command);
414 raw_command_string = raw_command_string.substr(alias_command.size());
415 pos = raw_command_string.find_first_not_of(
' ');
416 if ((pos != std::string::npos) && (pos > 0))
417 raw_command_string = raw_command_string.substr(pos);
419 result.
AppendError(
"Error parsing command string. No alias created.");
426 "'%s' is a permanent debugger command and cannot be redefined.\n",
433 "'%s' is a user container command and cannot be overwritten.\n"
434 "Delete it first with 'command container delete'\n",
442 llvm::StringRef original_raw_command_string = raw_command_string;
448 "'%s' does not begin with a valid command."
449 " No alias created.",
450 original_raw_command_string.str().c_str());
463 llvm::StringRef raw_command_string,
471 const bool include_aliases =
true;
479 cmd_obj_sp = cmd_obj.shared_from_this();
484 "Overwriting existing definition for '%s'.\n",
485 alias_command.str().c_str());
488 alias_command, cmd_obj_sp, raw_command_string)) {
495 result.
AppendError(
"Unable to create requested alias.\n");
504 result.
AppendError(
"'command alias' requires at least two arguments");
509 const std::string alias_command(std::string(args[0].ref()));
510 const std::string actual_command(std::string(args[1].ref()));
520 "'%s' is a permanent debugger command and cannot be redefined.\n",
521 alias_command.c_str());
527 "'%s' is user container command and cannot be overwritten.\n"
528 "Delete it first with 'command container delete'",
529 alias_command.c_str());
536 bool use_subcommand =
false;
537 if (!command_obj_sp) {
539 actual_command.c_str());
548 auto sub_command = args[0].ref();
549 assert(!sub_command.empty());
551 if (!subcommand_obj_sp) {
553 "'%s' is not a valid sub-command of '%s'. "
554 "Unable to create alias.\n",
555 args[0].c_str(), actual_command.c_str());
559 sub_cmd_obj = subcommand_obj_sp.get();
560 use_subcommand =
true;
562 cmd_obj = sub_cmd_obj;
567 std::string args_string;
581 "Overwriting existing definition for '%s'.\n", alias_command.c_str());
585 alias_command, use_subcommand ? subcommand_obj_sp : command_obj_sp,
593 result.
AppendError(
"Unable to create requested alias.\n");
601#pragma mark CommandObjectCommandsUnalias
608 interpreter,
"command unalias",
609 "Delete one or more custom commands defined by 'command alias'.",
629 CommandObject::CommandMap::iterator pos;
633 result.
AppendError(
"must call 'unalias' with a valid alias");
637 auto command_name = args[0].ref();
641 "'%s' is not a known command.\nTry 'help' to see a "
642 "current list of commands.\n",
650 "'%s' is not an alias, it is a debugger command which can be "
651 "removed using the 'command delete' command.\n",
655 "'%s' is a permanent debugger command and cannot be removed.\n",
664 "Error occurred while attempting to unalias '%s'.\n",
676#pragma mark CommandObjectCommandsDelete
683 interpreter,
"command delete",
684 "Delete one or more custom commands defined by 'command regex'.",
698 if (ent.second->IsRemovable())
705 CommandObject::CommandMap::iterator pos;
709 "defined regular expression command names",
714 auto command_name = args[0].ref();
717 const bool generate_upropos =
true;
718 const bool generate_type_lookup =
false;
720 &error_msg_stream, command_name, llvm::StringRef(), llvm::StringRef(),
721 generate_upropos, generate_type_lookup);
728 "'%s' is a permanent debugger command and cannot be removed.\n",
739#define LLDB_OPTIONS_regex
740#include "CommandOptions.inc"
742#pragma mark CommandObjectCommandsAddRegex
749 interpreter,
"command regex",
750 "Define a custom command in terms of "
751 "existing commands by matching "
752 "regular expressions.",
753 "command regex <cmd-name> [s/<regex>/<subst>/ ...]"),
759 "This command allows the user to create powerful regular expression commands \
760with substitutions. The regular expressions and substitutions are specified \
761using the regular expression substitution format of:"
767 "<regex> is a regular expression that can use parenthesis to capture regular \
768expression input and substitute the captured matches in the output using %1 \
769for the first match, %2 for the second, and so on."
773 "The regular expressions can all be specified on the command line if more than \
774one argument is provided. If just the command name is provided on the command \
775line, then the regular expressions and substitutions can be entered on separate \
776lines, followed by an empty line to terminate the command definition."
782 "The following example will define a regular expression command named 'f' that \
783will call 'finish' if there are no arguments, or 'frame select <frame-idx>' if \
784a number follows 'f':"
787 (lldb) command regex f s/^$/finish/ 's/([0-9]+)/frame select %1/')");
796 if (output_sp && interactive) {
797 output_sp->PutCString(
"Enter one or more sed substitution commands in "
798 "the form: 's/<regex>/<subst>/'.\nTerminate the "
799 "substitution list with an empty line.\n");
805 std::string &data)
override {
810 bool check_only =
false;
811 for (
const std::string &line : lines) {
816 out_stream->Printf(
"error: %s\n",
error.AsCString());
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()) {
881 error.SetErrorStringWithFormat(
882 "invalid regular expression command object for: '%.*s'",
883 (
int)regex_sed.size(), regex_sed.data());
887 size_t regex_sed_size = regex_sed.size();
889 if (regex_sed_size <= 1) {
890 error.SetErrorStringWithFormat(
891 "regular expression substitution string is too short: '%.*s'",
892 (
int)regex_sed.size(), regex_sed.data());
896 if (regex_sed[0] !=
's') {
897 error.SetErrorStringWithFormat(
"regular expression substitution string "
898 "doesn't start with 's': '%.*s'",
899 (
int)regex_sed.size(), regex_sed.data());
902 const size_t first_separator_char_pos = 1;
905 const char separator_char = regex_sed[first_separator_char_pos];
906 const size_t second_separator_char_pos =
907 regex_sed.find(separator_char, first_separator_char_pos + 1);
909 if (second_separator_char_pos == std::string::npos) {
910 error.SetErrorStringWithFormat(
911 "missing second '%c' separator char after '%.*s' in '%.*s'",
913 (
int)(regex_sed.size() - first_separator_char_pos - 1),
914 regex_sed.data() + (first_separator_char_pos + 1),
915 (
int)regex_sed.size(), regex_sed.data());
919 const size_t third_separator_char_pos =
920 regex_sed.find(separator_char, second_separator_char_pos + 1);
922 if (third_separator_char_pos == std::string::npos) {
923 error.SetErrorStringWithFormat(
924 "missing third '%c' separator char after '%.*s' in '%.*s'",
926 (
int)(regex_sed.size() - second_separator_char_pos - 1),
927 regex_sed.data() + (second_separator_char_pos + 1),
928 (
int)regex_sed.size(), regex_sed.data());
932 if (third_separator_char_pos != regex_sed_size - 1) {
934 if (regex_sed.find_first_not_of(
"\t\n\v\f\r ",
935 third_separator_char_pos + 1) !=
937 error.SetErrorStringWithFormat(
938 "extra data found after the '%.*s' regular expression substitution "
940 (
int)third_separator_char_pos + 1, regex_sed.data(),
941 (
int)(regex_sed.size() - third_separator_char_pos - 1),
942 regex_sed.data() + (third_separator_char_pos + 1));
945 }
else if (first_separator_char_pos + 1 == second_separator_char_pos) {
946 error.SetErrorStringWithFormat(
947 "<regex> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
948 separator_char, separator_char, separator_char, (
int)regex_sed.size(),
951 }
else if (second_separator_char_pos + 1 == third_separator_char_pos) {
952 error.SetErrorStringWithFormat(
953 "<subst> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
954 separator_char, separator_char, separator_char, (
int)regex_sed.size(),
960 std::string regex(std::string(regex_sed.substr(
961 first_separator_char_pos + 1,
962 second_separator_char_pos - first_separator_char_pos - 1)));
963 std::string subst(std::string(regex_sed.substr(
964 second_separator_char_pos + 1,
965 third_separator_char_pos - second_separator_char_pos - 1)));
983 class CommandOptions :
public Options {
994 switch (short_option) {
996 m_help.assign(std::string(option_arg));
999 m_syntax.assign(std::string(option_arg));
1002 llvm_unreachable(
"Unimplemented option");
1014 return llvm::ArrayRef(g_regex_options);
1036 std::string funct, std::string help,
1045 stream.
Printf(
"For more information run 'help %s'", name.c_str());
1060 return CommandObjectRaw::GetHelpLong();
1064 return CommandObjectRaw::GetHelpLong();
1066 std::string docstring;
1069 if (!docstring.empty())
1071 return CommandObjectRaw::GetHelpLong();
1130 stream.
Printf(
"For more information run 'help %s'", name.c_str());
1133 GetFlags().
Set(scripter->GetFlagsForCommandObject(cmd_obj_sp));
1152 uint32_t index)
override {
1155 return std::nullopt;
1162 return CommandObjectRaw::GetHelp();
1165 return CommandObjectRaw::GetHelp();
1166 std::string docstring;
1169 if (!docstring.empty())
1172 return CommandObjectRaw::GetHelp();
1177 return CommandObjectRaw::GetHelpLong();
1181 return CommandObjectRaw::GetHelpLong();
1183 std::string docstring;
1186 if (!docstring.empty())
1188 return CommandObjectRaw::GetHelpLong();
1252 error.SetErrorString(
"No script interpreter for SetOptionValue.");
1256 error.SetErrorString(
"SetOptionValue called with empty cmd_obj.");
1260 error.SetErrorString(
"SetOptionValue called before options definitions "
1267 const char * long_option =
1270 execution_context, long_option, option_arg);
1272 error.SetErrorStringWithFormatv(
"Error setting option: {0} to {1}",
1273 long_option, option_arg);
1293 size_t counter, uint32_t &usage_mask) {
1312 uint32_t value = uint_val->
GetValue();
1314 error.SetErrorStringWithFormatv(
1315 "0 is not a valid group for option {0}", counter);
1318 usage_mask = (1 << (value - 1));
1324 error.SetErrorStringWithFormatv(
1325 "required field is not a array for option {0}", counter);
1330 auto groups_accumulator
1331 = [counter, &usage_mask, &
error]
1335 uint32_t value = int_val->
GetValue();
1337 error.SetErrorStringWithFormatv(
1338 "0 is not a valid group for element {0}", counter);
1341 usage_mask |= (1 << (value - 1));
1346 error.SetErrorStringWithFormatv(
1347 "Group element not an int or array of integers for element {0}",
1351 size_t num_range_elem = arr_val->
GetSize();
1352 if (num_range_elem != 2) {
1353 error.SetErrorStringWithFormatv(
1354 "Subranges of a group not a start and a stop for element {0}",
1360 error.SetErrorStringWithFormatv(
"Start element of a subrange of a "
1361 "group not unsigned int for element {0}", counter);
1364 uint32_t start = int_val->
GetValue();
1367 error.SetErrorStringWithFormatv(
"End element of a subrange of a group"
1368 " not unsigned int for element {0}", counter);
1371 uint32_t end = int_val->
GetValue();
1372 if (start == 0 || end == 0 || start > end) {
1373 error.SetErrorStringWithFormatv(
"Invalid subrange of a group: {0} - "
1374 "{1} for element {2}", start, end, counter);
1377 for (uint32_t i = start; i <= end; i++) {
1378 usage_mask |= (1 << (i - 1));
1382 array_val->
ForEach(groups_accumulator);
1398 size_t short_opt_counter = 0;
1400 auto add_element = [
this, &
error, &counter, &short_opt_counter]
1404 error.SetErrorString(
"Value in options dictionary is not a dictionary");
1435 error.SetErrorStringWithFormatv(
"'required' field is not a boolean "
1436 "for option {0}", counter);
1447 llvm::StringRef short_str = obj_sp->GetStringValue();
1448 if (short_str.empty()) {
1449 error.SetErrorStringWithFormatv(
"short_option field empty for "
1450 "option {0}", counter);
1452 }
else if (short_str.size() != 1) {
1453 error.SetErrorStringWithFormatv(
"short_option field has extra "
1454 "characters for option {0}", counter);
1457 short_option = (int) short_str[0];
1461 short_option = short_opt_counter++;
1466 if (long_option.empty()) {
1467 error.SetErrorStringWithFormatv(
"empty long_option for option {0}",
1472 option_def.
long_option = ((*(inserted.first)).data());
1480 error.SetErrorStringWithFormatv(
"Value type must be an unsigned "
1484 uint64_t val_type = uint_val->
GetValue();
1486 error.SetErrorStringWithFormatv(
"Value type {0} beyond the "
1487 "CommandArgumentType bounds", val_type);
1502 error.SetErrorStringWithFormatv(
"Completion type must be an "
1503 "unsigned integer for option {0}", counter);
1506 uint64_t completion_type = uint_val->
GetValue();
1508 error.SetErrorStringWithFormatv(
"Completion type for option {0} "
1509 "beyond the CompletionType bounds", completion_type);
1517 std::string usage_text;
1520 error.SetErrorStringWithFormatv(
"required usage missing from option "
1524 llvm::StringRef usage_stref;
1525 usage_stref = obj_sp->GetStringValue();
1526 if (usage_stref.empty()) {
1527 error.SetErrorStringWithFormatv(
"empty usage text for option {0}",
1540 error.SetErrorStringWithFormatv(
"enum values must be an array for "
1541 "option {0}", counter);
1544 size_t num_elem = array->
GetSize();
1545 size_t enum_ctr = 0;
1546 m_enum_storage[counter] = std::vector<EnumValueStorage>(num_elem);
1547 std::vector<EnumValueStorage> &curr_elem =
m_enum_storage[counter];
1553 auto add_enum = [&enum_ctr, &curr_elem, counter, &
error]
1557 error.SetErrorStringWithFormatv(
"Enum values for option {0} not "
1558 "an array", counter);
1561 size_t num_enum_elements = enum_arr->
GetSize();
1562 if (num_enum_elements != 2) {
1563 error.SetErrorStringWithFormatv(
"Wrong number of elements: {0} "
1564 "for enum {1} in option {2}",
1565 num_enum_elements, enum_ctr, counter);
1570 llvm::StringRef val_stref = obj_sp->GetStringValue();
1571 std::string value_cstr_str = val_stref.str().c_str();
1576 error.SetErrorStringWithFormatv(
"No usage for enum {0} in option "
1577 "{1}", enum_ctr, counter);
1580 llvm::StringRef usage_stref = obj_sp->GetStringValue();
1581 std::string usage_cstr_str = usage_stref.str().c_str();
1583 usage_cstr_str, enum_ctr);
1590 if (!
error.Success())
1594 for (
auto &elem : curr_elem)
1618 size_t in_value) :
value(std::move(in_str_val)),
usage(std::move(in_usage)) {
1671 interpreter, name, cmd_obj_sp, synch));
1679 if (opt_error.
Fail())
1682 if (arg_error.
Fail())
1684 opt_error.
Fail() ?
", also " :
"",
1715 if (options_object_sp) {
1736 if (args_object_sp) {
1750 size_t elem_counter = 0;
1751 auto args_adder = [
this, counter, &elem_counter, &this_entry]
1757 uint32_t arg_opt_set_association;
1759 auto report_error = [
this, elem_counter, counter]
1760 (
const char *err_txt) ->
bool {
1762 "list element {1}: %s.", elem_counter, counter, err_txt);
1768 report_error(
"is not a dictionary.");
1778 report_error(
"value type must be an unsigned integer");
1781 uint64_t arg_type_int = uint_val->
GetValue();
1783 report_error(
"value type beyond ArgumentRepetitionType bounds");
1790 std::optional<ArgumentRepetitionType> repeat;
1792 llvm::StringRef repeat_str = obj_sp->GetStringValue();
1793 if (repeat_str.empty()) {
1794 report_error(
"repeat value is empty");
1799 report_error(
"invalid repeat value");
1802 arg_repetition = *repeat;
1808 counter, arg_opt_set_association);
1809 this_entry.emplace_back(arg_type, arg_repetition,
1810 arg_opt_set_association);
1817 "{0} is not an array", counter);
1820 args_array->
ForEach(args_adder);
1823 if (this_entry.empty()) {
1825 "{0} is empty", counter);
1833 args_array->
ForEach(arg_array_adder);
1848 uint32_t index)
override {
1851 return std::nullopt;
1858 return CommandObjectParsed::GetHelp();
1861 return CommandObjectParsed::GetHelp();
1862 std::string docstring;
1865 if (!docstring.empty())
1868 return CommandObjectParsed::GetHelp();
1873 return CommandObjectParsed::GetHelpLong();
1877 return CommandObjectParsed::GetHelpLong();
1879 std::string docstring;
1882 if (!docstring.empty())
1884 return CommandObjectParsed::GetHelpLong();
1929std::unordered_set<std::string>
1933#define LLDB_OPTIONS_script_import
1934#include "CommandOptions.inc"
1940 "Import a scripting module in LLDB.", nullptr) {
1960 switch (short_option) {
1971 llvm_unreachable(
"Unimplemented option");
1982 return llvm::ArrayRef(g_script_import_options);
1989 if (command.
empty()) {
1990 result.
AppendError(
"command script import needs one or more arguments");
1998 result.
AppendError(
"command script import -c can only be specified "
1999 "from a command file");
2004 for (
auto &entry : command.
entries()) {
2020 if (
GetDebugger().GetScriptInterpreter()->LoadScriptingModule(
2021 entry.c_str(), options,
error,
nullptr,
2034#define LLDB_OPTIONS_script_add
2035#include "CommandOptions.inc"
2042 "Add a scripted function as an LLDB command.",
2043 "Add a scripted function as an lldb command. "
2044 "If you provide a single argument, the command "
2045 "will be added at the root level of the command "
2046 "hierarchy. If there are more arguments they "
2047 "must be a path to a user-added container "
2048 "command, and the last element will be the new "
2062 opt_element_vector);
2077 switch (short_option) {
2079 if (!option_arg.empty())
2083 if (!option_arg.empty())
2087 if (!option_arg.empty())
2100 if (!
error.Success())
2101 error.SetErrorStringWithFormat(
2102 "unrecognized value for synchronicity '%s'",
2103 option_arg.str().c_str());
2111 if (!
error.Success())
2112 error.SetErrorStringWithFormat(
2113 "unrecognized value for command completion type '%s'",
2114 option_arg.str().c_str());
2118 llvm_unreachable(
"Unimplemented option");
2135 return llvm::ArrayRef(g_script_add_options);
2152 if (output_sp && interactive) {
2159 std::string &data)
override {
2167 std::string funct_name_str;
2169 if (funct_name_str.empty()) {
2170 error_sp->Printf(
"error: unable to obtain a function name, didn't "
2171 "add python command.\n");
2183 error_sp->Printf(
"error: unable to add selected command: '%s'",
2191 error_sp->Printf(
"error: unable to add selected command: '%s'",
2192 llvm::toString(std::move(llvm_error)).c_str());
2199 "error: unable to create function, didn't add python command\n");
2203 error_sp->Printf(
"error: empty function, didn't add python command\n");
2208 "error: script interpreter missing, didn't add python command\n");
2217 result.
AppendError(
"only scripting language supported for scripted "
2218 "commands is currently Python");
2223 result.
AppendError(
"'command script add' requires at least one argument");
2241 command,
true, path_error);
2243 if (path_error.
Fail()) {
2254 m_cmd_name = std::string(command[num_args - 1].ref());
2276 result.
AppendError(
"cannot find ScriptInterpreter");
2304 if (add_error.
Fail())
2308 llvm::Error llvm_error =
2312 "cannot add command: %s",
2313 llvm::toString(std::move(llvm_error)).c_str());
2333 "List defined top-level scripted commands.",
2351 "Delete all scripted commands.", nullptr) {}
2369 interpreter,
"command script delete",
2370 "Delete a scripted command by specifying the path to the command.",
2387 llvm::StringRef root_cmd = command[0].ref();
2390 if (root_cmd.empty()) {
2397 "but no user defined commands found");
2404 command[0].c_str());
2407 if (!cmd_sp->IsUserCommand()) {
2409 command[0].c_str());
2412 if (cmd_sp->GetAsMultiwordCommand() && num_args == 1) {
2414 "Delete with \"command container delete\"",
2415 command[0].c_str());
2439 command[0].c_str());
2442 const char *leaf_cmd = command[num_args - 1].c_str();
2443 llvm::Error llvm_error =
2448 "could not delete command '%s': %s", leaf_cmd,
2449 llvm::toString(std::move(llvm_error)).c_str());
2455 out_stream <<
"Deleted command:";
2456 for (
size_t idx = 0; idx < num_args; idx++) {
2458 out_stream << command[idx].c_str();
2465#pragma mark CommandObjectMultiwordCommandsScript
2473 interpreter,
"command script",
2474 "Commands for managing custom "
2475 "commands implemented by "
2476 "interpreter scripts.",
2477 "command script <subcommand> [<subcommand-options>]") {
2496#pragma mark CommandObjectCommandContainer
2497#define LLDB_OPTIONS_container_add
2498#include "CommandOptions.inc"
2504 interpreter,
"command container add",
2505 "Add a container command to lldb. Adding to built-"
2506 "in container commands is not allowed.",
2507 "command container add [[path1]...] container-name") {
2534 switch (short_option) {
2536 if (!option_arg.empty())
2543 if (!option_arg.empty())
2547 llvm_unreachable(
"Unimplemented option");
2560 return llvm::ArrayRef(g_container_add_options);
2572 if (num_args == 0) {
2577 if (num_args == 1) {
2583 cmd_sp->GetAsMultiwordCommand()->SetRemovable(
true);
2586 if (add_error.
Fail()) {
2611 llvm::Error llvm_error =
2615 llvm::toString(std::move(llvm_error)).c_str());
2626#define LLDB_OPTIONS_multiword_delete
2627#include "CommandOptions.inc"
2632 interpreter,
"command container delete",
2633 "Delete a container command previously added to "
2635 "command container delete [[path1] ...] container-cmd") {
2652 if (num_args == 0) {
2657 if (num_args == 1) {
2669 if (!cmd_sp->IsUserCommand()) {
2671 "container command %s is not a user command", cmd_name);
2674 if (!cmd_sp->GetAsMultiwordCommand()) {
2702 llvm::Error llvm_error =
2706 llvm::toString(std::move(llvm_error)).c_str());
2717 interpreter,
"command container",
2718 "Commands for adding container commands to lldb. "
2719 "Container commands are containers for other commands. You can "
2720 "add nested container commands by specifying a command path, "
2721 "but you can't add commands into the built-in command hierarchy.",
2722 "command container <subcommand> [<subcommand-options>]") {
2733#pragma mark CommandObjectMultiwordCommands
2740 "Commands for managing custom LLDB commands.",
2741 "command <subcommand> [<subcommand-options>]") {
static const char * g_python_command_instructions
static llvm::raw_ostream & error(Stream &strm)
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
StructuredData::GenericSP m_cmd_obj_sp
static Status ParseUsageMaskFromArray(StructuredData::ObjectSP obj_sp, size_t counter, uint32_t &usage_mask)
std::vector< std::string > m_usage_container
CommandInterpreter & m_interpreter
std::unique_ptr< OptionDefinition > m_options_definition_up
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
static std::unordered_set< std::string > g_string_storer
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
CommandOptions(CommandInterpreter &interpreter, StructuredData::GenericSP cmd_obj_sp)
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
std::vector< std::vector< EnumValueStorage > > m_enum_storage
Status SetOptionsFromArray(StructuredData::Dictionary &options)
This command implements a lldb parsed scripted command.
llvm::StringRef GetHelpLong() override
bool IsRemovable() const override
CommandObjectScriptingObjectParsed(CommandInterpreter &interpreter, std::string name, StructuredData::GenericSP cmd_obj_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
bool m_fetched_help_short
bool WantsCompletion() override
ScriptedCommandSynchronicity m_synchro
StructuredData::GenericSP m_cmd_obj_sp
ScriptedCommandSynchronicity GetSynchronicity()
static CommandObjectSP Create(CommandInterpreter &interpreter, std::string name, StructuredData::GenericSP cmd_obj_sp, ScriptedCommandSynchronicity synch, CommandReturnObject &result)
This class implements a "raw" scripted command.
CompletionType m_completion_type
bool WantsCompletion() override
llvm::StringRef GetHelp() override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
StructuredData::GenericSP m_cmd_obj_sp
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
bool m_fetched_help_short
bool IsRemovable() const override
CommandObjectScriptingObjectRaw(CommandInterpreter &interpreter, std::string name, StructuredData::GenericSP cmd_obj_sp, ScriptedCommandSynchronicity synch, CompletionType completion_type)
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)
bool UserMultiwordCommandExists(llvm::StringRef cmd) const
Determine whether a root-level user multiword command with this name exists.
void IncreaseCommandUsage(const CommandObject &cmd_obj)
bool RemoveAlias(llvm::StringRef alias_name)
CommandAlias * AddAlias(llvm::StringRef alias_name, lldb::CommandObjectSP &command_obj_sp, llvm::StringRef args_string=llvm::StringRef())
CommandObject * GetCommandObject(llvm::StringRef cmd, StringList *matches=nullptr, StringList *descriptions=nullptr) const
ExecutionContext GetExecutionContext() const
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.
bool GetEchoCommentCommands() const
Status AddUserCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
bool AliasExists(llvm::StringRef cmd) const
Determine whether an alias command with this name exists.
bool HasUserMultiwordCommands() const
void GetHelp(CommandReturnObject &result, uint32_t types=eCommandTypesAllThem)
bool CommandExists(llvm::StringRef cmd) const
Determine whether a root level, built-in command with this name exists.
bool GetRequireCommandOverwrite() const
void GetPythonCommandsFromIOHandler(const char *prompt, IOHandlerDelegate &delegate, void *baton=nullptr)
lldb::CommandObjectSP GetCommandSPExact(llvm::StringRef cmd, bool include_aliases=false) const
bool RemoveUser(llvm::StringRef alias_name)
CommandObject * GetCommandObjectForCommand(llvm::StringRef &command_line)
bool RemoveUserMultiword(llvm::StringRef multiword_name)
bool UserCommandExists(llvm::StringRef cmd) const
Determine whether a root-level user command with this name exists.
bool HasUserCommands() const
const CommandObject::CommandMap & GetCommands() const
void HandleCommandsFromFile(FileSpec &file, const ExecutionContext &context, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
Execute a list of commands from a file.
FileSpec GetCurrentSourceDir()
bool RemoveCommand(llvm::StringRef cmd, bool force=false)
Remove a command if it is removable (python or regex command).
const CommandObject::CommandMap & GetAliases() const
bool GetEchoCommands() const
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)
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)
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
Flags & GetFlags()
The flags accessor.
virtual bool IsRemovable() const
virtual void SetHelp(llvm::StringRef str)
virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches=nullptr)
void AppendErrorWithFormatv(const char *format, Args &&... args)
void void AppendError(llvm::StringRef in_string)
void AppendWarningWithFormat(const char *format,...) __attribute__((format(printf
llvm::StringRef GetOutputData()
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
lldb::ReturnStatus GetStatus() const
void void AppendWarning(llvm::StringRef in_string)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
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
A class to manage flag bits.
lldb::StreamSP GetAsyncOutputStream()
CommandInterpreter & GetCommandInterpreter()
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void Clear()
Clear the object's state.
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.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
static FileSystem & Instance()
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
A delegate class for use with IOHandler subclasses.
lldb::StreamFileSP GetErrorStreamFileSP()
lldb::StreamFileSP GetOutputStreamFileSP()
LoadScriptOptions & SetInitSession(bool b)
LoadScriptOptions & SetSilent(bool b)
void Append(OptionGroup *group)
Append options from a OptionGroup class.
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
bool GetCurrentValue() const
const char * GetCurrentValue() const
Status SetCurrentValue(llvm::StringRef value)
bool OptionWasSet() const
A pair of an option list with a 'raw' string as a suffix.
A command line option parsing protocol class.
void NotifyOptionParsingStarting(ExecutionContext *execution_context)
std::vector< Option > m_getopt_table
virtual bool SetOptionValueForCommandObject(StructuredData::GenericSP cmd_obj_sp, ExecutionContext *exe_ctx, llvm::StringRef long_option, llvm::StringRef value)
virtual StructuredData::GenericSP CreateScriptCommandObject(const char *class_name)
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 std::optional< std::string > GetRepeatCommandForScriptedCommand(StructuredData::GenericSP impl_obj_sp, Args &args)
virtual bool GetDocumentationForItem(const char *item, std::string &dest)
virtual bool RunScriptBasedParsedCommand(StructuredData::GenericSP impl_obj_sp, Args &args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
virtual StructuredData::ObjectSP GetOptionsForCommandObject(StructuredData::GenericSP cmd_obj_sp)
virtual StructuredData::ObjectSP GetArgumentsForCommandObject(StructuredData::GenericSP cmd_obj_sp)
virtual void OptionParsingStartedForCommandObject(StructuredData::GenericSP cmd_obj_sp)
virtual bool GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string &dest)
virtual uint32_t GetFlagsForCommandObject(StructuredData::GenericSP cmd_obj_sp)
virtual bool GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string &dest)
void SetErrorStringWithFormatv(const char *format, Args &&... args)
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.
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
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 SplitIntoLines(const std::string &lines)
ObjectSP GetItemAtIndex(size_t idx) const
bool ForEach(std::function< bool(Object *object)> const &foreach_callback) const
ObjectSP GetValueForKey(llvm::StringRef key) const
void ForEach(std::function< bool(llvm::StringRef key, Object *object)> const &callback) const
Dictionary * GetAsDictionary()
UnsignedInteger * GetAsUnsignedInteger()
std::shared_ptr< Generic > GenericSP
std::shared_ptr< Object > ObjectSP
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
std::shared_ptr< OptionArgVector > OptionArgVectorSP
ScriptedCommandSynchronicity
@ eScriptedCommandSynchronicitySynchronous
std::vector< std::tuple< std::string, int, std::string > > OptionArgVector
std::shared_ptr< lldb_private::IOHandler > IOHandlerSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::Stream > StreamSP
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
std::shared_ptr< lldb_private::StreamFile > StreamFileSP
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.
const char * string_value