Module.h revision 6c5438bf1d7af0f0ef1e81a30ad53e3fe93c35a8
1//===-- Module.h ------------------------------------------------*- 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#ifndef liblldb_Module_h_ 11#define liblldb_Module_h_ 12 13#include "lldb/Core/ArchSpec.h" 14#include "lldb/Core/Section.h" 15#include "lldb/Core/UUID.h" 16#include "lldb/Symbol/ObjectFile.h" 17#include "lldb/Host/Mutex.h" 18#include "lldb/Host/TimeValue.h" 19#include "lldb/Symbol/ClangASTContext.h" 20#include "lldb/Symbol/CompileUnit.h" 21#include "lldb/Symbol/SymbolContext.h" 22#include "lldb/Symbol/Symtab.h" 23#include "lldb/Symbol/TypeList.h" 24 25//---------------------------------------------------------------------- 26/// @class Module Module.h "lldb/Core/Module.h" 27/// @brief A class that describes an executable image and its associated 28/// object and symbol files. 29/// 30/// The module is designed to be able to select a single slice of an 31/// executable image as it would appear on disk and during program 32/// execution. 33/// 34/// Modules control when and if information is parsed according to which 35/// accessors are called. For example the object file (ObjectFile) 36/// representation will only be parsed if the object file is requested 37/// using the Module::GetObjectFile() is called. The debug symbols 38/// will only be parsed if the symbol vendor (SymbolVendor) is 39/// requested using the Module::GetSymbolVendor() is called. 40/// 41/// The module will parse more detailed information as more queries are 42/// made. 43//---------------------------------------------------------------------- 44namespace lldb_private { 45 46class Module : 47 public std::tr1::enable_shared_from_this<Module>, 48 public SymbolContextScope 49{ 50public: 51 friend class ModuleList; 52 friend bool ObjectFile::SetModulesArchitecture (const ArchSpec &new_arch); 53 54 // Static functions that can track the lifetime of moodule objects. 55 // This is handy because we might have Module objects that are in 56 // shared pointers that aren't in the global module list (from 57 // ModuleList). If this is the case we need to know about it. 58 // The modules in the global list maintained by these functions 59 // can be viewed using the "target modules list" command using the 60 // "--global" (-g for short). 61 static size_t 62 GetNumberAllocatedModules (); 63 64 static Module * 65 GetAllocatedModuleAtIndex (size_t idx); 66 67 static Mutex * 68 GetAllocationModuleCollectionMutex(); 69 70 //------------------------------------------------------------------ 71 /// Construct with file specification and architecture. 72 /// 73 /// Clients that wish to share modules with other targets should 74 /// use ModuleList::GetSharedModule(). 75 /// 76 /// @param[in] file_spec 77 /// The file specification for the on disk repesentation of 78 /// this executable image. 79 /// 80 /// @param[in] arch 81 /// The architecture to set as the current architecture in 82 /// this module. 83 /// 84 /// @param[in] object_name 85 /// The name of an object in a module used to extract a module 86 /// within a module (.a files and modules that contain multiple 87 /// architectures). 88 /// 89 /// @param[in] object_offset 90 /// The offset within an existing module used to extract a 91 /// module within a module (.a files and modules that contain 92 /// multiple architectures). 93 //------------------------------------------------------------------ 94 Module (const FileSpec& file_spec, 95 const ArchSpec& arch, 96 const ConstString *object_name = NULL, 97 off_t object_offset = 0); 98 99 //------------------------------------------------------------------ 100 /// Destructor. 101 //------------------------------------------------------------------ 102 virtual 103 ~Module (); 104 105 106 //------------------------------------------------------------------ 107 /// Set the load address for all sections in a module to be the 108 /// file address plus \a slide. 109 /// 110 /// Many times a module will be loaded in a target with a constant 111 /// offset applied to all top level sections. This function can 112 /// set the load address for all top level sections to be the 113 /// section file address + offset. 114 /// 115 /// @param[in] target 116 /// The target in which to apply the section load addresses. 117 /// 118 /// @param[in] offset 119 /// The offset to apply to all file addresses for all top 120 /// level sections in the object file as each section load 121 /// address is being set. 122 /// 123 /// @param[out] changed 124 /// If any section load addresses were changed in \a target, 125 /// then \a changed will be set to \b true. Else \a changed 126 /// will be set to false. This allows this function to be 127 /// called multiple times on the same module for the same 128 /// target. If the module hasn't moved, then \a changed will 129 /// be false and no module updated notification will need to 130 /// be sent out. 131 /// 132 /// @return 133 /// /b True if any sections were successfully loaded in \a target, 134 /// /b false otherwise. 135 //------------------------------------------------------------------ 136 bool 137 SetLoadAddress (Target &target, 138 lldb::addr_t offset, 139 bool &changed); 140 141 //------------------------------------------------------------------ 142 /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) 143 /// 144 /// @see SymbolContextScope 145 //------------------------------------------------------------------ 146 virtual void 147 CalculateSymbolContext (SymbolContext* sc); 148 149 virtual lldb::ModuleSP 150 CalculateSymbolContextModule (); 151 152 void 153 GetDescription (Stream *s, 154 lldb::DescriptionLevel level = lldb::eDescriptionLevelFull); 155 156 //------------------------------------------------------------------ 157 /// Dump a description of this object to a Stream. 158 /// 159 /// Dump a description of the contents of this object to the 160 /// supplied stream \a s. The dumped content will be only what has 161 /// been loaded or parsed up to this point at which this function 162 /// is called, so this is a good way to see what has been parsed 163 /// in a module. 164 /// 165 /// @param[in] s 166 /// The stream to which to dump the object descripton. 167 //------------------------------------------------------------------ 168 void 169 Dump (Stream *s); 170 171 //------------------------------------------------------------------ 172 /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*) 173 /// 174 /// @see SymbolContextScope 175 //------------------------------------------------------------------ 176 virtual void 177 DumpSymbolContext (Stream *s); 178 179 //------------------------------------------------------------------ 180 /// Find a symbol in the object files symbol table. 181 /// 182 /// @param[in] name 183 /// The name of the symbol that we are looking for. 184 /// 185 /// @param[in] symbol_type 186 /// If set to eSymbolTypeAny, find a symbol of any type that 187 /// has a name that matches \a name. If set to any other valid 188 /// SymbolType enumeration value, then search only for 189 /// symbols that match \a symbol_type. 190 /// 191 /// @return 192 /// Returns a valid symbol pointer if a symbol was found, 193 /// NULL otherwise. 194 //------------------------------------------------------------------ 195 const Symbol * 196 FindFirstSymbolWithNameAndType (const ConstString &name, 197 lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); 198 199 size_t 200 FindSymbolsWithNameAndType (const ConstString &name, 201 lldb::SymbolType symbol_type, 202 SymbolContextList &sc_list); 203 204 size_t 205 FindSymbolsMatchingRegExAndType (const RegularExpression ®ex, 206 lldb::SymbolType symbol_type, 207 SymbolContextList &sc_list); 208 209 //------------------------------------------------------------------ 210 /// Find compile units by partial or full path. 211 /// 212 /// Finds all compile units that match \a path in all of the modules 213 /// and returns the results in \a sc_list. 214 /// 215 /// @param[in] path 216 /// The name of the function we are looking for. 217 /// 218 /// @param[in] append 219 /// If \b true, then append any compile units that were found 220 /// to \a sc_list. If \b false, then the \a sc_list is cleared 221 /// and the contents of \a sc_list are replaced. 222 /// 223 /// @param[out] sc_list 224 /// A symbol context list that gets filled in with all of the 225 /// matches. 226 /// 227 /// @return 228 /// The number of matches added to \a sc_list. 229 //------------------------------------------------------------------ 230 uint32_t 231 FindCompileUnits (const FileSpec &path, 232 bool append, 233 SymbolContextList &sc_list); 234 235 236 //------------------------------------------------------------------ 237 /// Find functions by name. 238 /// 239 /// If the function is an inlined function, it will have a block, 240 /// representing the inlined function, and the function will be the 241 /// containing function. If it is not inlined, then the block will 242 /// be NULL. 243 /// 244 /// @param[in] name 245 /// The name of the compile unit we are looking for. 246 /// 247 /// @param[in] namespace_decl 248 /// If valid, a namespace to search in. 249 /// 250 /// @param[in] name_type_mask 251 /// A bit mask of bits that indicate what kind of names should 252 /// be used when doing the lookup. Bits include fully qualified 253 /// names, base names, C++ methods, or ObjC selectors. 254 /// See FunctionNameType for more details. 255 /// 256 /// @param[in] append 257 /// If \b true, any matches will be appended to \a sc_list, else 258 /// matches replace the contents of \a sc_list. 259 /// 260 /// @param[out] sc_list 261 /// A symbol context list that gets filled in with all of the 262 /// matches. 263 /// 264 /// @return 265 /// The number of matches added to \a sc_list. 266 //------------------------------------------------------------------ 267 uint32_t 268 FindFunctions (const ConstString &name, 269 const ClangNamespaceDecl *namespace_decl, 270 uint32_t name_type_mask, 271 bool symbols_ok, 272 bool inlines_ok, 273 bool append, 274 SymbolContextList& sc_list); 275 276 //------------------------------------------------------------------ 277 /// Find functions by name. 278 /// 279 /// If the function is an inlined function, it will have a block, 280 /// representing the inlined function, and the function will be the 281 /// containing function. If it is not inlined, then the block will 282 /// be NULL. 283 /// 284 /// @param[in] regex 285 /// A regular expression to use when matching the name. 286 /// 287 /// @param[in] append 288 /// If \b true, any matches will be appended to \a sc_list, else 289 /// matches replace the contents of \a sc_list. 290 /// 291 /// @param[out] sc_list 292 /// A symbol context list that gets filled in with all of the 293 /// matches. 294 /// 295 /// @return 296 /// The number of matches added to \a sc_list. 297 //------------------------------------------------------------------ 298 uint32_t 299 FindFunctions (const RegularExpression& regex, 300 bool symbols_ok, 301 bool inlines_ok, 302 bool append, 303 SymbolContextList& sc_list); 304 305 //------------------------------------------------------------------ 306 /// Find global and static variables by name. 307 /// 308 /// @param[in] name 309 /// The name of the global or static variable we are looking 310 /// for. 311 /// 312 /// @param[in] namespace_decl 313 /// If valid, a namespace to search in. 314 /// 315 /// @param[in] append 316 /// If \b true, any matches will be appended to \a 317 /// variable_list, else matches replace the contents of 318 /// \a variable_list. 319 /// 320 /// @param[in] max_matches 321 /// Allow the number of matches to be limited to \a 322 /// max_matches. Specify UINT32_MAX to get all possible matches. 323 /// 324 /// @param[in] variable_list 325 /// A list of variables that gets the matches appended to (if 326 /// \a append it \b true), or replace (if \a append is \b false). 327 /// 328 /// @return 329 /// The number of matches added to \a variable_list. 330 //------------------------------------------------------------------ 331 uint32_t 332 FindGlobalVariables (const ConstString &name, 333 const ClangNamespaceDecl *namespace_decl, 334 bool append, 335 uint32_t max_matches, 336 VariableList& variable_list); 337 338 //------------------------------------------------------------------ 339 /// Find global and static variables by regular exression. 340 /// 341 /// @param[in] regex 342 /// A regular expression to use when matching the name. 343 /// 344 /// @param[in] append 345 /// If \b true, any matches will be appended to \a 346 /// variable_list, else matches replace the contents of 347 /// \a variable_list. 348 /// 349 /// @param[in] max_matches 350 /// Allow the number of matches to be limited to \a 351 /// max_matches. Specify UINT32_MAX to get all possible matches. 352 /// 353 /// @param[in] variable_list 354 /// A list of variables that gets the matches appended to (if 355 /// \a append it \b true), or replace (if \a append is \b false). 356 /// 357 /// @return 358 /// The number of matches added to \a variable_list. 359 //------------------------------------------------------------------ 360 uint32_t 361 FindGlobalVariables (const RegularExpression& regex, 362 bool append, 363 uint32_t max_matches, 364 VariableList& variable_list); 365 366 //------------------------------------------------------------------ 367 /// Find types by name. 368 /// 369 /// @param[in] sc 370 /// A symbol context that scopes where to extract a type list 371 /// from. 372 /// 373 /// @param[in] name 374 /// The name of the type we are looking for. 375 /// 376 /// @param[in] namespace_decl 377 /// If valid, a namespace to search in. 378 /// 379 /// @param[in] append 380 /// If \b true, any matches will be appended to \a 381 /// variable_list, else matches replace the contents of 382 /// \a variable_list. 383 /// 384 /// @param[in] max_matches 385 /// Allow the number of matches to be limited to \a 386 /// max_matches. Specify UINT32_MAX to get all possible matches. 387 /// 388 /// @param[in] encoding 389 /// Limit the search to specific types, or get all types if 390 /// set to Type::invalid. 391 /// 392 /// @param[in] udt_name 393 /// If the encoding is a user defined type, specify the name 394 /// of the user defined type ("struct", "union", "class", etc). 395 /// 396 /// @param[out] type_list 397 /// A type list gets populated with any matches. 398 /// 399 /// @return 400 /// The number of matches added to \a type_list. 401 //------------------------------------------------------------------ 402 uint32_t 403 FindTypes (const SymbolContext& sc, 404 const ConstString &name, 405 const ClangNamespaceDecl *namespace_decl, 406 bool append, 407 uint32_t max_matches, 408 TypeList& types); 409 410 //------------------------------------------------------------------ 411 /// Get const accessor for the module architecture. 412 /// 413 /// @return 414 /// A const reference to the architecture object. 415 //------------------------------------------------------------------ 416 const ArchSpec& 417 GetArchitecture () const; 418 419 //------------------------------------------------------------------ 420 /// Get const accessor for the module file specification. 421 /// 422 /// This function returns the file for the module on the host system 423 /// that is running LLDB. This can differ from the path on the 424 /// platform since we might be doing remote debugging. 425 /// 426 /// @return 427 /// A const reference to the file specification object. 428 //------------------------------------------------------------------ 429 const FileSpec & 430 GetFileSpec () const 431 { 432 return m_file; 433 } 434 435 //------------------------------------------------------------------ 436 /// Get accessor for the module platform file specification. 437 /// 438 /// Platform file refers to the path of the module as it is known on 439 /// the remote system on which it is being debugged. For local 440 /// debugging this is always the same as Module::GetFileSpec(). But 441 /// remote debugging might mention a file "/usr/lib/liba.dylib" 442 /// which might be locally downloaded and cached. In this case the 443 /// platform file could be something like: 444 /// "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib" 445 /// The file could also be cached in a local developer kit directory. 446 /// 447 /// @return 448 /// A const reference to the file specification object. 449 //------------------------------------------------------------------ 450 const FileSpec & 451 GetPlatformFileSpec () const 452 { 453 if (m_platform_file) 454 return m_platform_file; 455 return m_file; 456 } 457 458 void 459 SetPlatformFileSpec (const FileSpec &file) 460 { 461 m_platform_file = file; 462 } 463 464 const FileSpec & 465 GetSymbolFileFileSpec () const 466 { 467 return m_symfile_spec; 468 } 469 470 void 471 SetSymbolFileFileSpec (const FileSpec &file) 472 { 473 m_symfile_spec = file; 474 } 475 476 const TimeValue & 477 GetModificationTime () const; 478 479 //------------------------------------------------------------------ 480 /// Tells whether this module is capable of being the main executable 481 /// for a process. 482 /// 483 /// @return 484 /// \b true if it is, \b false otherwise. 485 //------------------------------------------------------------------ 486 bool 487 IsExecutable (); 488 489 //------------------------------------------------------------------ 490 /// Tells whether this module has been loaded in the target passed in. 491 /// This call doesn't distinguish between whether the module is loaded 492 /// by the dynamic loader, or by a "target module add" type call. 493 /// 494 /// @param[in] target 495 /// The target to check whether this is loaded in. 496 /// 497 /// @return 498 /// \b true if it is, \b false otherwise. 499 //------------------------------------------------------------------ 500 bool 501 IsLoadedInTarget (Target *target); 502 503 //------------------------------------------------------------------ 504 /// Get the number of compile units for this module. 505 /// 506 /// @return 507 /// The number of compile units that the symbol vendor plug-in 508 /// finds. 509 //------------------------------------------------------------------ 510 uint32_t 511 GetNumCompileUnits(); 512 513 lldb::CompUnitSP 514 GetCompileUnitAtIndex (uint32_t); 515 516 const ConstString & 517 GetObjectName() const; 518 519 uint64_t 520 GetObjectOffset() const 521 { 522 return m_object_offset; 523 } 524 525 //------------------------------------------------------------------ 526 /// Get the object file representation for the current architecture. 527 /// 528 /// If the object file has not been located or parsed yet, this 529 /// function will find the best ObjectFile plug-in that can parse 530 /// Module::m_file. 531 /// 532 /// @return 533 /// If Module::m_file does not exist, or no plug-in was found 534 /// that can parse the file, or the object file doesn't contain 535 /// the current architecture in Module::m_arch, NULL will be 536 /// returned, else a valid object file interface will be 537 /// returned. The returned pointer is owned by this object and 538 /// remains valid as long as the object is around. 539 //------------------------------------------------------------------ 540 ObjectFile * 541 GetObjectFile (); 542 543 // Load an object file from memory. 544 ObjectFile * 545 GetMemoryObjectFile (const lldb::ProcessSP &process_sp, 546 lldb::addr_t header_addr, 547 Error &error); 548 //------------------------------------------------------------------ 549 /// Get the symbol vendor interface for the current architecture. 550 /// 551 /// If the symbol vendor file has not been located yet, this 552 /// function will find the best SymbolVendor plug-in that can 553 /// use the current object file. 554 /// 555 /// @return 556 /// If this module does not have a valid object file, or no 557 /// plug-in can be found that can use the object file, NULL will 558 /// be returned, else a valid symbol vendor plug-in interface 559 /// will be returned. The returned pointer is owned by this 560 /// object and remains valid as long as the object is around. 561 //------------------------------------------------------------------ 562 SymbolVendor* 563 GetSymbolVendor(bool can_create = true); 564 565 //------------------------------------------------------------------ 566 /// Get accessor the type list for this module. 567 /// 568 /// @return 569 /// A valid type list pointer, or NULL if there is no valid 570 /// symbol vendor for this module. 571 //------------------------------------------------------------------ 572 TypeList* 573 GetTypeList (); 574 575 //------------------------------------------------------------------ 576 /// Get a pointer to the UUID value contained in this object. 577 /// 578 /// If the executable image file doesn't not have a UUID value built 579 /// into the file format, an MD5 checksum of the entire file, or 580 /// slice of the file for the current architecture should be used. 581 /// 582 /// @return 583 /// A const pointer to the internal copy of the UUID value in 584 /// this module if this module has a valid UUID value, NULL 585 /// otherwise. 586 //------------------------------------------------------------------ 587 const lldb_private::UUID & 588 GetUUID (); 589 590 //------------------------------------------------------------------ 591 /// A debugging function that will cause everything in a module to 592 /// be parsed. 593 /// 594 /// All compile units will be pasred, along with all globals and 595 /// static variables and all functions for those compile units. 596 /// All types, scopes, local variables, static variables, global 597 /// variables, and line tables will be parsed. This can be used 598 /// prior to dumping a module to see a complete list of the 599 /// resuling debug information that gets parsed, or as a debug 600 /// function to ensure that the module can consume all of the 601 /// debug data the symbol vendor provides. 602 //------------------------------------------------------------------ 603 void 604 ParseAllDebugSymbols(); 605 606 bool 607 ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr); 608 609 uint32_t 610 ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc); 611 612 //------------------------------------------------------------------ 613 /// Resolve items in the symbol context for a given file and line. 614 /// 615 /// Tries to resolve \a file_path and \a line to a list of matching 616 /// symbol contexts. 617 /// 618 /// The line table entries contains addresses that can be used to 619 /// further resolve the values in each match: the function, block, 620 /// symbol. Care should be taken to minimize the amount of 621 /// information that is requested to only what is needed -- 622 /// typically the module, compile unit, line table and line table 623 /// entry are sufficient. 624 /// 625 /// @param[in] file_path 626 /// A path to a source file to match. If \a file_path does not 627 /// specify a directory, then this query will match all files 628 /// whose base filename matches. If \a file_path does specify 629 /// a directory, the fullpath to the file must match. 630 /// 631 /// @param[in] line 632 /// The source line to match, or zero if just the compile unit 633 /// should be resolved. 634 /// 635 /// @param[in] check_inlines 636 /// Check for inline file and line number matches. This option 637 /// should be used sparingly as it will cause all line tables 638 /// for every compile unit to be parsed and searched for 639 /// matching inline file entries. 640 /// 641 /// @param[in] resolve_scope 642 /// The scope that should be resolved (see 643 /// SymbolContext::Scope). 644 /// 645 /// @param[out] sc_list 646 /// A symbol context list that gets matching symbols contexts 647 /// appended to. 648 /// 649 /// @return 650 /// The number of matches that were added to \a sc_list. 651 /// 652 /// @see SymbolContext::Scope 653 //------------------------------------------------------------------ 654 uint32_t 655 ResolveSymbolContextForFilePath (const char *file_path, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list); 656 657 //------------------------------------------------------------------ 658 /// Resolve items in the symbol context for a given file and line. 659 /// 660 /// Tries to resolve \a file_spec and \a line to a list of matching 661 /// symbol contexts. 662 /// 663 /// The line table entries contains addresses that can be used to 664 /// further resolve the values in each match: the function, block, 665 /// symbol. Care should be taken to minimize the amount of 666 /// information that is requested to only what is needed -- 667 /// typically the module, compile unit, line table and line table 668 /// entry are sufficient. 669 /// 670 /// @param[in] file_spec 671 /// A file spec to a source file to match. If \a file_path does 672 /// not specify a directory, then this query will match all 673 /// files whose base filename matches. If \a file_path does 674 /// specify a directory, the fullpath to the file must match. 675 /// 676 /// @param[in] line 677 /// The source line to match, or zero if just the compile unit 678 /// should be resolved. 679 /// 680 /// @param[in] check_inlines 681 /// Check for inline file and line number matches. This option 682 /// should be used sparingly as it will cause all line tables 683 /// for every compile unit to be parsed and searched for 684 /// matching inline file entries. 685 /// 686 /// @param[in] resolve_scope 687 /// The scope that should be resolved (see 688 /// SymbolContext::Scope). 689 /// 690 /// @param[out] sc_list 691 /// A symbol context list that gets filled in with all of the 692 /// matches. 693 /// 694 /// @return 695 /// A integer that contains SymbolContext::Scope bits set for 696 /// each item that was successfully resolved. 697 /// 698 /// @see SymbolContext::Scope 699 //------------------------------------------------------------------ 700 uint32_t 701 ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list); 702 703 704 void 705 SetFileSpecAndObjectName (const FileSpec &file, 706 const ConstString &object_name); 707 708 bool 709 GetIsDynamicLinkEditor () const 710 { 711 return m_is_dynamic_loader_module; 712 } 713 714 void 715 SetIsDynamicLinkEditor (bool b) 716 { 717 m_is_dynamic_loader_module = b; 718 } 719 720 ClangASTContext & 721 GetClangASTContext (); 722 723 // Special error functions that can do printf style formatting that will prepend the message with 724 // something appropriate for this module (like the architecture, path and object name (if any)). 725 // This centralizes code so that everyone doesn't need to format their error and log messages on 726 // their own and keeps the output a bit more consistent. 727 void 728 LogMessage (Log *log, const char *format, ...) __attribute__ ((format (printf, 3, 4))); 729 730 void 731 ReportWarning (const char *format, ...) __attribute__ ((format (printf, 2, 3))); 732 733 void 734 ReportError (const char *format, ...) __attribute__ ((format (printf, 2, 3))); 735 736 // Only report an error once when the module is first detected to be modified 737 // so we don't spam the console with many messages. 738 void 739 ReportErrorIfModifyDetected (const char *format, ...) __attribute__ ((format (printf, 2, 3))); 740 741 bool 742 GetModified (bool use_cached_only); 743 744 bool 745 SetModified (bool b); 746 747protected: 748 //------------------------------------------------------------------ 749 // Member Variables 750 //------------------------------------------------------------------ 751 mutable Mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments. 752 TimeValue m_mod_time; ///< The modification time for this module when it was created. 753 ArchSpec m_arch; ///< The architecture for this module. 754 lldb_private::UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols. 755 FileSpec m_file; ///< The file representation on disk for this module (if there is one). 756 FileSpec m_platform_file;///< The path to the module on the platform on which it is being debugged 757 FileSpec m_symfile_spec; ///< If this path is valid, then this is the file that _will_ be used as the symbol file for this module 758 ConstString m_object_name; ///< The name an object within this module that is selected, or empty of the module is represented by \a m_file. 759 uint64_t m_object_offset; 760 lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile 761 std::auto_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module. 762 ClangASTContext m_ast; ///< The AST context for this module. 763 bool m_did_load_objfile:1, 764 m_did_load_symbol_vendor:1, 765 m_did_parse_uuid:1, 766 m_did_init_ast:1, 767 m_is_dynamic_loader_module:1, 768 m_was_modified:1; /// See if the module was modified after it was initially opened. 769 770 //------------------------------------------------------------------ 771 /// Resolve a file or load virtual address. 772 /// 773 /// Tries to resolve \a vm_addr as a file address (if \a 774 /// vm_addr_is_file_addr is true) or as a load address if \a 775 /// vm_addr_is_file_addr is false) in the symbol vendor. 776 /// \a resolve_scope indicates what clients wish to resolve 777 /// and can be used to limit the scope of what is parsed. 778 /// 779 /// @param[in] vm_addr 780 /// The load virtual address to resolve. 781 /// 782 /// @param[in] vm_addr_is_file_addr 783 /// If \b true, \a vm_addr is a file address, else \a vm_addr 784 /// if a load address. 785 /// 786 /// @param[in] resolve_scope 787 /// The scope that should be resolved (see 788 /// SymbolContext::Scope). 789 /// 790 /// @param[out] so_addr 791 /// The section offset based address that got resolved if 792 /// any bits are returned. 793 /// 794 /// @param[out] sc 795 // The symbol context that has objects filled in. Each bit 796 /// in the \a resolve_scope pertains to a member in the \a sc. 797 /// 798 /// @return 799 /// A integer that contains SymbolContext::Scope bits set for 800 /// each item that was successfully resolved. 801 /// 802 /// @see SymbolContext::Scope 803 //------------------------------------------------------------------ 804 uint32_t 805 ResolveSymbolContextForAddress (lldb::addr_t vm_addr, 806 bool vm_addr_is_file_addr, 807 uint32_t resolve_scope, 808 Address& so_addr, 809 SymbolContext& sc); 810 811 void 812 SymbolIndicesToSymbolContextList (Symtab *symtab, 813 std::vector<uint32_t> &symbol_indexes, 814 SymbolContextList &sc_list); 815 816 bool 817 SetArchitecture (const ArchSpec &new_arch); 818 819private: 820 821 uint32_t 822 FindTypes_Impl (const SymbolContext& sc, 823 const ConstString &name, 824 const ClangNamespaceDecl *namespace_decl, 825 bool append, 826 uint32_t max_matches, 827 TypeList& types); 828 829 830 DISALLOW_COPY_AND_ASSIGN (Module); 831}; 832 833} // namespace lldb_private 834 835#endif // liblldb_Module_h_ 836