15#include "lldb/Host/Config.h"
36#include "llvm/ADT/STLExtras.h"
84 for (
auto entry : llvm::enumerate(command.
entries().drop_back())) {
85 if (entry.value().ref() !=
"unsigned")
87 auto next = command.
entries()[entry.index() + 1].ref();
88 if (next ==
"int" || next ==
"short" || next ==
"char" || next ==
"long") {
90 "unsigned %s being treated as two types. if you meant the combined "
92 "name use quotes, as in \"unsigned %s\"\n",
93 next.str().c_str(), next.str().c_str());
108 return "synthetic child provider";
113 llvm_unreachable(
"Fully covered switch above!");
116#define LLDB_OPTIONS_type_summary_add
117#include "CommandOptions.inc"
134 return llvm::ArrayRef(g_type_summary_add_options);
163 static const char *g_summary_addreader_instructions =
164 "Enter your Python command(s). Type 'DONE' to end.\n"
165 "def function (valobj,internal_dict):\n"
166 " \"\"\"valobj: an SBValue which you want to provide a summary "
168 " internal_dict: an LLDB support object not to be used\"\"\"\n";
171 if (output_sp && interactive) {
172 output_sp->PutCString(g_summary_addreader_instructions);
178 std::string &data)
override {
181#if LLDB_ENABLE_PYTHON
196 std::string funct_name_str;
199 if (funct_name_str.empty()) {
200 error_sp->Printf(
"unable to obtain a valid function name from "
201 "the script interpreter.\n");
208 script_format = std::make_shared<ScriptSummaryFormat>(
209 options->m_flags, funct_name_str.c_str(),
214 for (
const std::string &type_name : options->m_target_types) {
216 options->m_match_type, options->m_category,
219 error_sp->Printf(
"error: %s",
error.AsCString());
224 if (options->m_name) {
226 options->m_name, script_format, &
error);
229 options->m_name, script_format, &
error);
231 error_sp->Printf(
"error: %s",
error.AsCString());
235 error_sp->Printf(
"error: %s",
error.AsCString());
239 if (
error.AsCString()) {
240 error_sp->Printf(
"error: %s",
error.AsCString());
246 error_sp->Printf(
"error: unable to generate a function.\n");
250 error_sp->Printf(
"error: no script interpreter.\n");
254 error_sp->Printf(
"error: internal synchronization information "
255 "missing or invalid.\n");
259 error_sp->Printf(
"error: empty function, didn't add python command.\n");
264 "error: script interpreter missing, didn't add python command.\n");
283 "Enter your Python command(s). Type 'DONE' to end.\n"
284 "You must define a Python class with these methods:\n"
285 " def __init__(self, valobj, internal_dict):\n"
286 " def num_children(self):\n"
287 " def get_child_at_index(self, index):\n"
288 " def get_child_index(self, name):\n"
289 " def update(self):\n"
291 "class synthProvider:\n";
293#define LLDB_OPTIONS_type_synth_add
294#include "CommandOptions.inc"
311 switch (short_option) {
315 error.SetErrorStringWithFormat(
"invalid value for cascade: %s",
316 option_arg.str().c_str());
336 error.SetErrorString(
337 "can't use --regex and --recognizer-function at the same time");
343 error.SetErrorString(
344 "can't use --regex and --recognizer-function at the same time");
349 llvm_unreachable(
"Unimplemented option");
367 return llvm::ArrayRef(g_type_synth_add_options);
400 result.
AppendError(
"must either provide a children list, a Python class "
401 "name, or use -P and type a Python class "
408 if (output_sp && interactive) {
415 std::string &data)
override {
418#if LLDB_ENABLE_PYTHON
433 std::string class_name_str;
435 if (class_name_str.empty()) {
437 "error: unable to obtain a proper name for the class.\n");
444 synth_provider = std::make_shared<ScriptedSyntheticChildren>(
446 .SetCascades(options->m_cascade)
449 class_name_str.c_str());
453 ConstString(options->m_category.c_str()), category);
457 for (
const std::string &type_name : options->m_target_types) {
458 if (!type_name.empty()) {
460 options->m_match_type, options->m_category,
462 error_sp->Printf(
"error: %s\n",
error.AsCString());
467 error_sp->Printf(
"error: invalid type name.\n");
474 error_sp->Printf(
"error: unable to generate a class.\n");
478 error_sp->Printf(
"error: no script interpreter.\n");
482 error_sp->Printf(
"error: internal synchronization data missing.\n");
486 error_sp->Printf(
"error: empty function, didn't add python command.\n");
491 "error: script interpreter missing, didn't add python command.\n");
511#define LLDB_OPTIONS_type_format_add
512#include "CommandOptions.inc"
523 return llvm::ArrayRef(g_type_format_add_options);
538 const int short_option =
539 g_type_format_add_options[option_idx].short_option;
542 switch (short_option) {
546 error.SetErrorStringWithFormat(
"invalid value for cascade: %s",
547 option_value.str().c_str());
565 llvm_unreachable(
"Unimplemented option");
590 "Add a new formatting style for a type.", nullptr),
598 type_arg.push_back(type_style_arg);
604The following examples of 'type format add' refer to this code snippet for context:
607 typedef float Afloat;
609 typedef Afloat Bfloat;
617Adding default formatting:
619(lldb) type format add -f hex AInt
620(lldb) frame variable iy
623 " Produces hexadecimal display of iy, because no formatter is available for Bint and \
624the one for Aint is used instead."
627To prevent this use the cascade option '-C no' to prevent evaluation of typedef chains:
630(lldb) type format add -f hex -C no AInt
632Similar reasoning applies to this:
634(lldb) type format add -f hex -C no float -p
637 " All float values and float references are now formatted as hexadecimal, but not \
638pointers to floats. Nor will it change the default display for Afloat and Bfloat objects.");
671 entry = std::make_shared<TypeFormatImpl_Format>(
677 entry = std::make_shared<TypeFormatImpl_EnumType>(
694 for (
auto &arg_entry : command.
entries()) {
695 if (arg_entry.ref().empty()) {
704 if (!typeRX.IsValid()) {
706 "regex format error (maybe this is not really a regex?)");
710 category_sp->AddTypeFormat(arg_entry.ref(), match_type, entry);
717#define LLDB_OPTIONS_type_formatter_delete
718#include "CommandOptions.inc"
733 switch (short_option) {
744 llvm_unreachable(
"Unimplemented option");
757 return llvm::ArrayRef(g_type_formatter_delete_options);
773 "Delete an existing %s for a type.";
776 "Delete an existing %s for a type. Unless you specify a "
777 "specific category or all categories, only the "
778 "'default' category is searched. The names must be exactly as "
779 "shown in the 'type %s list' output";
793 type_arg.push_back(type_style_arg);
807 s.
Printf(
"type %s delete", short_kind);
855 bool delete_category =
false;
856 bool extra_deletion =
false;
874 if (delete_category || extra_deletion) {
882#define LLDB_OPTIONS_type_formatter_clear
883#include "CommandOptions.inc"
898 switch (short_option) {
903 llvm_unreachable(
"Unimplemented option");
914 return llvm::ArrayRef(g_type_formatter_clear_options);
929 const char *name,
const char *help)
985 "Delete all existing format styles.") {}
988#define LLDB_OPTIONS_type_formatter_list
989#include "CommandOptions.inc"
991template <
typename FormatterType>
1008 switch (short_option) {
1015 if (
error.Success())
1019 llvm_unreachable(
"Unimplemented option");
1031 return llvm::ArrayRef(g_type_formatter_list_options);
1046 const char *name,
const char *help)
1054 type_arg.push_back(type_style_arg);
1072 return regex ==
nullptr || s == regex->
GetText() || regex->
Execute(s);
1078 std::unique_ptr<RegularExpression> category_regex;
1079 std::unique_ptr<RegularExpression> formatter_regex;
1082 category_regex = std::make_unique<RegularExpression>(
1084 if (!category_regex->IsValid()) {
1086 "syntax error in category regular expression '%s'",
1094 formatter_regex = std::make_unique<RegularExpression>(arg);
1095 if (!formatter_regex->IsValid()) {
1102 bool any_printed =
false;
1104 auto category_closure =
1105 [&result, &formatter_regex,
1108 "-----------------------\nCategory: %s%s\n-----------------------\n",
1109 category->GetName(), category->IsEnabled() ?
"" :
" (disabled)");
1112 [&result, &formatter_regex,
1116 formatter_regex.get())) {
1119 "%s: %s\n", type_matcher.GetMatchString().GetCString(),
1120 format_sp->GetDescription().c_str());
1124 category->ForEach(print_formatter);
1132 category_closure(category_sp);
1135 [&category_regex, &category_closure](
1138 category_closure(category);
1162 "Show a list of current formats.") {}
1166 uint32_t option_idx, llvm::StringRef option_arg,
1172 switch (short_option) {
1176 error.SetErrorStringWithFormat(
"invalid value for cascade: %s",
1177 option_arg.str().c_str());
1202 error.SetErrorString(
1203 "can't use --regex and --recognizer-function at the same time");
1209 error.SetErrorString(
1210 "can't use --regex and --recognizer-function at the same time");
1235 llvm_unreachable(
"Unimplemented option");
1243 m_flags.
Clear().SetCascades().SetDontShowChildren().SetDontShowValue(
false);
1244 m_flags.SetShowMembersOneLiner(
false)
1245 .SetSkipPointers(
false)
1246 .SetSkipReferences(
false)
1247 .SetHideItemNames(
false);
1251 m_python_script =
"";
1252 m_python_function =
"";
1253 m_format_string =
"";
1254 m_is_add_script =
false;
1255 m_category =
"default";
1258#if LLDB_ENABLE_PYTHON
1276 if (!funct_name || !funct_name[0]) {
1284 script_format = std::make_shared<ScriptSummaryFormat>(
1291 "The provided function \"%s\" does not exist - "
1292 "please define it before attempting to use this summary.\n",
1299 result.
AppendError(
"script interpreter missing - unable to generate "
1300 "function wrapper.\n");
1305 std::string funct_name_str;
1307 result.
AppendError(
"unable to generate function wrapper.\n");
1310 if (funct_name_str.empty()) {
1312 "script interpreter failed to generate a valid function name.\n");
1318 script_format = std::make_shared<ScriptSummaryFormat>(
1322 auto options = std::make_unique<ScriptAddOptions>(
1326 for (
auto &entry : command.
entries()) {
1327 if (entry.ref().empty()) {
1328 result.
AppendError(
"empty typenames not allowed");
1332 options->m_target_types << std::string(entry.ref());
1350 for (
auto &entry : command.
entries()) {
1363 result.
AppendError(
"added to types, but not given a name");
1385 result.
AppendError(
"empty summary strings not allowed");
1394 if (strcmp(format_cstr,
"${var%S}") == 0) {
1395 result.
AppendError(
"recursive summary not allowed");
1399 std::unique_ptr<StringSummaryFormat> string_format(
1401 if (!string_format) {
1405 if (string_format->m_error.Fail()) {
1407 string_format->m_error.AsCString(
"<unknown>"));
1414 for (
auto &arg_entry : command.
entries()) {
1415 if (arg_entry.ref().empty()) {
1416 result.
AppendError(
"empty typenames not allowed");
1434 result.
AppendError(
"added to types, but not given a name");
1446 "Add a new summary style for a type.", nullptr),
1454 type_arg.push_back(type_style_arg);
1460The following examples of 'type summary add' refer to this code snippet for context:
1466 JustADemo(int p = 1, float v = 0.1) : ptr(new int(p)), value(v) {}
1468 JustADemo demo_instance(42, 3.14);
1470 typedef JustADemo NewDemo;
1471 NewDemo new_demo_instance(42, 3.14);
1473(lldb) type summary add --summary-string "the answer is ${*var.ptr}" JustADemo
1475 Subsequently displaying demo_instance with 'frame variable' or 'expression' will display "the answer is 42"
1477(lldb) type summary add --summary-string "the answer is ${*var.ptr}, and the question is ${var.value}" JustADemo
1479 Subsequently displaying demo_instance with 'frame variable' or 'expression' will display "the answer is 42 and the question is 3.14"
1482 "Alternatively, you could define formatting for all pointers to integers and \
1483rely on that when formatting JustADemo to obtain the same result:"
1486(lldb) type summary add --summary-string "${var%V} -> ${*var}" "int *"
1487(lldb) type summary add --summary-string "the answer is ${var.ptr}, and the question is ${var.value}" JustADemo
1490 "Type summaries are automatically applied to derived typedefs, so the examples \
1491above apply to both JustADemo and NewDemo. The cascade option can be used to \
1492suppress this behavior:"
1495(lldb) type summary add --summary-string "${var.ptr}, ${var.value},{${var.byte}}" JustADemo -C no
1497 The summary will now be used for values of JustADemo but not NewDemo.
1500 "By default summaries are shown for pointers and references to values of the \
1501specified type. To suppress formatting for pointers use the -p option, or apply \
1502the corresponding -r option to suppress formatting for references:"
1505(lldb) type summary add -p -r --summary-string "${var.ptr}, ${var.value},{${var.byte}}" JustADemo
1508 "One-line summaries including all fields in a type can be inferred without supplying an \
1509explicit summary string by passing the -c option:"
1512(lldb) type summary add -c JustADemo
1513(lldb) frame variable demo_instance
1514(ptr=<address>, value=3.14)
1517 "Type summaries normally suppress the nested display of individual fields. To \
1518supply a summary to supplement the default structure add the -e option:"
1521(lldb) type summary add -e --summary-string "*ptr = ${*var.ptr}" JustADemo
1524 "Now when displaying JustADemo values the int* is displayed, followed by the \
1525standard LLDB sequence of children, one per line:"
1534 "You can also add summaries written in Python. These scripts use lldb public API to \
1535gather information from your variables and produce a meaningful summary. To start a \
1536multi-line script use the -P option. The function declaration will be displayed along with \
1537a comment describing the two arguments. End your script with the word 'DONE' on a line by \
1541(lldb) type summary add JustADemo -P
1542def function (valobj,internal_dict):
"""valobj: an SBValue which you want to provide a summary for
1543internal_dict: an LLDB support object not to be used"""
1544 value = valobj.GetChildMemberWithName('value');
1545 return 'My value is ' + value.GetValue();
1548Alternatively, the -o option can be used when providing a simple one-line Python script:
1550(lldb) type summary add JustADemo -o "value = valobj.GetChildMemberWithName('value'); return 'My value is ' + value.GetValue();")");
1558#if LLDB_ENABLE_PYTHON
1572 if (type_name_ref.endswith(
"[]")) {
1573 std::string type_name_str(type_name.
GetCString());
1574 type_name_str.resize(type_name_str.length() - 2);
1575 if (type_name_str.back() !=
' ')
1576 type_name_str.append(
" ?\\[[0-9]+\\]");
1578 type_name_str.append(
"\\[[0-9]+\\]");
1596 std::string category_name,
1610 if (!typeRX.IsValid()) {
1612 error->SetErrorString(
1613 "regex format error (maybe this is not really a regex?)");
1619 const char *function_name = type_name.
AsCString();
1622 error->SetErrorStringWithFormat(
1623 "The provided recognizer function \"%s\" does not exist - "
1624 "please define it before attempting to use this summary.\n",
1629 category->AddTypeSummary(type_name.
GetStringRef(), match_type, entry);
1655 "type summary clear",
1656 "Delete all existing summaries.") {}
1671 "Show a list of current summaries.") {}
1682 summary_sp->GetDescription().c_str());
1692#define LLDB_OPTIONS_type_category_define
1693#include "CommandOptions.inc"
1709 switch (short_option) {
1717 llvm_unreachable(
"Unimplemented option");
1729 return llvm::ArrayRef(g_type_category_define_options);
1745 "Define a new category as a source of formatters.",
1753 type_arg.push_back(type_style_arg);
1778 for (
auto &entry : command.
entries()) {
1795#define LLDB_OPTIONS_type_category_enable
1796#include "CommandOptions.inc"
1810 switch (short_option) {
1812 if (!option_arg.empty()) {
1815 error.SetErrorStringWithFormat(
"unrecognized language '%s'",
1816 option_arg.str().c_str());
1820 llvm_unreachable(
"Unimplemented option");
1831 return llvm::ArrayRef(g_type_category_enable_options);
1846 "Enable a category as a source of formatters.",
1854 type_arg.push_back(type_style_arg);
1881 }
else if (argc > 0) {
1882 for (
int i = argc - 1; i >= 0; i--) {
1887 result.
AppendError(
"empty category name not allowed");
1893 if (cate->GetCount() == 0) {
1913 "Delete a category and all associated formatters.",
1921 type_arg.push_back(type_style_arg);
1946 bool success =
true;
1949 for (
int i = argc - 1; i >= 0; i--) {
1954 result.
AppendError(
"empty category name not allowed");
1963 result.
AppendError(
"cannot delete one or more categories\n");
1969#define LLDB_OPTIONS_type_category_disable
1970#include "CommandOptions.inc"
1984 switch (short_option) {
1986 if (!option_arg.empty()) {
1989 error.SetErrorStringWithFormat(
"unrecognized language '%s'",
1990 option_arg.str().c_str());
1994 llvm_unreachable(
"Unimplemented option");
2005 return llvm::ArrayRef(g_type_category_disable_options);
2020 "Disable a category as a source of formatters.",
2023 CommandArgumentData type_style_arg;
2028 type_arg.push_back(type_style_arg);
2055 }
else if (argc > 0) {
2057 for (
int i = argc - 1; i >= 0; i--) {
2062 result.
AppendError(
"empty category name not allowed");
2082 "Provide a list of all existing categories.",
2085 CommandArgumentData type_style_arg;
2090 type_arg.push_back(type_style_arg);
2111 std::unique_ptr<RegularExpression> regex;
2115 regex = std::make_unique<RegularExpression>(arg);
2116 if (!regex->IsValid()) {
2118 "syntax error in category regular expression '%s'", arg);
2121 }
else if (argc != 0) {
2131 if (regex->GetText() == category_sp->GetName()) {
2133 }
else if (regex->Execute(category_sp->GetName())) {
2142 "Category: %s\n", category_sp->GetDescription().c_str());
2158 "Show a list of current filters.") {}
2168 interpreter,
"type synthetic list",
2169 "Show a list of current synthetic providers.") {}
2201 "type filter clear",
2202 "Delete all existing filter.") {}
2212 "Delete all existing synthetic providers.") {}
2217 auto options = std::make_unique<SynthAddOptions>(
2221 for (
auto &entry : command.
entries()) {
2222 if (entry.ref().empty()) {
2223 result.
AppendError(
"empty typenames not allowed");
2227 options->m_target_types << std::string(entry.ref());
2251 "directly input Python code.\n",
2271 result.
AppendWarning(
"The provided class does not exist - please define it "
2272 "before attempting to use this synthetic provider");
2282 for (
auto &arg_entry : command.
entries()) {
2283 if (arg_entry.ref().empty()) {
2284 result.
AppendError(
"empty typenames not allowed");
2303 "Add a new synthetic provider for a type.", nullptr),
2306 CommandArgumentData type_style_arg;
2311 type_arg.push_back(type_style_arg);
2319 std::string category_name,
2342 error->SetErrorStringWithFormat(
"cannot add synthetic for type %s when "
2343 "filter is defined in same category!",
2351 if (!typeRX.IsValid()) {
2353 error->SetErrorString(
2354 "regex format error (maybe this is not really a regex?)");
2360 const char *function_name = type_name.
AsCString();
2363 error->SetErrorStringWithFormat(
2364 "The provided recognizer function \"%s\" does not exist - "
2365 "please define it before attempting to use this summary.\n",
2371 category->AddTypeSynthetic(type_name.
GetStringRef(), match_type, entry);
2375#define LLDB_OPTIONS_type_filter_add
2376#include "CommandOptions.inc"
2394 switch (short_option) {
2398 error.SetErrorStringWithFormat(
"invalid value for cascade: %s",
2399 option_arg.str().c_str());
2418 llvm_unreachable(
"Unimplemented option");
2435 return llvm::ArrayRef(g_type_filter_add_options);
2483 error->SetErrorStringWithFormat(
"cannot add filter for type %s when "
2484 "synthetic is defined in same "
2495 if (!typeRX.IsValid()) {
2497 error->SetErrorString(
2498 "regex format error (maybe this is not really a regex?)");
2502 category->AddTypeFilter(type_name.
GetStringRef(), match_type, entry);
2509 "Add a new filter for a type.", nullptr) {
2511 CommandArgumentData type_style_arg;
2516 type_arg.push_back(type_style_arg);
2522The following examples of 'type filter add' refer to this code snippet for context:
2537Adding a simple filter:
2539(lldb) type filter add --child a --child g Foo
2540(lldb) frame variable my_foo
2543 "Produces output where only a and g are displayed. Other children of my_foo \
2544(b, c, d, e, f, h and i) are available by asking for them explicitly:"
2547(lldb) frame variable my_foo.b my_foo.c my_foo.i
2550 "The formatting option --raw on frame variable bypasses the filter, showing \
2551all children of my_foo as if no filter was defined:"
2554(lldb) frame variable my_foo --raw)");
2586 entry->AddExpressionPath(*begin);
2598 for (
auto &arg_entry : command.
entries()) {
2599 if (arg_entry.ref().empty()) {
2600 result.
AppendError(
"empty typenames not allowed");
2618#define LLDB_OPTIONS_type_lookup
2619#include "CommandOptions.inc"
2650 return llvm::ArrayRef(g_type_lookup_options);
2657 const int short_option = g_type_lookup_options[option_idx].short_option;
2659 switch (short_option) {
2669 llvm_unreachable(
"Unimplemented option");
2692 "Lookup types and declarations in the current target, "
2693 "following language-specific naming conventions.",
2694 "type lookup <type-specifier>",
2695 eCommandRequiresTarget) {
2711 stream.
Printf(
"%s\n", help);
2719 void DoExecute(llvm::StringRef raw_command_line,
2721 if (raw_command_line.empty()) {
2723 "type lookup cannot be invoked without a type name as argument");
2731 const char *name_of_type = args.GetRawPart().c_str();
2740 bool any_found =
false;
2742 std::vector<Language *> languages;
2744 bool is_global_search =
false;
2747 if ((is_global_search =
2750 languages.push_back(lang);
2764 languages.begin(), languages.end(),
2766 if (!lang1 || !lang2)
2768 LanguageType lt1 = lang1->GetLanguageType();
2769 LanguageType lt2 = lang2->GetLanguageType();
2770 if (lt1 == guessed_language)
2772 if (lt2 == guessed_language)
2779 bool is_first_language =
true;
2785 if (
auto scavenger = language->GetTypeScavenger()) {
2787 if (scavenger->Find(best_scope, name_of_type, search_results) > 0) {
2788 for (
const auto &search_result : search_results) {
2789 if (search_result && search_result->IsValid()) {
2792 this->m_command_options.m_show_help);
2798 if (any_found && is_global_search)
2800 else if (is_first_language && is_global_search &&
2802 is_first_language =
false;
2804 "no type was found in the current language %s matching '%s'; "
2805 "performing a global search across all languages\n",
2819template <
typename FormatterType>
2822 typedef std::function<
typename FormatterType::SharedPointer(
ValueObject &)>
2825 const char *formatter_name,
2831 name.
Printf(
"type %s info", formatter_name);
2834 help.
Printf(
"This command evaluates the provided expression and shows "
2835 "which %s is applied to the resulting value (if any).",
2839 syntax.
Printf(
"type %s info <expr>", formatter_name);
2860 command, frame_sp.get(), result_valobj_sp, options);
2863 result_valobj_sp->GetQualifiedRepresentationIfAvailable(
2864 target_sp->GetPreferDynamicValue(),
2865 target_sp->GetEnableSyntheticValue());
2866 typename FormatterType::SharedPointer formatter_sp =
2869 std::string description(formatter_sp->GetDescription());
2872 << result_valobj_sp->GetDisplayTypeName().AsCString(
"<unknown>")
2873 <<
") " << command <<
" is: " << description <<
"\n";
2878 << result_valobj_sp->GetDisplayTypeName().AsCString(
"<unknown>")
2879 <<
") " << command <<
"\n";
2883 result.
AppendError(
"failed to evaluate expression");
2896 interpreter,
"type format",
2897 "Commands for customizing value display formats.",
2898 "type format [<sub-command-options>] ") {
2909 interpreter,
"format",
2922 interpreter,
"type synthetic",
2923 "Commands for operating on synthetic type representations.",
2924 "type synthetic [<sub-command-options>] ") {
2936 interpreter,
"synthetic",
2949 "Commands for operating on type filters.",
2950 "type filter [<sub-command-options>] ") {
2968 "Commands for operating on type categories.",
2969 "type category [<sub-command-options>] ") {
2993 interpreter,
"type summary",
2994 "Commands for editing variable summary display options.",
2995 "type summary [<sub-command-options>] ") {
3006 interpreter,
"summary",
3019 "Commands for operating on the type system.",
3020 "type [<sub-command-options>]") {
static const char * g_synth_addreader_instructions
static bool WarnOnPotentialUnquotedUnsignedType(Args &command, CommandReturnObject &result)
const char * FormatCategoryToString(FormatCategoryItem item, bool long_name)
static bool FixArrayTypeNameWithRegex(ConstString &type_name)
static llvm::raw_ostream & error(Stream &strm)
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
OptionValueLanguage m_cate_language
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
OptionValueBoolean m_define_enabled
Options * GetOptions() override
~CommandObjectTypeCategoryDefine() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
void DoExecute(Args &command, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandObjectTypeCategoryDelete() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
lldb::LanguageType m_language
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.
~CommandOptions() override=default
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandObjectTypeCategoryDisable() override=default
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
lldb::LanguageType m_language
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
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectTypeCategoryEnable() override=default
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandObjectTypeCategoryList() override=default
~CommandObjectTypeCategory() override=default
option_vector m_expr_paths
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::string > option_vector
option_vector::iterator ExpressionPathsIterator
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandObjectTypeFilterAdd() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
bool AddFilter(ConstString type_name, TypeFilterImplSP entry, FilterFormatType type, std::string category_name, Status *error)
~CommandObjectTypeFilterDelete() override=default
~CommandObjectTypeFilter() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
lldb::LanguageType m_language
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
OptionGroupOptions m_option_group
void DoExecute(llvm::StringRef raw_command_line, CommandReturnObject &result) override
lldb::LanguageType GuessLanguage(StackFrame *frame)
~CommandObjectTypeLookup() override=default
llvm::StringRef GetHelpLong() override
Options * GetOptions() override
CommandOptions m_command_options
void OptionParsingStarting(ExecutionContext *execution_context) override
std::string m_python_script
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
std::string m_python_function
~CommandOptions() override=default
CommandOptions(CommandInterpreter &interpreter)
TypeSummaryImpl::Flags m_flags
FormatterMatchType m_match_type
std::string m_format_string
~CommandObjectTypeSummaryAdd() override=default
Options * GetOptions() override
bool Execute_ScriptSummary(Args &command, CommandReturnObject &result)
void DoExecute(Args &command, CommandReturnObject &result) override
void IOHandlerActivated(IOHandler &io_handler, bool interactive) override
bool Execute_StringSummary(Args &command, CommandReturnObject &result)
CommandObjectTypeSummaryAdd(CommandInterpreter &interpreter)
void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override
Called when a line or lines have been retrieved.
bool AddNamedSummary(ConstString summary_name, lldb::TypeSummaryImplSP entry, Status *error=nullptr)
bool AddSummary(ConstString type_name, lldb::TypeSummaryImplSP entry, FormatterMatchType match_type, std::string category, Status *error=nullptr)
void FormatterSpecificDeletion() override
~CommandObjectTypeSummaryDelete() override=default
bool FormatterSpecificDeletion(ConstString typeCS) override
bool FormatterSpecificList(CommandReturnObject &result) override
~CommandObjectTypeSummary() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
FormatterMatchType m_match_type
void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override
Called when a line or lines have been retrieved.
CommandObjectTypeSynthAdd(CommandInterpreter &interpreter)
bool Execute_PythonClass(Args &command, CommandReturnObject &result)
bool AddSynth(ConstString type_name, lldb::SyntheticChildrenSP entry, FormatterMatchType match_type, std::string category_name, Status *error)
Options * GetOptions() override
void IOHandlerActivated(IOHandler &io_handler, bool interactive) override
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectTypeSynthAdd() override=default
bool Execute_HandwritePython(Args &command, CommandReturnObject &result)
~CommandObjectTypeSynthDelete() override=default
~CommandObjectTypeSynth() override=default
StringList m_target_types
std::shared_ptr< ScriptAddOptions > SharedPointer
TypeSummaryImpl::Flags m_flags
ScriptAddOptions(const TypeSummaryImpl::Flags &flags, FormatterMatchType match_type, ConstString name, std::string catg)
FormatterMatchType m_match_type
FormatterMatchType m_match_type
StringList m_target_types
std::shared_ptr< SynthAddOptions > SharedPointer
SynthAddOptions(bool sptr, bool sref, bool casc, FormatterMatchType match_type, std::string catg)
A command line argument class.
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.
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
ExecutionContext GetExecutionContext() const
void GetPythonCommandsFromIOHandler(const char *prompt, IOHandlerDelegate &delegate, void *baton=nullptr)
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
CommandObjectType(CommandInterpreter &interpreter)
~CommandObjectType() override
std::vector< CommandArgumentData > CommandArgumentEntry
virtual void SetHelpLong(llvm::StringRef str)
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
Thread * GetDefaultThread()
std::string m_cmd_help_long
void SetSyntax(llvm::StringRef str)
void SetCommandName(llvm::StringRef name)
virtual void SetHelp(llvm::StringRef str)
void void AppendError(llvm::StringRef in_string)
void AppendWarningWithFormat(const char *format,...) __attribute__((format(printf
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendMessageWithFormat(const char *format,...) __attribute__((format(printf
void void AppendWarning(llvm::StringRef in_string)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
size_t GetCursorIndex() const
A uniqued constant string class.
void SetCString(const char *cstr)
Set the C string value.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
void SetString(llvm::StringRef s)
const char * GetCString() const
Get the string value as a C string.
static bool Delete(ConstString category)
static void Disable(ConstString category)
static void DisableStar()
static void ForEach(TypeCategoryMap::ForEachCallback callback)
static void Enable(ConstString category, TypeCategoryMap::Position=TypeCategoryMap::Default)
static bool GetCategory(ConstString category, lldb::TypeCategoryImplSP &entry, bool allow_create=true)
lldb::TargetSP GetSelectedTarget()
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
lldb::StreamFileSP GetErrorStreamFileSP()
lldb::StreamFileSP GetOutputStreamFileSP()
std::set< std::unique_ptr< Result > > ResultSet
static Language * FindPlugin(lldb::LanguageType language)
static const char * GetNameForLanguageType(lldb::LanguageType language)
virtual const char * GetLanguageSpecificTypeLookupHelp()
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
static void ForEach(std::function< bool(Language *)> callback)
lldb::LanguageType GuessLanguage() const
Try to guess the language from the mangling.
void Append(OptionGroup *group)
Append options from a OptionGroup class.
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
bool GetCurrentValue() const
lldb::LanguageType GetCurrentValue() const
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
llvm::StringRef GetCurrentValueAsRef() 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
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
llvm::StringRef GetText() const
Access the regular expression text.
virtual bool GenerateTypeScriptFunction(const char *oneliner, std::string &output, const void *name_token=nullptr)
virtual bool GenerateTypeSynthClass(StringList &input, std::string &output, const void *name_token=nullptr)
virtual bool CheckObjectExists(const char *name)
const char * GetPythonClassName()
This base class provides an interface to stack frames.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
lldb::LanguageType GuessLanguage()
const char * GetData() const
llvm::StringRef GetString() const
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.
std::string CopyList(const char *item_preamble=nullptr, const char *items_sep="\n") const
size_t SplitIntoLines(const std::string &lines)
Symbol * symbol
The Symbol for a given query.
Flags & SetSkipReferences(bool value=true)
Flags & SetSkipPointers(bool value=true)
std::shared_ptr< SyntheticChildren > SharedPointer
lldb::StackFrameSP GetSelectedFrame(SelectMostRelevant select_most_relevant)
static const Position Default
Class for matching type names.
ConstString GetMatchString() const
Returns the underlying match string for this TypeMatcher.
Flags & SetCascades(bool value=true)
Flags & SetHideEmptyAggregates(bool value=true)
bool GetShowMembersOneLiner() const
Flags & SetSkipPointers(bool value=true)
Flags & SetHideItemNames(bool value=true)
Flags & SetDontShowChildren(bool value=true)
Flags & SetSkipReferences(bool value=true)
Flags & SetShowMembersOneLiner(bool value=true)
Flags & SetDontShowValue(bool value=true)
std::shared_ptr< TypeSummaryImpl > SharedPointer
lldb::TypeFormatImplSP GetValueFormat()
lldb::TypeSummaryImplSP GetSummaryFormat()
lldb::SyntheticChildrenSP GetSyntheticChildren()
@ DoNoSelectMostRelevantFrame
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
FormatCategoryItem
Format category entry types.
@ eFormatCategoryItemFormat
@ eFormatCategoryItemSynth
@ eFormatCategoryItemSummary
@ eFormatCategoryItemFilter
@ eTypeCategoryNameCompletion
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::TypeSummaryImpl > TypeSummaryImplSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::TypeFormatImpl > TypeFormatImplSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Format
Display format definitions.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
FormatterMatchType
Type of match to be performed when looking for a formatter for a data type.
@ eFormatterMatchCallback
ExpressionResults
The results of expression evaluation.
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
std::shared_ptr< lldb_private::StreamFile > StreamFileSP
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
std::shared_ptr< lldb_private::TypeFilterImpl > TypeFilterImplSP
std::shared_ptr< lldb_private::Target > TargetSP
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)