1 //===-- CommandObjectSource.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/lldb-python.h" 11 12 #include "CommandObjectSource.h" 13 14 // C Includes 15 // C++ Includes 16 // Other libraries and framework includes 17 // Project includes 18 #include "lldb/Interpreter/Args.h" 19 #include "lldb/Core/Debugger.h" 20 #include "lldb/Core/FileLineResolver.h" 21 #include "lldb/Core/Module.h" 22 #include "lldb/Core/ModuleSpec.h" 23 #include "lldb/Core/SourceManager.h" 24 #include "lldb/Interpreter/CommandInterpreter.h" 25 #include "lldb/Interpreter/CommandReturnObject.h" 26 #include "lldb/Host/FileSpec.h" 27 #include "lldb/Symbol/CompileUnit.h" 28 #include "lldb/Symbol/Function.h" 29 #include "lldb/Target/Process.h" 30 #include "lldb/Target/TargetList.h" 31 #include "lldb/Interpreter/CommandCompletions.h" 32 #include "lldb/Interpreter/Options.h" 33 34 using namespace lldb; 35 using namespace lldb_private; 36 37 //------------------------------------------------------------------------- 38 // CommandObjectSourceInfo 39 //------------------------------------------------------------------------- 40 41 class CommandObjectSourceInfo : public CommandObjectParsed 42 { 43 44 class CommandOptions : public Options 45 { 46 public: 47 CommandOptions (CommandInterpreter &interpreter) : 48 Options(interpreter) 49 { 50 } 51 52 ~CommandOptions () 53 { 54 } 55 56 Error 57 SetOptionValue (uint32_t option_idx, const char *option_arg) 58 { 59 Error error; 60 const int short_option = g_option_table[option_idx].short_option; 61 switch (short_option) 62 { 63 case 'l': 64 start_line = Args::StringToUInt32 (option_arg, 0); 65 if (start_line == 0) 66 error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg); 67 break; 68 69 case 'f': 70 file_name = option_arg; 71 break; 72 73 default: 74 error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); 75 break; 76 } 77 78 return error; 79 } 80 81 void 82 OptionParsingStarting () 83 { 84 file_spec.Clear(); 85 file_name.clear(); 86 start_line = 0; 87 } 88 89 const OptionDefinition* 90 GetDefinitions () 91 { 92 return g_option_table; 93 } 94 static OptionDefinition g_option_table[]; 95 96 // Instance variables to hold the values for command options. 97 FileSpec file_spec; 98 std::string file_name; 99 uint32_t start_line; 100 101 }; 102 103 public: 104 CommandObjectSourceInfo(CommandInterpreter &interpreter) : 105 CommandObjectParsed (interpreter, 106 "source info", 107 "Display information about the source lines from the current executable's debug info.", 108 "source info [<cmd-options>]"), 109 m_options (interpreter) 110 { 111 } 112 113 ~CommandObjectSourceInfo () 114 { 115 } 116 117 118 Options * 119 GetOptions () 120 { 121 return &m_options; 122 } 123 124 protected: 125 bool 126 DoExecute (Args& command, CommandReturnObject &result) 127 { 128 result.AppendError ("Not yet implemented"); 129 result.SetStatus (eReturnStatusFailed); 130 return false; 131 } 132 133 CommandOptions m_options; 134 }; 135 136 OptionDefinition 137 CommandObjectSourceInfo::CommandOptions::g_option_table[] = 138 { 139 { LLDB_OPT_SET_1, false, "line", 'l', required_argument, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."}, 140 { LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."}, 141 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } 142 }; 143 144 #pragma mark CommandObjectSourceList 145 //------------------------------------------------------------------------- 146 // CommandObjectSourceList 147 //------------------------------------------------------------------------- 148 149 class CommandObjectSourceList : public CommandObjectParsed 150 { 151 152 class CommandOptions : public Options 153 { 154 public: 155 CommandOptions (CommandInterpreter &interpreter) : 156 Options(interpreter) 157 { 158 } 159 160 ~CommandOptions () 161 { 162 } 163 164 Error 165 SetOptionValue (uint32_t option_idx, const char *option_arg) 166 { 167 Error error; 168 const int short_option = g_option_table[option_idx].short_option; 169 switch (short_option) 170 { 171 case 'l': 172 start_line = Args::StringToUInt32 (option_arg, 0); 173 if (start_line == 0) 174 error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg); 175 break; 176 177 case 'c': 178 num_lines = Args::StringToUInt32 (option_arg, 0); 179 if (num_lines == 0) 180 error.SetErrorStringWithFormat("invalid line count: '%s'", option_arg); 181 break; 182 183 case 'f': 184 file_name = option_arg; 185 break; 186 187 case 'n': 188 symbol_name = option_arg; 189 break; 190 191 case 'a': 192 { 193 ExecutionContext exe_ctx (m_interpreter.GetExecutionContext()); 194 address = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error); 195 } 196 break; 197 case 's': 198 modules.push_back (std::string (option_arg)); 199 break; 200 201 case 'b': 202 show_bp_locs = true; 203 break; 204 case 'r': 205 reverse = true; 206 break; 207 default: 208 error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); 209 break; 210 } 211 212 return error; 213 } 214 215 void 216 OptionParsingStarting () 217 { 218 file_spec.Clear(); 219 file_name.clear(); 220 symbol_name.clear(); 221 address = LLDB_INVALID_ADDRESS; 222 start_line = 0; 223 num_lines = 0; 224 show_bp_locs = false; 225 reverse = false; 226 modules.clear(); 227 } 228 229 const OptionDefinition* 230 GetDefinitions () 231 { 232 return g_option_table; 233 } 234 static OptionDefinition g_option_table[]; 235 236 // Instance variables to hold the values for command options. 237 FileSpec file_spec; 238 std::string file_name; 239 std::string symbol_name; 240 lldb::addr_t address; 241 uint32_t start_line; 242 uint32_t num_lines; 243 STLStringArray modules; 244 bool show_bp_locs; 245 bool reverse; 246 }; 247 248 public: 249 CommandObjectSourceList(CommandInterpreter &interpreter) : 250 CommandObjectParsed (interpreter, 251 "source list", 252 "Display source code (as specified) based on the current executable's debug info.", 253 NULL, 254 eFlagRequiresTarget), 255 m_options (interpreter) 256 { 257 } 258 259 ~CommandObjectSourceList () 260 { 261 } 262 263 264 Options * 265 GetOptions () 266 { 267 return &m_options; 268 } 269 270 virtual const char * 271 GetRepeatCommand (Args ¤t_command_args, uint32_t index) 272 { 273 // This is kind of gross, but the command hasn't been parsed yet so we can't look at the option 274 // values for this invocation... I have to scan the arguments directly. 275 size_t num_args = current_command_args.GetArgumentCount(); 276 bool is_reverse = false; 277 for (size_t i = 0 ; i < num_args; i++) 278 { 279 const char *arg = current_command_args.GetArgumentAtIndex(i); 280 if (arg && (strcmp(arg, "-r") == 0 || strcmp(arg, "--reverse") == 0)) 281 { 282 is_reverse = true; 283 } 284 } 285 if (is_reverse) 286 { 287 if (m_reverse_name.empty()) 288 { 289 m_reverse_name = m_cmd_name; 290 m_reverse_name.append (" -r"); 291 } 292 return m_reverse_name.c_str(); 293 } 294 else 295 return m_cmd_name.c_str(); 296 } 297 298 protected: 299 bool 300 DoExecute (Args& command, CommandReturnObject &result) 301 { 302 const size_t argc = command.GetArgumentCount(); 303 304 if (argc != 0) 305 { 306 result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n", GetCommandName()); 307 result.SetStatus (eReturnStatusFailed); 308 return false; 309 } 310 311 Target *target = m_exe_ctx.GetTargetPtr(); 312 313 SymbolContextList sc_list; 314 if (!m_options.symbol_name.empty()) 315 { 316 // Displaying the source for a symbol: 317 ConstString name(m_options.symbol_name.c_str()); 318 bool include_symbols = false; 319 bool include_inlines = true; 320 bool append = true; 321 size_t num_matches = 0; 322 323 if (m_options.num_lines == 0) 324 m_options.num_lines = 10; 325 326 const size_t num_modules = m_options.modules.size(); 327 if (num_modules > 0) 328 { 329 ModuleList matching_modules; 330 for (size_t i = 0; i < num_modules; ++i) 331 { 332 FileSpec module_file_spec(m_options.modules[i].c_str(), false); 333 if (module_file_spec) 334 { 335 ModuleSpec module_spec (module_file_spec); 336 matching_modules.Clear(); 337 target->GetImages().FindModules (module_spec, matching_modules); 338 num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list); 339 } 340 } 341 } 342 else 343 { 344 num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list); 345 } 346 347 SymbolContext sc; 348 349 if (num_matches == 0) 350 { 351 result.AppendErrorWithFormat("Could not find function named: \"%s\".\n", m_options.symbol_name.c_str()); 352 result.SetStatus (eReturnStatusFailed); 353 return false; 354 } 355 356 sc_list.GetContextAtIndex (0, sc); 357 FileSpec start_file; 358 uint32_t start_line; 359 uint32_t end_line; 360 FileSpec end_file; 361 if (sc.function != NULL) 362 { 363 sc.function->GetStartLineSourceInfo (start_file, start_line); 364 if (start_line == 0) 365 { 366 result.AppendErrorWithFormat("Could not find line information for start of function: \"%s\".\n", m_options.symbol_name.c_str()); 367 result.SetStatus (eReturnStatusFailed); 368 return false; 369 } 370 sc.function->GetEndLineSourceInfo (end_file, end_line); 371 } 372 else 373 { 374 result.AppendErrorWithFormat("Could not find function info for: \"%s\".\n", m_options.symbol_name.c_str()); 375 result.SetStatus (eReturnStatusFailed); 376 return false; 377 } 378 379 if (num_matches > 1) 380 { 381 // This could either be because there are multiple functions of this name, in which case 382 // we'll have to specify this further... Or it could be because there are multiple inlined instances 383 // of one function. So run through the matches and if they all have the same file & line then we can just 384 // list one. 385 386 bool found_multiple = false; 387 388 for (size_t i = 1; i < num_matches; i++) 389 { 390 SymbolContext scratch_sc; 391 sc_list.GetContextAtIndex (i, scratch_sc); 392 if (scratch_sc.function != NULL) 393 { 394 FileSpec scratch_file; 395 uint32_t scratch_line; 396 scratch_sc.function->GetStartLineSourceInfo (scratch_file, scratch_line); 397 if (scratch_file != start_file 398 || scratch_line != start_line) 399 { 400 found_multiple = true; 401 break; 402 } 403 } 404 } 405 if (found_multiple) 406 { 407 StreamString s; 408 for (size_t i = 0; i < num_matches; i++) 409 { 410 SymbolContext scratch_sc; 411 sc_list.GetContextAtIndex (i, scratch_sc); 412 if (scratch_sc.function != NULL) 413 { 414 s.Printf("\n%lu: ", i); 415 scratch_sc.function->Dump (&s, true); 416 } 417 } 418 result.AppendErrorWithFormat("Multiple functions found matching: %s: \n%s\n", 419 m_options.symbol_name.c_str(), 420 s.GetData()); 421 result.SetStatus (eReturnStatusFailed); 422 return false; 423 } 424 } 425 426 // This is a little hacky, but the first line table entry for a function points to the "{" that 427 // starts the function block. It would be nice to actually get the function 428 // declaration in there too. So back up a bit, but not further than what you're going to display. 429 uint32_t extra_lines; 430 if (m_options.num_lines >= 10) 431 extra_lines = 5; 432 else 433 extra_lines = m_options.num_lines/2; 434 uint32_t line_no; 435 if (start_line <= extra_lines) 436 line_no = 1; 437 else 438 line_no = start_line - extra_lines; 439 440 // For fun, if the function is shorter than the number of lines we're supposed to display, 441 // only display the function... 442 if (end_line != 0) 443 { 444 if (m_options.num_lines > end_line - line_no) 445 m_options.num_lines = end_line - line_no + extra_lines; 446 } 447 448 char path_buf[PATH_MAX]; 449 start_file.GetPath(path_buf, sizeof(path_buf)); 450 451 if (m_options.show_bp_locs) 452 { 453 const bool show_inlines = true; 454 m_breakpoint_locations.Reset (start_file, 0, show_inlines); 455 SearchFilter target_search_filter (m_exe_ctx.GetTargetSP()); 456 target_search_filter.Search (m_breakpoint_locations); 457 } 458 else 459 m_breakpoint_locations.Clear(); 460 461 result.AppendMessageWithFormat("File: %s\n", path_buf); 462 target->GetSourceManager().DisplaySourceLinesWithLineNumbers (start_file, 463 line_no, 464 0, 465 m_options.num_lines, 466 "", 467 &result.GetOutputStream(), 468 GetBreakpointLocations ()); 469 470 result.SetStatus (eReturnStatusSuccessFinishResult); 471 return true; 472 473 } 474 else if (m_options.address != LLDB_INVALID_ADDRESS) 475 { 476 SymbolContext sc; 477 Address so_addr; 478 StreamString error_strm; 479 480 if (target->GetSectionLoadList().IsEmpty()) 481 { 482 // The target isn't loaded yet, we need to lookup the file address 483 // in all modules 484 const ModuleList &module_list = target->GetImages(); 485 const size_t num_modules = module_list.GetSize(); 486 for (size_t i=0; i<num_modules; ++i) 487 { 488 ModuleSP module_sp (module_list.GetModuleAtIndex(i)); 489 if (module_sp && module_sp->ResolveFileAddress(m_options.address, so_addr)) 490 { 491 sc.Clear(true); 492 if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry) 493 sc_list.Append(sc); 494 } 495 } 496 497 if (sc_list.GetSize() == 0) 498 { 499 result.AppendErrorWithFormat("no modules have source information for file address 0x%" PRIx64 ".\n", 500 m_options.address); 501 result.SetStatus (eReturnStatusFailed); 502 return false; 503 } 504 } 505 else 506 { 507 // The target has some things loaded, resolve this address to a 508 // compile unit + file + line and display 509 if (target->GetSectionLoadList().ResolveLoadAddress (m_options.address, so_addr)) 510 { 511 ModuleSP module_sp (so_addr.GetModule()); 512 if (module_sp) 513 { 514 sc.Clear(true); 515 if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry) 516 { 517 sc_list.Append(sc); 518 } 519 else 520 { 521 so_addr.Dump(&error_strm, NULL, Address::DumpStyleModuleWithFileAddress); 522 result.AppendErrorWithFormat("address resolves to %s, but there is no line table information available for this address.\n", 523 error_strm.GetData()); 524 result.SetStatus (eReturnStatusFailed); 525 return false; 526 } 527 } 528 } 529 530 if (sc_list.GetSize() == 0) 531 { 532 result.AppendErrorWithFormat("no modules contain load address 0x%" PRIx64 ".\n", m_options.address); 533 result.SetStatus (eReturnStatusFailed); 534 return false; 535 } 536 } 537 uint32_t num_matches = sc_list.GetSize(); 538 for (uint32_t i=0; i<num_matches; ++i) 539 { 540 sc_list.GetContextAtIndex(i, sc); 541 if (sc.comp_unit) 542 { 543 if (m_options.show_bp_locs) 544 { 545 m_breakpoint_locations.Clear(); 546 const bool show_inlines = true; 547 m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines); 548 SearchFilter target_search_filter (target->shared_from_this()); 549 target_search_filter.Search (m_breakpoint_locations); 550 } 551 552 bool show_fullpaths = true; 553 bool show_module = true; 554 bool show_inlined_frames = true; 555 sc.DumpStopContext(&result.GetOutputStream(), 556 m_exe_ctx.GetBestExecutionContextScope(), 557 sc.line_entry.range.GetBaseAddress(), 558 show_fullpaths, 559 show_module, 560 show_inlined_frames); 561 result.GetOutputStream().EOL(); 562 563 if (m_options.num_lines == 0) 564 m_options.num_lines = 10; 565 566 size_t lines_to_back_up = m_options.num_lines >= 10 ? 5 : m_options.num_lines/2; 567 568 target->GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit, 569 sc.line_entry.line, 570 lines_to_back_up, 571 m_options.num_lines - lines_to_back_up, 572 "->", 573 &result.GetOutputStream(), 574 GetBreakpointLocations ()); 575 result.SetStatus (eReturnStatusSuccessFinishResult); 576 } 577 } 578 } 579 else if (m_options.file_name.empty()) 580 { 581 // Last valid source manager context, or the current frame if no 582 // valid last context in source manager. 583 // One little trick here, if you type the exact same list command twice in a row, it is 584 // more likely because you typed it once, then typed it again 585 if (m_options.start_line == 0) 586 { 587 if (target->GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream(), 588 m_options.num_lines, 589 m_options.reverse, 590 GetBreakpointLocations ())) 591 { 592 result.SetStatus (eReturnStatusSuccessFinishResult); 593 } 594 } 595 else 596 { 597 if (m_options.num_lines == 0) 598 m_options.num_lines = 10; 599 600 if (m_options.show_bp_locs) 601 { 602 SourceManager::FileSP last_file_sp (target->GetSourceManager().GetLastFile ()); 603 if (last_file_sp) 604 { 605 const bool show_inlines = true; 606 m_breakpoint_locations.Reset (last_file_sp->GetFileSpec(), 0, show_inlines); 607 SearchFilter target_search_filter (target->shared_from_this()); 608 target_search_filter.Search (m_breakpoint_locations); 609 } 610 } 611 else 612 m_breakpoint_locations.Clear(); 613 614 if (target->GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile( 615 m_options.start_line, // Line to display 616 m_options.num_lines, // Lines after line to 617 UINT32_MAX, // Don't mark "line" 618 "", // Don't mark "line" 619 &result.GetOutputStream(), 620 GetBreakpointLocations ())) 621 { 622 result.SetStatus (eReturnStatusSuccessFinishResult); 623 } 624 625 } 626 } 627 else 628 { 629 const char *filename = m_options.file_name.c_str(); 630 631 bool check_inlines = false; 632 SymbolContextList sc_list; 633 size_t num_matches = 0; 634 635 if (m_options.modules.size() > 0) 636 { 637 ModuleList matching_modules; 638 for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) 639 { 640 FileSpec module_file_spec(m_options.modules[i].c_str(), false); 641 if (module_file_spec) 642 { 643 ModuleSpec module_spec (module_file_spec); 644 matching_modules.Clear(); 645 target->GetImages().FindModules (module_spec, matching_modules); 646 num_matches += matching_modules.ResolveSymbolContextForFilePath (filename, 647 0, 648 check_inlines, 649 eSymbolContextModule | eSymbolContextCompUnit, 650 sc_list); 651 } 652 } 653 } 654 else 655 { 656 num_matches = target->GetImages().ResolveSymbolContextForFilePath (filename, 657 0, 658 check_inlines, 659 eSymbolContextModule | eSymbolContextCompUnit, 660 sc_list); 661 } 662 663 if (num_matches == 0) 664 { 665 result.AppendErrorWithFormat("Could not find source file \"%s\".\n", 666 m_options.file_name.c_str()); 667 result.SetStatus (eReturnStatusFailed); 668 return false; 669 } 670 671 if (num_matches > 1) 672 { 673 SymbolContext sc; 674 bool got_multiple = false; 675 FileSpec *test_cu_spec = NULL; 676 677 for (unsigned i = 0; i < num_matches; i++) 678 { 679 sc_list.GetContextAtIndex(i, sc); 680 if (sc.comp_unit) 681 { 682 if (test_cu_spec) 683 { 684 if (test_cu_spec != static_cast<FileSpec *> (sc.comp_unit)) 685 got_multiple = true; 686 break; 687 } 688 else 689 test_cu_spec = sc.comp_unit; 690 } 691 } 692 if (got_multiple) 693 { 694 result.AppendErrorWithFormat("Multiple source files found matching: \"%s.\"\n", 695 m_options.file_name.c_str()); 696 result.SetStatus (eReturnStatusFailed); 697 return false; 698 } 699 } 700 701 SymbolContext sc; 702 if (sc_list.GetContextAtIndex(0, sc)) 703 { 704 if (sc.comp_unit) 705 { 706 if (m_options.show_bp_locs) 707 { 708 const bool show_inlines = true; 709 m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines); 710 SearchFilter target_search_filter (target->shared_from_this()); 711 target_search_filter.Search (m_breakpoint_locations); 712 } 713 else 714 m_breakpoint_locations.Clear(); 715 716 if (m_options.num_lines == 0) 717 m_options.num_lines = 10; 718 719 target->GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit, 720 m_options.start_line, 721 0, 722 m_options.num_lines, 723 "", 724 &result.GetOutputStream(), 725 GetBreakpointLocations ()); 726 727 result.SetStatus (eReturnStatusSuccessFinishResult); 728 } 729 else 730 { 731 result.AppendErrorWithFormat("No comp unit found for: \"%s.\"\n", 732 m_options.file_name.c_str()); 733 result.SetStatus (eReturnStatusFailed); 734 return false; 735 } 736 } 737 } 738 return result.Succeeded(); 739 } 740 741 const SymbolContextList * 742 GetBreakpointLocations () 743 { 744 if (m_breakpoint_locations.GetFileLineMatches().GetSize() > 0) 745 return &m_breakpoint_locations.GetFileLineMatches(); 746 return NULL; 747 } 748 CommandOptions m_options; 749 FileLineResolver m_breakpoint_locations; 750 std::string m_reverse_name; 751 752 }; 753 754 OptionDefinition 755 CommandObjectSourceList::CommandOptions::g_option_table[] = 756 { 757 { LLDB_OPT_SET_ALL, false, "count", 'c', required_argument, NULL, 0, eArgTypeCount, "The number of source lines to display."}, 758 { LLDB_OPT_SET_1 | 759 LLDB_OPT_SET_2 , false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."}, 760 { LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', no_argument, NULL, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."}, 761 { LLDB_OPT_SET_1 , false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."}, 762 { LLDB_OPT_SET_1 , false, "line", 'l', required_argument, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."}, 763 { LLDB_OPT_SET_2 , false, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."}, 764 { LLDB_OPT_SET_3 , false, "address",'a', required_argument, NULL, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."}, 765 { LLDB_OPT_SET_4, false, "reverse", 'r', no_argument, NULL, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."}, 766 { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } 767 }; 768 769 #pragma mark CommandObjectMultiwordSource 770 771 //------------------------------------------------------------------------- 772 // CommandObjectMultiwordSource 773 //------------------------------------------------------------------------- 774 775 CommandObjectMultiwordSource::CommandObjectMultiwordSource (CommandInterpreter &interpreter) : 776 CommandObjectMultiword (interpreter, 777 "source", 778 "A set of commands for accessing source file information", 779 "source <subcommand> [<subcommand-options>]") 780 { 781 LoadSubCommand ("info", CommandObjectSP (new CommandObjectSourceInfo (interpreter))); 782 LoadSubCommand ("list", CommandObjectSP (new CommandObjectSourceList (interpreter))); 783 } 784 785 CommandObjectMultiwordSource::~CommandObjectMultiwordSource () 786 { 787 } 788 789