1 //===-- CommandObject.cpp ---------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "lldb/Interpreter/CommandObject.h" 11 12 #include <string> 13 #include <sstream> 14 #include <map> 15 16 #include <stdlib.h> 17 #include <ctype.h> 18 19 #include "lldb/Core/Address.h" 20 #include "lldb/Core/ArchSpec.h" 21 #include "lldb/Interpreter/Options.h" 22 23 // These are for the Sourcename completers. 24 // FIXME: Make a separate file for the completers. 25 #include "lldb/Host/FileSpec.h" 26 #include "lldb/Core/FileSpecList.h" 27 #include "lldb/DataFormatters/FormatManager.h" 28 #include "lldb/Target/Process.h" 29 #include "lldb/Target/Target.h" 30 31 #include "lldb/Target/Language.h" 32 33 #include "lldb/Interpreter/CommandInterpreter.h" 34 #include "lldb/Interpreter/CommandReturnObject.h" 35 36 using namespace lldb; 37 using namespace lldb_private; 38 39 //------------------------------------------------------------------------- 40 // CommandObject 41 //------------------------------------------------------------------------- 42 43 CommandObject::CommandObject 44 ( 45 CommandInterpreter &interpreter, 46 const char *name, 47 const char *help, 48 const char *syntax, 49 uint32_t flags 50 ) : 51 m_interpreter (interpreter), 52 m_cmd_name (name ? name : ""), 53 m_cmd_help_short (), 54 m_cmd_help_long (), 55 m_cmd_syntax (), 56 m_is_alias (false), 57 m_flags (flags), 58 m_arguments(), 59 m_deprecated_command_override_callback (nullptr), 60 m_command_override_callback (nullptr), 61 m_command_override_baton (nullptr) 62 { 63 if (help && help[0]) 64 m_cmd_help_short = help; 65 if (syntax && syntax[0]) 66 m_cmd_syntax = syntax; 67 } 68 69 CommandObject::~CommandObject () 70 { 71 } 72 73 const char * 74 CommandObject::GetHelp () 75 { 76 return m_cmd_help_short.c_str(); 77 } 78 79 const char * 80 CommandObject::GetHelpLong () 81 { 82 return m_cmd_help_long.c_str(); 83 } 84 85 const char * 86 CommandObject::GetSyntax () 87 { 88 if (m_cmd_syntax.length() == 0) 89 { 90 StreamString syntax_str; 91 syntax_str.Printf ("%s", GetCommandName()); 92 if (GetOptions() != nullptr) 93 syntax_str.Printf (" <cmd-options>"); 94 if (m_arguments.size() > 0) 95 { 96 syntax_str.Printf (" "); 97 if (WantsRawCommandString() && GetOptions() && GetOptions()->NumCommandOptions()) 98 syntax_str.Printf("-- "); 99 GetFormattedCommandArguments (syntax_str); 100 } 101 m_cmd_syntax = syntax_str.GetData (); 102 } 103 104 return m_cmd_syntax.c_str(); 105 } 106 107 const char * 108 CommandObject::GetCommandName () 109 { 110 return m_cmd_name.c_str(); 111 } 112 113 void 114 CommandObject::SetCommandName (const char *name) 115 { 116 m_cmd_name = name; 117 } 118 119 void 120 CommandObject::SetHelp (const char *cstr) 121 { 122 m_cmd_help_short = cstr; 123 } 124 125 void 126 CommandObject::SetHelp (std::string str) 127 { 128 m_cmd_help_short = str; 129 } 130 131 void 132 CommandObject::SetHelpLong (const char *cstr) 133 { 134 m_cmd_help_long = cstr; 135 } 136 137 void 138 CommandObject::SetHelpLong (std::string str) 139 { 140 m_cmd_help_long = str; 141 } 142 143 void 144 CommandObject::SetSyntax (const char *cstr) 145 { 146 m_cmd_syntax = cstr; 147 } 148 149 Options * 150 CommandObject::GetOptions () 151 { 152 // By default commands don't have options unless this virtual function 153 // is overridden by base classes. 154 return nullptr; 155 } 156 157 bool 158 CommandObject::ParseOptions 159 ( 160 Args& args, 161 CommandReturnObject &result 162 ) 163 { 164 // See if the subclass has options? 165 Options *options = GetOptions(); 166 if (options != nullptr) 167 { 168 Error error; 169 options->NotifyOptionParsingStarting(); 170 171 // ParseOptions calls getopt_long_only, which always skips the zero'th item in the array and starts at position 1, 172 // so we need to push a dummy value into position zero. 173 args.Unshift("dummy_string"); 174 error = args.ParseOptions (*options); 175 176 // The "dummy_string" will have already been removed by ParseOptions, 177 // so no need to remove it. 178 179 if (error.Success()) 180 error = options->NotifyOptionParsingFinished(); 181 182 if (error.Success()) 183 { 184 if (options->VerifyOptions (result)) 185 return true; 186 } 187 else 188 { 189 const char *error_cstr = error.AsCString(); 190 if (error_cstr) 191 { 192 // We got an error string, lets use that 193 result.AppendError(error_cstr); 194 } 195 else 196 { 197 // No error string, output the usage information into result 198 options->GenerateOptionUsage (result.GetErrorStream(), this); 199 } 200 } 201 result.SetStatus (eReturnStatusFailed); 202 return false; 203 } 204 return true; 205 } 206 207 208 209 bool 210 CommandObject::CheckRequirements (CommandReturnObject &result) 211 { 212 #ifdef LLDB_CONFIGURATION_DEBUG 213 // Nothing should be stored in m_exe_ctx between running commands as m_exe_ctx 214 // has shared pointers to the target, process, thread and frame and we don't 215 // want any CommandObject instances to keep any of these objects around 216 // longer than for a single command. Every command should call 217 // CommandObject::Cleanup() after it has completed 218 assert (m_exe_ctx.GetTargetPtr() == NULL); 219 assert (m_exe_ctx.GetProcessPtr() == NULL); 220 assert (m_exe_ctx.GetThreadPtr() == NULL); 221 assert (m_exe_ctx.GetFramePtr() == NULL); 222 #endif 223 224 // Lock down the interpreter's execution context prior to running the 225 // command so we guarantee the selected target, process, thread and frame 226 // can't go away during the execution 227 m_exe_ctx = m_interpreter.GetExecutionContext(); 228 229 const uint32_t flags = GetFlags().Get(); 230 if (flags & (eCommandRequiresTarget | 231 eCommandRequiresProcess | 232 eCommandRequiresThread | 233 eCommandRequiresFrame | 234 eCommandTryTargetAPILock )) 235 { 236 237 if ((flags & eCommandRequiresTarget) && !m_exe_ctx.HasTargetScope()) 238 { 239 result.AppendError (GetInvalidTargetDescription()); 240 return false; 241 } 242 243 if ((flags & eCommandRequiresProcess) && !m_exe_ctx.HasProcessScope()) 244 { 245 if (!m_exe_ctx.HasTargetScope()) 246 result.AppendError (GetInvalidTargetDescription()); 247 else 248 result.AppendError (GetInvalidProcessDescription()); 249 return false; 250 } 251 252 if ((flags & eCommandRequiresThread) && !m_exe_ctx.HasThreadScope()) 253 { 254 if (!m_exe_ctx.HasTargetScope()) 255 result.AppendError (GetInvalidTargetDescription()); 256 else if (!m_exe_ctx.HasProcessScope()) 257 result.AppendError (GetInvalidProcessDescription()); 258 else 259 result.AppendError (GetInvalidThreadDescription()); 260 return false; 261 } 262 263 if ((flags & eCommandRequiresFrame) && !m_exe_ctx.HasFrameScope()) 264 { 265 if (!m_exe_ctx.HasTargetScope()) 266 result.AppendError (GetInvalidTargetDescription()); 267 else if (!m_exe_ctx.HasProcessScope()) 268 result.AppendError (GetInvalidProcessDescription()); 269 else if (!m_exe_ctx.HasThreadScope()) 270 result.AppendError (GetInvalidThreadDescription()); 271 else 272 result.AppendError (GetInvalidFrameDescription()); 273 return false; 274 } 275 276 if ((flags & eCommandRequiresRegContext) && (m_exe_ctx.GetRegisterContext() == nullptr)) 277 { 278 result.AppendError (GetInvalidRegContextDescription()); 279 return false; 280 } 281 282 if (flags & eCommandTryTargetAPILock) 283 { 284 Target *target = m_exe_ctx.GetTargetPtr(); 285 if (target) 286 m_api_locker.Lock (target->GetAPIMutex()); 287 } 288 } 289 290 if (GetFlags().AnySet (eCommandProcessMustBeLaunched | eCommandProcessMustBePaused)) 291 { 292 Process *process = m_interpreter.GetExecutionContext().GetProcessPtr(); 293 if (process == nullptr) 294 { 295 // A process that is not running is considered paused. 296 if (GetFlags().Test(eCommandProcessMustBeLaunched)) 297 { 298 result.AppendError ("Process must exist."); 299 result.SetStatus (eReturnStatusFailed); 300 return false; 301 } 302 } 303 else 304 { 305 StateType state = process->GetState(); 306 switch (state) 307 { 308 case eStateInvalid: 309 case eStateSuspended: 310 case eStateCrashed: 311 case eStateStopped: 312 break; 313 314 case eStateConnected: 315 case eStateAttaching: 316 case eStateLaunching: 317 case eStateDetached: 318 case eStateExited: 319 case eStateUnloaded: 320 if (GetFlags().Test(eCommandProcessMustBeLaunched)) 321 { 322 result.AppendError ("Process must be launched."); 323 result.SetStatus (eReturnStatusFailed); 324 return false; 325 } 326 break; 327 328 case eStateRunning: 329 case eStateStepping: 330 if (GetFlags().Test(eCommandProcessMustBePaused)) 331 { 332 result.AppendError ("Process is running. Use 'process interrupt' to pause execution."); 333 result.SetStatus (eReturnStatusFailed); 334 return false; 335 } 336 } 337 } 338 } 339 return true; 340 } 341 342 void 343 CommandObject::Cleanup () 344 { 345 m_exe_ctx.Clear(); 346 m_api_locker.Unlock(); 347 } 348 349 350 class CommandDictCommandPartialMatch 351 { 352 public: 353 CommandDictCommandPartialMatch (const char *match_str) 354 { 355 m_match_str = match_str; 356 } 357 bool operator() (const std::pair<std::string, lldb::CommandObjectSP> map_element) const 358 { 359 // A NULL or empty string matches everything. 360 if (m_match_str == nullptr || *m_match_str == '\0') 361 return true; 362 363 return map_element.first.find (m_match_str, 0) == 0; 364 } 365 366 private: 367 const char *m_match_str; 368 }; 369 370 int 371 CommandObject::AddNamesMatchingPartialString (CommandObject::CommandMap &in_map, const char *cmd_str, 372 StringList &matches) 373 { 374 int number_added = 0; 375 CommandDictCommandPartialMatch matcher(cmd_str); 376 377 CommandObject::CommandMap::iterator matching_cmds = std::find_if (in_map.begin(), in_map.end(), matcher); 378 379 while (matching_cmds != in_map.end()) 380 { 381 ++number_added; 382 matches.AppendString((*matching_cmds).first.c_str()); 383 matching_cmds = std::find_if (++matching_cmds, in_map.end(), matcher);; 384 } 385 return number_added; 386 } 387 388 int 389 CommandObject::HandleCompletion 390 ( 391 Args &input, 392 int &cursor_index, 393 int &cursor_char_position, 394 int match_start_point, 395 int max_return_elements, 396 bool &word_complete, 397 StringList &matches 398 ) 399 { 400 // Default implementation of WantsCompletion() is !WantsRawCommandString(). 401 // Subclasses who want raw command string but desire, for example, 402 // argument completion should override WantsCompletion() to return true, 403 // instead. 404 if (WantsRawCommandString() && !WantsCompletion()) 405 { 406 // FIXME: Abstract telling the completion to insert the completion character. 407 matches.Clear(); 408 return -1; 409 } 410 else 411 { 412 // Can we do anything generic with the options? 413 Options *cur_options = GetOptions(); 414 CommandReturnObject result; 415 OptionElementVector opt_element_vector; 416 417 if (cur_options != nullptr) 418 { 419 // Re-insert the dummy command name string which will have been 420 // stripped off: 421 input.Unshift ("dummy-string"); 422 cursor_index++; 423 424 425 // I stick an element on the end of the input, because if the last element is 426 // option that requires an argument, getopt_long_only will freak out. 427 428 input.AppendArgument ("<FAKE-VALUE>"); 429 430 input.ParseArgsForCompletion (*cur_options, opt_element_vector, cursor_index); 431 432 input.DeleteArgumentAtIndex(input.GetArgumentCount() - 1); 433 434 bool handled_by_options; 435 handled_by_options = cur_options->HandleOptionCompletion (input, 436 opt_element_vector, 437 cursor_index, 438 cursor_char_position, 439 match_start_point, 440 max_return_elements, 441 word_complete, 442 matches); 443 if (handled_by_options) 444 return matches.GetSize(); 445 } 446 447 // If we got here, the last word is not an option or an option argument. 448 return HandleArgumentCompletion (input, 449 cursor_index, 450 cursor_char_position, 451 opt_element_vector, 452 match_start_point, 453 max_return_elements, 454 word_complete, 455 matches); 456 } 457 } 458 459 bool 460 CommandObject::HelpTextContainsWord (const char *search_word) 461 { 462 std::string options_usage_help; 463 464 bool found_word = false; 465 466 const char *short_help = GetHelp(); 467 const char *long_help = GetHelpLong(); 468 const char *syntax_help = GetSyntax(); 469 470 if (short_help && strcasestr (short_help, search_word)) 471 found_word = true; 472 else if (long_help && strcasestr (long_help, search_word)) 473 found_word = true; 474 else if (syntax_help && strcasestr (syntax_help, search_word)) 475 found_word = true; 476 477 if (!found_word 478 && GetOptions() != nullptr) 479 { 480 StreamString usage_help; 481 GetOptions()->GenerateOptionUsage (usage_help, this); 482 if (usage_help.GetSize() > 0) 483 { 484 const char *usage_text = usage_help.GetData(); 485 if (strcasestr (usage_text, search_word)) 486 found_word = true; 487 } 488 } 489 490 return found_word; 491 } 492 493 int 494 CommandObject::GetNumArgumentEntries () 495 { 496 return m_arguments.size(); 497 } 498 499 CommandObject::CommandArgumentEntry * 500 CommandObject::GetArgumentEntryAtIndex (int idx) 501 { 502 if (static_cast<size_t>(idx) < m_arguments.size()) 503 return &(m_arguments[idx]); 504 505 return nullptr; 506 } 507 508 const CommandObject::ArgumentTableEntry * 509 CommandObject::FindArgumentDataByType (CommandArgumentType arg_type) 510 { 511 const ArgumentTableEntry *table = CommandObject::GetArgumentTable(); 512 513 for (int i = 0; i < eArgTypeLastArg; ++i) 514 if (table[i].arg_type == arg_type) 515 return &(table[i]); 516 517 return nullptr; 518 } 519 520 void 521 CommandObject::GetArgumentHelp (Stream &str, CommandArgumentType arg_type, CommandInterpreter &interpreter) 522 { 523 const ArgumentTableEntry* table = CommandObject::GetArgumentTable(); 524 const ArgumentTableEntry *entry = &(table[arg_type]); 525 526 // The table is *supposed* to be kept in arg_type order, but someone *could* have messed it up... 527 528 if (entry->arg_type != arg_type) 529 entry = CommandObject::FindArgumentDataByType (arg_type); 530 531 if (!entry) 532 return; 533 534 StreamString name_str; 535 name_str.Printf ("<%s>", entry->arg_name); 536 537 if (entry->help_function) 538 { 539 const char* help_text = entry->help_function(); 540 if (!entry->help_function.self_formatting) 541 { 542 interpreter.OutputFormattedHelpText (str, name_str.GetData(), "--", help_text, 543 name_str.GetSize()); 544 } 545 else 546 { 547 interpreter.OutputHelpText(str, name_str.GetData(), "--", help_text, 548 name_str.GetSize()); 549 } 550 } 551 else 552 interpreter.OutputFormattedHelpText (str, name_str.GetData(), "--", entry->help_text, name_str.GetSize()); 553 } 554 555 const char * 556 CommandObject::GetArgumentName (CommandArgumentType arg_type) 557 { 558 const ArgumentTableEntry *entry = &(CommandObject::GetArgumentTable()[arg_type]); 559 560 // The table is *supposed* to be kept in arg_type order, but someone *could* have messed it up... 561 562 if (entry->arg_type != arg_type) 563 entry = CommandObject::FindArgumentDataByType (arg_type); 564 565 if (entry) 566 return entry->arg_name; 567 568 StreamString str; 569 str << "Arg name for type (" << arg_type << ") not in arg table!"; 570 return str.GetData(); 571 } 572 573 bool 574 CommandObject::IsPairType (ArgumentRepetitionType arg_repeat_type) 575 { 576 if ((arg_repeat_type == eArgRepeatPairPlain) 577 || (arg_repeat_type == eArgRepeatPairOptional) 578 || (arg_repeat_type == eArgRepeatPairPlus) 579 || (arg_repeat_type == eArgRepeatPairStar) 580 || (arg_repeat_type == eArgRepeatPairRange) 581 || (arg_repeat_type == eArgRepeatPairRangeOptional)) 582 return true; 583 584 return false; 585 } 586 587 static CommandObject::CommandArgumentEntry 588 OptSetFiltered(uint32_t opt_set_mask, CommandObject::CommandArgumentEntry &cmd_arg_entry) 589 { 590 CommandObject::CommandArgumentEntry ret_val; 591 for (unsigned i = 0; i < cmd_arg_entry.size(); ++i) 592 if (opt_set_mask & cmd_arg_entry[i].arg_opt_set_association) 593 ret_val.push_back(cmd_arg_entry[i]); 594 return ret_val; 595 } 596 597 // Default parameter value of opt_set_mask is LLDB_OPT_SET_ALL, which means take 598 // all the argument data into account. On rare cases where some argument sticks 599 // with certain option sets, this function returns the option set filtered args. 600 void 601 CommandObject::GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask) 602 { 603 int num_args = m_arguments.size(); 604 for (int i = 0; i < num_args; ++i) 605 { 606 if (i > 0) 607 str.Printf (" "); 608 CommandArgumentEntry arg_entry = 609 opt_set_mask == LLDB_OPT_SET_ALL ? m_arguments[i] 610 : OptSetFiltered(opt_set_mask, m_arguments[i]); 611 int num_alternatives = arg_entry.size(); 612 613 if ((num_alternatives == 2) 614 && IsPairType (arg_entry[0].arg_repetition)) 615 { 616 const char *first_name = GetArgumentName (arg_entry[0].arg_type); 617 const char *second_name = GetArgumentName (arg_entry[1].arg_type); 618 switch (arg_entry[0].arg_repetition) 619 { 620 case eArgRepeatPairPlain: 621 str.Printf ("<%s> <%s>", first_name, second_name); 622 break; 623 case eArgRepeatPairOptional: 624 str.Printf ("[<%s> <%s>]", first_name, second_name); 625 break; 626 case eArgRepeatPairPlus: 627 str.Printf ("<%s> <%s> [<%s> <%s> [...]]", first_name, second_name, first_name, second_name); 628 break; 629 case eArgRepeatPairStar: 630 str.Printf ("[<%s> <%s> [<%s> <%s> [...]]]", first_name, second_name, first_name, second_name); 631 break; 632 case eArgRepeatPairRange: 633 str.Printf ("<%s_1> <%s_1> ... <%s_n> <%s_n>", first_name, second_name, first_name, second_name); 634 break; 635 case eArgRepeatPairRangeOptional: 636 str.Printf ("[<%s_1> <%s_1> ... <%s_n> <%s_n>]", first_name, second_name, first_name, second_name); 637 break; 638 // Explicitly test for all the rest of the cases, so if new types get added we will notice the 639 // missing case statement(s). 640 case eArgRepeatPlain: 641 case eArgRepeatOptional: 642 case eArgRepeatPlus: 643 case eArgRepeatStar: 644 case eArgRepeatRange: 645 // These should not be reached, as they should fail the IsPairType test above. 646 break; 647 } 648 } 649 else 650 { 651 StreamString names; 652 for (int j = 0; j < num_alternatives; ++j) 653 { 654 if (j > 0) 655 names.Printf (" | "); 656 names.Printf ("%s", GetArgumentName (arg_entry[j].arg_type)); 657 } 658 switch (arg_entry[0].arg_repetition) 659 { 660 case eArgRepeatPlain: 661 str.Printf ("<%s>", names.GetData()); 662 break; 663 case eArgRepeatPlus: 664 str.Printf ("<%s> [<%s> [...]]", names.GetData(), names.GetData()); 665 break; 666 case eArgRepeatStar: 667 str.Printf ("[<%s> [<%s> [...]]]", names.GetData(), names.GetData()); 668 break; 669 case eArgRepeatOptional: 670 str.Printf ("[<%s>]", names.GetData()); 671 break; 672 case eArgRepeatRange: 673 str.Printf ("<%s_1> .. <%s_n>", names.GetData(), names.GetData()); 674 break; 675 // Explicitly test for all the rest of the cases, so if new types get added we will notice the 676 // missing case statement(s). 677 case eArgRepeatPairPlain: 678 case eArgRepeatPairOptional: 679 case eArgRepeatPairPlus: 680 case eArgRepeatPairStar: 681 case eArgRepeatPairRange: 682 case eArgRepeatPairRangeOptional: 683 // These should not be hit, as they should pass the IsPairType test above, and control should 684 // have gone into the other branch of the if statement. 685 break; 686 } 687 } 688 } 689 } 690 691 CommandArgumentType 692 CommandObject::LookupArgumentName (const char *arg_name) 693 { 694 CommandArgumentType return_type = eArgTypeLastArg; 695 696 std::string arg_name_str (arg_name); 697 size_t len = arg_name_str.length(); 698 if (arg_name[0] == '<' 699 && arg_name[len-1] == '>') 700 arg_name_str = arg_name_str.substr (1, len-2); 701 702 const ArgumentTableEntry *table = GetArgumentTable(); 703 for (int i = 0; i < eArgTypeLastArg; ++i) 704 if (arg_name_str.compare (table[i].arg_name) == 0) 705 return_type = g_arguments_data[i].arg_type; 706 707 return return_type; 708 } 709 710 static const char * 711 RegisterNameHelpTextCallback () 712 { 713 return "Register names can be specified using the architecture specific names. " 714 "They can also be specified using generic names. Not all generic entities have " 715 "registers backing them on all architectures. When they don't the generic name " 716 "will return an error.\n" 717 "The generic names defined in lldb are:\n" 718 "\n" 719 "pc - program counter register\n" 720 "ra - return address register\n" 721 "fp - frame pointer register\n" 722 "sp - stack pointer register\n" 723 "flags - the flags register\n" 724 "arg{1-6} - integer argument passing registers.\n"; 725 } 726 727 static const char * 728 BreakpointIDHelpTextCallback () 729 { 730 return "Breakpoint ID's consist major and minor numbers; the major number " 731 "corresponds to the single entity that was created with a 'breakpoint set' " 732 "command; the minor numbers correspond to all the locations that were actually " 733 "found/set based on the major breakpoint. A full breakpoint ID might look like " 734 "3.14, meaning the 14th location set for the 3rd breakpoint. You can specify " 735 "all the locations of a breakpoint by just indicating the major breakpoint " 736 "number. A valid breakpoint id consists either of just the major id number, " 737 "or the major number, a dot, and the location number (e.g. 3 or 3.2 could " 738 "both be valid breakpoint ids)."; 739 } 740 741 static const char * 742 BreakpointIDRangeHelpTextCallback () 743 { 744 return "A 'breakpoint id list' is a manner of specifying multiple breakpoints. " 745 "This can be done through several mechanisms. The easiest way is to just " 746 "enter a space-separated list of breakpoint ids. To specify all the " 747 "breakpoint locations under a major breakpoint, you can use the major " 748 "breakpoint number followed by '.*', eg. '5.*' means all the locations under " 749 "breakpoint 5. You can also indicate a range of breakpoints by using " 750 "<start-bp-id> - <end-bp-id>. The start-bp-id and end-bp-id for a range can " 751 "be any valid breakpoint ids. It is not legal, however, to specify a range " 752 "using specific locations that cross major breakpoint numbers. I.e. 3.2 - 3.7" 753 " is legal; 2 - 5 is legal; but 3.2 - 4.4 is not legal."; 754 } 755 756 static const char * 757 BreakpointNameHelpTextCallback () 758 { 759 return "A name that can be added to a breakpoint when it is created, or later " 760 "on with the \"breakpoint name add\" command. " 761 "Breakpoint names can be used to specify breakpoints in all the places breakpoint ID's " 762 "and breakpoint ID ranges can be used. As such they provide a convenient way to group breakpoints, " 763 "and to operate on breakpoints you create without having to track the breakpoint number. " 764 "Note, the attributes you set when using a breakpoint name in a breakpoint command don't " 765 "adhere to the name, but instead are set individually on all the breakpoints currently tagged with that name. Future breakpoints " 766 "tagged with that name will not pick up the attributes previously given using that name. " 767 "In order to distinguish breakpoint names from breakpoint ID's and ranges, " 768 "names must start with a letter from a-z or A-Z and cannot contain spaces, \".\" or \"-\". " 769 "Also, breakpoint names can only be applied to breakpoints, not to breakpoint locations."; 770 } 771 772 static const char * 773 GDBFormatHelpTextCallback () 774 { 775 return "A GDB format consists of a repeat count, a format letter and a size letter. " 776 "The repeat count is optional and defaults to 1. The format letter is optional " 777 "and defaults to the previous format that was used. The size letter is optional " 778 "and defaults to the previous size that was used.\n" 779 "\n" 780 "Format letters include:\n" 781 "o - octal\n" 782 "x - hexadecimal\n" 783 "d - decimal\n" 784 "u - unsigned decimal\n" 785 "t - binary\n" 786 "f - float\n" 787 "a - address\n" 788 "i - instruction\n" 789 "c - char\n" 790 "s - string\n" 791 "T - OSType\n" 792 "A - float as hex\n" 793 "\n" 794 "Size letters include:\n" 795 "b - 1 byte (byte)\n" 796 "h - 2 bytes (halfword)\n" 797 "w - 4 bytes (word)\n" 798 "g - 8 bytes (giant)\n" 799 "\n" 800 "Example formats:\n" 801 "32xb - show 32 1 byte hexadecimal integer values\n" 802 "16xh - show 16 2 byte hexadecimal integer values\n" 803 "64 - show 64 2 byte hexadecimal integer values (format and size from the last format)\n" 804 "dw - show 1 4 byte decimal integer value\n" 805 ; 806 } 807 808 static const char * 809 FormatHelpTextCallback () 810 { 811 812 static char* help_text_ptr = nullptr; 813 814 if (help_text_ptr) 815 return help_text_ptr; 816 817 StreamString sstr; 818 sstr << "One of the format names (or one-character names) that can be used to show a variable's value:\n"; 819 for (Format f = eFormatDefault; f < kNumFormats; f = Format(f+1)) 820 { 821 if (f != eFormatDefault) 822 sstr.PutChar('\n'); 823 824 char format_char = FormatManager::GetFormatAsFormatChar(f); 825 if (format_char) 826 sstr.Printf("'%c' or ", format_char); 827 828 sstr.Printf ("\"%s\"", FormatManager::GetFormatAsCString(f)); 829 } 830 831 sstr.Flush(); 832 833 std::string data = sstr.GetString(); 834 835 help_text_ptr = new char[data.length()+1]; 836 837 data.copy(help_text_ptr, data.length()); 838 839 return help_text_ptr; 840 } 841 842 static const char * 843 LanguageTypeHelpTextCallback () 844 { 845 static char* help_text_ptr = nullptr; 846 847 if (help_text_ptr) 848 return help_text_ptr; 849 850 StreamString sstr; 851 sstr << "One of the following languages:\n"; 852 853 Language::PrintAllLanguages(sstr, " ", "\n"); 854 855 sstr.Flush(); 856 857 std::string data = sstr.GetString(); 858 859 help_text_ptr = new char[data.length()+1]; 860 861 data.copy(help_text_ptr, data.length()); 862 863 return help_text_ptr; 864 } 865 866 static const char * 867 SummaryStringHelpTextCallback() 868 { 869 return 870 "A summary string is a way to extract information from variables in order to present them using a summary.\n" 871 "Summary strings contain static text, variables, scopes and control sequences:\n" 872 " - Static text can be any sequence of non-special characters, i.e. anything but '{', '}', '$', or '\\'.\n" 873 " - Variables are sequences of characters beginning with ${, ending with } and that contain symbols in the format described below.\n" 874 " - Scopes are any sequence of text between { and }. Anything included in a scope will only appear in the output summary if there were no errors.\n" 875 " - Control sequences are the usual C/C++ '\\a', '\\n', ..., plus '\\$', '\\{' and '\\}'.\n" 876 "A summary string works by copying static text verbatim, turning control sequences into their character counterpart, expanding variables and trying to expand scopes.\n" 877 "A variable is expanded by giving it a value other than its textual representation, and the way this is done depends on what comes after the ${ marker.\n" 878 "The most common sequence if ${var followed by an expression path, which is the text one would type to access a member of an aggregate types, given a variable of that type" 879 " (e.g. if type T has a member named x, which has a member named y, and if t is of type T, the expression path would be .x.y and the way to fit that into a summary string would be" 880 " ${var.x.y}). You can also use ${*var followed by an expression path and in that case the object referred by the path will be dereferenced before being displayed." 881 " If the object is not a pointer, doing so will cause an error. For additional details on expression paths, you can type 'help expr-path'. \n" 882 "By default, summary strings attempt to display the summary for any variable they reference, and if that fails the value. If neither can be shown, nothing is displayed." 883 "In a summary string, you can also use an array index [n], or a slice-like range [n-m]. This can have two different meanings depending on what kind of object the expression" 884 " path refers to:\n" 885 " - if it is a scalar type (any basic type like int, float, ...) the expression is a bitfield, i.e. the bits indicated by the indexing operator are extracted out of the number" 886 " and displayed as an individual variable\n" 887 " - if it is an array or pointer the array items indicated by the indexing operator are shown as the result of the variable. if the expression is an array, real array items are" 888 " printed; if it is a pointer, the pointer-as-array syntax is used to obtain the values (this means, the latter case can have no range checking)\n" 889 "If you are trying to display an array for which the size is known, you can also use [] instead of giving an exact range. This has the effect of showing items 0 thru size - 1.\n" 890 "Additionally, a variable can contain an (optional) format code, as in ${var.x.y%code}, where code can be any of the valid formats described in 'help format', or one of the" 891 " special symbols only allowed as part of a variable:\n" 892 " %V: show the value of the object by default\n" 893 " %S: show the summary of the object by default\n" 894 " %@: show the runtime-provided object description (for Objective-C, it calls NSPrintForDebugger; for C/C++ it does nothing)\n" 895 " %L: show the location of the object (memory address or a register name)\n" 896 " %#: show the number of children of the object\n" 897 " %T: show the type of the object\n" 898 "Another variable that you can use in summary strings is ${svar . This sequence works exactly like ${var, including the fact that ${*svar is an allowed sequence, but uses" 899 " the object's synthetic children provider instead of the actual objects. For instance, if you are using STL synthetic children providers, the following summary string would" 900 " count the number of actual elements stored in an std::list:\n" 901 "type summary add -s \"${svar%#}\" -x \"std::list<\""; 902 } 903 904 static const char * 905 ExprPathHelpTextCallback() 906 { 907 return 908 "An expression path is the sequence of symbols that is used in C/C++ to access a member variable of an aggregate object (class).\n" 909 "For instance, given a class:\n" 910 " class foo {\n" 911 " int a;\n" 912 " int b; .\n" 913 " foo* next;\n" 914 " };\n" 915 "the expression to read item b in the item pointed to by next for foo aFoo would be aFoo.next->b.\n" 916 "Given that aFoo could just be any object of type foo, the string '.next->b' is the expression path, because it can be attached to any foo instance to achieve the effect.\n" 917 "Expression paths in LLDB include dot (.) and arrow (->) operators, and most commands using expression paths have ways to also accept the star (*) operator.\n" 918 "The meaning of these operators is the same as the usual one given to them by the C/C++ standards.\n" 919 "LLDB also has support for indexing ([ ]) in expression paths, and extends the traditional meaning of the square brackets operator to allow bitfield extraction:\n" 920 "for objects of native types (int, float, char, ...) saying '[n-m]' as an expression path (where n and m are any positive integers, e.g. [3-5]) causes LLDB to extract" 921 " bits n thru m from the value of the variable. If n == m, [n] is also allowed as a shortcut syntax. For arrays and pointers, expression paths can only contain one index" 922 " and the meaning of the operation is the same as the one defined by C/C++ (item extraction). Some commands extend bitfield-like syntax for arrays and pointers with the" 923 " meaning of array slicing (taking elements n thru m inside the array or pointed-to memory)."; 924 } 925 926 void 927 CommandObject::FormatLongHelpText (Stream &output_strm, const char *long_help) 928 { 929 CommandInterpreter& interpreter = GetCommandInterpreter(); 930 std::stringstream lineStream (long_help); 931 std::string line; 932 while (std::getline (lineStream, line)) { 933 if (line.empty()) { 934 output_strm << "\n"; 935 continue; 936 } 937 size_t result = line.find_first_not_of (" \t"); 938 if (result == std::string::npos) { 939 result = 0; 940 } 941 std::string whitespace_prefix = line.substr (0, result); 942 std::string remainder = line.substr (result); 943 interpreter.OutputFormattedHelpText(output_strm, whitespace_prefix.c_str(), remainder.c_str()); 944 } 945 } 946 947 void 948 CommandObject::GenerateHelpText (CommandReturnObject &result) 949 { 950 GenerateHelpText(result.GetOutputStream()); 951 952 result.SetStatus (eReturnStatusSuccessFinishNoResult); 953 } 954 955 void 956 CommandObject::GenerateHelpText (Stream &output_strm) 957 { 958 CommandInterpreter& interpreter = GetCommandInterpreter(); 959 if (GetOptions() != nullptr) 960 { 961 if (WantsRawCommandString()) 962 { 963 std::string help_text (GetHelp()); 964 help_text.append (" This command takes 'raw' input (no need to quote stuff)."); 965 interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1); 966 } 967 else 968 interpreter.OutputFormattedHelpText (output_strm, "", "", GetHelp(), 1); 969 output_strm.Printf ("\nSyntax: %s\n", GetSyntax()); 970 GetOptions()->GenerateOptionUsage (output_strm, this); 971 const char *long_help = GetHelpLong(); 972 if ((long_help != nullptr) 973 && (strlen (long_help) > 0)) 974 FormatLongHelpText (output_strm, long_help); 975 if (WantsRawCommandString() && !WantsCompletion()) 976 { 977 // Emit the message about using ' -- ' between the end of the command options and the raw input 978 // conditionally, i.e., only if the command object does not want completion. 979 interpreter.OutputFormattedHelpText (output_strm, "", "", 980 "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options" 981 " you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1); 982 } 983 else if (GetNumArgumentEntries() > 0 984 && GetOptions() 985 && GetOptions()->NumCommandOptions() > 0) 986 { 987 // Also emit a warning about using "--" in case you are using a command that takes options and arguments. 988 interpreter.OutputFormattedHelpText (output_strm, "", "", 989 "\nThis command takes options and free-form arguments. If your arguments resemble" 990 " option specifiers (i.e., they start with a - or --), you must use ' -- ' between" 991 " the end of the command options and the beginning of the arguments.", 1); 992 } 993 } 994 else if (IsMultiwordObject()) 995 { 996 if (WantsRawCommandString()) 997 { 998 std::string help_text (GetHelp()); 999 help_text.append (" This command takes 'raw' input (no need to quote stuff)."); 1000 interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1); 1001 } 1002 else 1003 interpreter.OutputFormattedHelpText (output_strm, "", "", GetHelp(), 1); 1004 GenerateHelpText (output_strm); 1005 } 1006 else 1007 { 1008 const char *long_help = GetHelpLong(); 1009 if ((long_help != nullptr) 1010 && (strlen (long_help) > 0)) 1011 FormatLongHelpText (output_strm, long_help); 1012 else if (WantsRawCommandString()) 1013 { 1014 std::string help_text (GetHelp()); 1015 help_text.append (" This command takes 'raw' input (no need to quote stuff)."); 1016 interpreter.OutputFormattedHelpText (output_strm, "", "", help_text.c_str(), 1); 1017 } 1018 else 1019 interpreter.OutputFormattedHelpText (output_strm, "", "", GetHelp(), 1); 1020 output_strm.Printf ("\nSyntax: %s\n", GetSyntax()); 1021 } 1022 } 1023 1024 void 1025 CommandObject::AddIDsArgumentData(CommandArgumentEntry &arg, CommandArgumentType ID, CommandArgumentType IDRange) 1026 { 1027 CommandArgumentData id_arg; 1028 CommandArgumentData id_range_arg; 1029 1030 // Create the first variant for the first (and only) argument for this command. 1031 id_arg.arg_type = ID; 1032 id_arg.arg_repetition = eArgRepeatOptional; 1033 1034 // Create the second variant for the first (and only) argument for this command. 1035 id_range_arg.arg_type = IDRange; 1036 id_range_arg.arg_repetition = eArgRepeatOptional; 1037 1038 // The first (and only) argument for this command could be either an id or an id_range. 1039 // Push both variants into the entry for the first argument for this command. 1040 arg.push_back(id_arg); 1041 arg.push_back(id_range_arg); 1042 } 1043 1044 const char * 1045 CommandObject::GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type) 1046 { 1047 assert(arg_type < eArgTypeLastArg && "Invalid argument type passed to GetArgumentTypeAsCString"); 1048 return g_arguments_data[arg_type].arg_name; 1049 } 1050 1051 const char * 1052 CommandObject::GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type) 1053 { 1054 assert(arg_type < eArgTypeLastArg && "Invalid argument type passed to GetArgumentDescriptionAsCString"); 1055 return g_arguments_data[arg_type].help_text; 1056 } 1057 1058 Target * 1059 CommandObject::GetDummyTarget() 1060 { 1061 return m_interpreter.GetDebugger().GetDummyTarget(); 1062 } 1063 1064 Target * 1065 CommandObject::GetSelectedOrDummyTarget(bool prefer_dummy) 1066 { 1067 return m_interpreter.GetDebugger().GetSelectedOrDummyTarget(prefer_dummy); 1068 } 1069 1070 bool 1071 CommandObjectParsed::Execute (const char *args_string, CommandReturnObject &result) 1072 { 1073 bool handled = false; 1074 Args cmd_args (args_string); 1075 if (HasOverrideCallback()) 1076 { 1077 Args full_args (GetCommandName ()); 1078 full_args.AppendArguments(cmd_args); 1079 handled = InvokeOverrideCallback (full_args.GetConstArgumentVector(), result); 1080 } 1081 if (!handled) 1082 { 1083 for (size_t i = 0; i < cmd_args.GetArgumentCount(); ++i) 1084 { 1085 const char *tmp_str = cmd_args.GetArgumentAtIndex (i); 1086 if (tmp_str[0] == '`') // back-quote 1087 cmd_args.ReplaceArgumentAtIndex (i, m_interpreter.ProcessEmbeddedScriptCommands (tmp_str)); 1088 } 1089 1090 if (CheckRequirements(result)) 1091 { 1092 if (ParseOptions (cmd_args, result)) 1093 { 1094 // Call the command-specific version of 'Execute', passing it the already processed arguments. 1095 handled = DoExecute (cmd_args, result); 1096 } 1097 } 1098 1099 Cleanup(); 1100 } 1101 return handled; 1102 } 1103 1104 bool 1105 CommandObjectRaw::Execute (const char *args_string, CommandReturnObject &result) 1106 { 1107 bool handled = false; 1108 if (HasOverrideCallback()) 1109 { 1110 std::string full_command (GetCommandName ()); 1111 full_command += ' '; 1112 full_command += args_string; 1113 const char *argv[2] = { nullptr, nullptr }; 1114 argv[0] = full_command.c_str(); 1115 handled = InvokeOverrideCallback (argv, result); 1116 } 1117 if (!handled) 1118 { 1119 if (CheckRequirements(result)) 1120 handled = DoExecute (args_string, result); 1121 1122 Cleanup(); 1123 } 1124 return handled; 1125 } 1126 1127 static 1128 const char *arch_helper() 1129 { 1130 static StreamString g_archs_help; 1131 if (g_archs_help.Empty()) 1132 { 1133 StringList archs; 1134 ArchSpec::AutoComplete(nullptr, archs); 1135 g_archs_help.Printf("These are the supported architecture names:\n"); 1136 archs.Join("\n", g_archs_help); 1137 } 1138 return g_archs_help.GetData(); 1139 } 1140 1141 CommandObject::ArgumentTableEntry 1142 CommandObject::g_arguments_data[] = 1143 { 1144 { eArgTypeAddress, "address", CommandCompletions::eNoCompletion, { nullptr, false }, "A valid address in the target program's execution space." }, 1145 { eArgTypeAddressOrExpression, "address-expression", CommandCompletions::eNoCompletion, { nullptr, false }, "An expression that resolves to an address." }, 1146 { eArgTypeAliasName, "alias-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of an abbreviation (alias) for a debugger command." }, 1147 { eArgTypeAliasOptions, "options-for-aliased-command", CommandCompletions::eNoCompletion, { nullptr, false }, "Command options to be used as part of an alias (abbreviation) definition. (See 'help commands alias' for more information.)" }, 1148 { eArgTypeArchitecture, "arch", CommandCompletions::eArchitectureCompletion, { arch_helper, true }, "The architecture name, e.g. i386 or x86_64." }, 1149 { eArgTypeBoolean, "boolean", CommandCompletions::eNoCompletion, { nullptr, false }, "A Boolean value: 'true' or 'false'" }, 1150 { eArgTypeBreakpointID, "breakpt-id", CommandCompletions::eNoCompletion, { BreakpointIDHelpTextCallback, false }, nullptr }, 1151 { eArgTypeBreakpointIDRange, "breakpt-id-list", CommandCompletions::eNoCompletion, { BreakpointIDRangeHelpTextCallback, false }, nullptr }, 1152 { eArgTypeBreakpointName, "breakpoint-name", CommandCompletions::eNoCompletion, { BreakpointNameHelpTextCallback, false }, nullptr }, 1153 { eArgTypeByteSize, "byte-size", CommandCompletions::eNoCompletion, { nullptr, false }, "Number of bytes to use." }, 1154 { eArgTypeClassName, "class-name", CommandCompletions::eNoCompletion, { nullptr, false }, "Then name of a class from the debug information in the program." }, 1155 { eArgTypeCommandName, "cmd-name", CommandCompletions::eNoCompletion, { nullptr, false }, "A debugger command (may be multiple words), without any options or arguments." }, 1156 { eArgTypeCount, "count", CommandCompletions::eNoCompletion, { nullptr, false }, "An unsigned integer." }, 1157 { eArgTypeDirectoryName, "directory", CommandCompletions::eDiskDirectoryCompletion, { nullptr, false }, "A directory name." }, 1158 { eArgTypeDisassemblyFlavor, "disassembly-flavor", CommandCompletions::eNoCompletion, { nullptr, false }, "A disassembly flavor recognized by your disassembly plugin. Currently the only valid options are \"att\" and \"intel\" for Intel targets" }, 1159 { eArgTypeDescriptionVerbosity, "description-verbosity", CommandCompletions::eNoCompletion, { nullptr, false }, "How verbose the output of 'po' should be." }, 1160 { eArgTypeEndAddress, "end-address", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1161 { eArgTypeExpression, "expr", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1162 { eArgTypeExpressionPath, "expr-path", CommandCompletions::eNoCompletion, { ExprPathHelpTextCallback, true }, nullptr }, 1163 { eArgTypeExprFormat, "expression-format", CommandCompletions::eNoCompletion, { nullptr, false }, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]" }, 1164 { eArgTypeFilename, "filename", CommandCompletions::eDiskFileCompletion, { nullptr, false }, "The name of a file (can include path)." }, 1165 { eArgTypeFormat, "format", CommandCompletions::eNoCompletion, { FormatHelpTextCallback, true }, nullptr }, 1166 { eArgTypeFrameIndex, "frame-index", CommandCompletions::eNoCompletion, { nullptr, false }, "Index into a thread's list of frames." }, 1167 { eArgTypeFullName, "fullname", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1168 { eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a function." }, 1169 { eArgTypeFunctionOrSymbol, "function-or-symbol", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a function or symbol." }, 1170 { eArgTypeGDBFormat, "gdb-format", CommandCompletions::eNoCompletion, { GDBFormatHelpTextCallback, true }, nullptr }, 1171 { eArgTypeHelpText, "help-text", CommandCompletions::eNoCompletion, { nullptr, false }, "Text to be used as help for some other entity in LLDB" }, 1172 { eArgTypeIndex, "index", CommandCompletions::eNoCompletion, { nullptr, false }, "An index into a list." }, 1173 { eArgTypeLanguage, "language", CommandCompletions::eNoCompletion, { LanguageTypeHelpTextCallback, true }, nullptr }, 1174 { eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, { nullptr, false }, "Line number in a source file." }, 1175 { eArgTypeLogCategory, "log-category", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, 1176 { eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." }, 1177 { eArgTypeMethod, "method", CommandCompletions::eNoCompletion, { nullptr, false }, "A C++ method name." }, 1178 { eArgTypeName, "name", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1179 { eArgTypeNewPathPrefix, "new-path-prefix", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1180 { eArgTypeNumLines, "num-lines", CommandCompletions::eNoCompletion, { nullptr, false }, "The number of lines to use." }, 1181 { eArgTypeNumberPerLine, "number-per-line", CommandCompletions::eNoCompletion, { nullptr, false }, "The number of items per line to display." }, 1182 { eArgTypeOffset, "offset", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1183 { eArgTypeOldPathPrefix, "old-path-prefix", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1184 { eArgTypeOneLiner, "one-line-command", CommandCompletions::eNoCompletion, { nullptr, false }, "A command that is entered as a single line of text." }, 1185 { eArgTypePath, "path", CommandCompletions::eDiskFileCompletion, { nullptr, false }, "Path." }, 1186 { eArgTypePermissionsNumber, "perms-numeric", CommandCompletions::eNoCompletion, { nullptr, false }, "Permissions given as an octal number (e.g. 755)." }, 1187 { eArgTypePermissionsString, "perms=string", CommandCompletions::eNoCompletion, { nullptr, false }, "Permissions given as a string value (e.g. rw-r-xr--)." }, 1188 { eArgTypePid, "pid", CommandCompletions::eNoCompletion, { nullptr, false }, "The process ID number." }, 1189 { eArgTypePlugin, "plugin", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1190 { eArgTypeProcessName, "process-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of the process." }, 1191 { eArgTypePythonClass, "python-class", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a Python class." }, 1192 { eArgTypePythonFunction, "python-function", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a Python function." }, 1193 { eArgTypePythonScript, "python-script", CommandCompletions::eNoCompletion, { nullptr, false }, "Source code written in Python." }, 1194 { eArgTypeQueueName, "queue-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of the thread queue." }, 1195 { eArgTypeRegisterName, "register-name", CommandCompletions::eNoCompletion, { RegisterNameHelpTextCallback, true }, nullptr }, 1196 { eArgTypeRegularExpression, "regular-expression", CommandCompletions::eNoCompletion, { nullptr, false }, "A regular expression." }, 1197 { eArgTypeRunArgs, "run-args", CommandCompletions::eNoCompletion, { nullptr, false }, "Arguments to be passed to the target program when it starts executing." }, 1198 { eArgTypeRunMode, "run-mode", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1199 { eArgTypeScriptedCommandSynchronicity, "script-cmd-synchronicity", CommandCompletions::eNoCompletion, { nullptr, false }, "The synchronicity to use to run scripted commands with regard to LLDB event system." }, 1200 { eArgTypeScriptLang, "script-language", CommandCompletions::eNoCompletion, { nullptr, false }, "The scripting language to be used for script-based commands. Currently only Python is valid." }, 1201 { eArgTypeSearchWord, "search-word", CommandCompletions::eNoCompletion, { nullptr, false }, "The word for which you wish to search for information about." }, 1202 { eArgTypeSelector, "selector", CommandCompletions::eNoCompletion, { nullptr, false }, "An Objective-C selector name." }, 1203 { eArgTypeSettingIndex, "setting-index", CommandCompletions::eNoCompletion, { nullptr, false }, "An index into a settings variable that is an array (try 'settings list' to see all the possible settings variables and their types)." }, 1204 { eArgTypeSettingKey, "setting-key", CommandCompletions::eNoCompletion, { nullptr, false }, "A key into a settings variables that is a dictionary (try 'settings list' to see all the possible settings variables and their types)." }, 1205 { eArgTypeSettingPrefix, "setting-prefix", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a settable internal debugger variable up to a dot ('.'), e.g. 'target.process.'" }, 1206 { eArgTypeSettingVariableName, "setting-variable-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a settable internal debugger variable. Type 'settings list' to see a complete list of such variables." }, 1207 { eArgTypeShlibName, "shlib-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a shared library." }, 1208 { eArgTypeSourceFile, "source-file", CommandCompletions::eSourceFileCompletion, { nullptr, false }, "The name of a source file.." }, 1209 { eArgTypeSortOrder, "sort-order", CommandCompletions::eNoCompletion, { nullptr, false }, "Specify a sort order when dumping lists." }, 1210 { eArgTypeStartAddress, "start-address", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1211 { eArgTypeSummaryString, "summary-string", CommandCompletions::eNoCompletion, { SummaryStringHelpTextCallback, true }, nullptr }, 1212 { eArgTypeSymbol, "symbol", CommandCompletions::eSymbolCompletion, { nullptr, false }, "Any symbol name (function name, variable, argument, etc.)" }, 1213 { eArgTypeThreadID, "thread-id", CommandCompletions::eNoCompletion, { nullptr, false }, "Thread ID number." }, 1214 { eArgTypeThreadIndex, "thread-index", CommandCompletions::eNoCompletion, { nullptr, false }, "Index into the process' list of threads." }, 1215 { eArgTypeThreadName, "thread-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The thread's name." }, 1216 { eArgTypeTypeName, "type-name", CommandCompletions::eNoCompletion, { nullptr, false }, "A type name." }, 1217 { eArgTypeUnsignedInteger, "unsigned-integer", CommandCompletions::eNoCompletion, { nullptr, false }, "An unsigned integer." }, 1218 { eArgTypeUnixSignal, "unix-signal", CommandCompletions::eNoCompletion, { nullptr, false }, "A valid Unix signal name or number (e.g. SIGKILL, KILL or 9)." }, 1219 { eArgTypeVarName, "variable-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of a variable in your program." }, 1220 { eArgTypeValue, "value", CommandCompletions::eNoCompletion, { nullptr, false }, "A value could be anything, depending on where and how it is used." }, 1221 { eArgTypeWidth, "width", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, 1222 { eArgTypeNone, "none", CommandCompletions::eNoCompletion, { nullptr, false }, "No help available for this." }, 1223 { eArgTypePlatform, "platform-name", CommandCompletions::ePlatformPluginCompletion, { nullptr, false }, "The name of an installed platform plug-in . Type 'platform list' to see a complete list of installed platforms." }, 1224 { eArgTypeWatchpointID, "watchpt-id", CommandCompletions::eNoCompletion, { nullptr, false }, "Watchpoint IDs are positive integers." }, 1225 { eArgTypeWatchpointIDRange, "watchpt-id-list", CommandCompletions::eNoCompletion, { nullptr, false }, "For example, '1-3' or '1 to 3'." }, 1226 { eArgTypeWatchType, "watch-type", CommandCompletions::eNoCompletion, { nullptr, false }, "Specify the type for a watchpoint." } 1227 }; 1228 1229 const CommandObject::ArgumentTableEntry* 1230 CommandObject::GetArgumentTable () 1231 { 1232 // If this assertion fires, then the table above is out of date with the CommandArgumentType enumeration 1233 assert ((sizeof (CommandObject::g_arguments_data) / sizeof (CommandObject::ArgumentTableEntry)) == eArgTypeLastArg); 1234 return CommandObject::g_arguments_data; 1235 } 1236 1237 1238