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