Module.h revision 321369
11541Srgrimes//===-- Module.h ------------------------------------------------*- C++ -*-===//
21541Srgrimes//
31541Srgrimes//                     The LLVM Compiler Infrastructure
41541Srgrimes//
51541Srgrimes// This file is distributed under the University of Illinois Open Source
61541Srgrimes// License. See LICENSE.TXT for details.
71541Srgrimes//
81541Srgrimes//===----------------------------------------------------------------------===//
91541Srgrimes
101541Srgrimes#ifndef liblldb_Module_h_
111541Srgrimes#define liblldb_Module_h_
121541Srgrimes
131541Srgrimes#include "lldb/Core/Address.h" // for Address
141541Srgrimes#include "lldb/Core/ArchSpec.h"
151541Srgrimes#include "lldb/Core/ModuleSpec.h" // for ModuleSpec
161541Srgrimes#include "lldb/Symbol/SymbolContextScope.h"
171541Srgrimes#include "lldb/Symbol/TypeSystem.h"
181541Srgrimes#include "lldb/Target/PathMappingList.h"
191541Srgrimes#include "lldb/Utility/ConstString.h" // for ConstString
201541Srgrimes#include "lldb/Utility/FileSpec.h"
211541Srgrimes#include "lldb/Utility/Status.h" // for Status
221541Srgrimes#include "lldb/Utility/UUID.h"
231541Srgrimes#include "lldb/lldb-defines.h"      // for DISALLOW_COPY_AND_ASSIGN
241541Srgrimes#include "lldb/lldb-enumerations.h" // for LanguageType, SymbolType
251541Srgrimes#include "lldb/lldb-forward.h"
261541Srgrimes#include "lldb/lldb-types.h" // for addr_t, offset_t
271541Srgrimes
281541Srgrimes#include "llvm/ADT/DenseSet.h"
291541Srgrimes#include "llvm/ADT/StringRef.h"
301541Srgrimes#include "llvm/Support/Chrono.h"
311541Srgrimes
32116182Sobrien#include <atomic>
33116182Sobrien#include <memory> // for enable_shared_from_this
34116182Sobrien#include <mutex>
3531778Seivind#include <stddef.h> // for size_t
3631778Seivind#include <stdint.h> // for uint32_t, uint64_t
371541Srgrimes#include <string>
381541Srgrimes#include <vector>
3912221Sbde
401541Srgrimesnamespace lldb_private {
411541Srgrimesclass CompilerDeclContext;
4282717Sdillon}
4382717Sdillonnamespace lldb_private {
441541Srgrimesclass Function;
451549Srgrimes}
461541Srgrimesnamespace lldb_private {
478876Srgrimesclass Log;
48130344Sphk}
491541Srgrimesnamespace lldb_private {
5012221Sbdeclass ObjectFile;
511541Srgrimes}
521541Srgrimesnamespace lldb_private {
531541Srgrimesclass RegularExpression;
541541Srgrimes}
5512221Sbdenamespace lldb_private {
5682717Sdillonclass SectionList;
5782717Sdillon}
5882717Sdillonnamespace lldb_private {
591541Srgrimesclass Stream;
601549Srgrimes}
6183366Sjuliannamespace lldb_private {
6283366Sjulianclass Symbol;
631541Srgrimes}
641541Srgrimesnamespace lldb_private {
6512171Sphkclass SymbolContext;
6682717Sdillon}
6738517Sdfrnamespace lldb_private {
681541Srgrimesclass SymbolContextList;
6912171Sphk}
7012171Sphknamespace lldb_private {
7182717Sdillonclass SymbolFile;
7283366Sjulian}
7382717Sdillonnamespace lldb_private {
7482717Sdillonclass SymbolVendor;
751541Srgrimes}
761541Srgrimesnamespace lldb_private {
7712221Sbdeclass Symtab;
781541Srgrimes}
791541Srgrimesnamespace lldb_private {
801541Srgrimesclass Target;
811541Srgrimes}
8212221Sbdenamespace lldb_private {
8382717Sdillonclass TypeList;
8482717Sdillon}
8582717Sdillonnamespace lldb_private {
861541Srgrimesclass TypeMap;
871549Srgrimes}
8883366Sjuliannamespace lldb_private {
8983366Sjulianclass VariableList;
901541Srgrimes}
911541Srgrimes
9212171Sphknamespace lldb_private {
931541Srgrimes
941541Srgrimes//----------------------------------------------------------------------
9512171Sphk/// @class Module Module.h "lldb/Core/Module.h"
9612171Sphk/// @brief A class that describes an executable image and its associated
9782717Sdillon///        object and symbol files.
98132653Scperciva///
9983366Sjulian/// The module is designed to be able to select a single slice of an
10082717Sdillon/// executable image as it would appear on disk and during program
10182717Sdillon/// execution.
10282717Sdillon///
10382717Sdillon/// Modules control when and if information is parsed according to which
1041541Srgrimes/// accessors are called. For example the object file (ObjectFile)
1051541Srgrimes/// representation will only be parsed if the object file is requested
10612221Sbde/// using the Module::GetObjectFile() is called. The debug symbols
10712200Sbde/// will only be parsed if the symbol vendor (SymbolVendor) is
1081541Srgrimes/// requested using the Module::GetSymbolVendor() is called.
1091541Srgrimes///
11012221Sbde/// The module will parse more detailed information as more queries are
11182717Sdillon/// made.
11282717Sdillon//----------------------------------------------------------------------
11382717Sdillonclass Module : public std::enable_shared_from_this<Module>,
1141541Srgrimes               public SymbolContextScope {
1151549Srgrimespublic:
11683366Sjulian  // Static functions that can track the lifetime of module objects.
11783366Sjulian  // This is handy because we might have Module objects that are in
11812200Sbde  // shared pointers that aren't in the global module list (from
1191541Srgrimes  // ModuleList). If this is the case we need to know about it.
1201541Srgrimes  // The modules in the global list maintained by these functions
12183366Sjulian  // can be viewed using the "target modules list" command using the
1221541Srgrimes  // "--global" (-g for short).
1231541Srgrimes  static size_t GetNumberAllocatedModules();
124130344Sphk
1251541Srgrimes  static Module *GetAllocatedModuleAtIndex(size_t idx);
1261541Srgrimes
12712221Sbde  static std::recursive_mutex &GetAllocationModuleCollectionMutex();
12812200Sbde
1291541Srgrimes  //------------------------------------------------------------------
1301541Srgrimes  /// Construct with file specification and architecture.
13112221Sbde  ///
13282717Sdillon  /// Clients that wish to share modules with other targets should
13382717Sdillon  /// use ModuleList::GetSharedModule().
13482717Sdillon  ///
1351541Srgrimes  /// @param[in] file_spec
1361549Srgrimes  ///     The file specification for the on disk representation of
13783366Sjulian  ///     this executable image.
13883366Sjulian  ///
13912200Sbde  /// @param[in] arch
1401541Srgrimes  ///     The architecture to set as the current architecture in
1411541Srgrimes  ///     this module.
1421541Srgrimes  ///
143119364Stjr  /// @param[in] object_name
144119364Stjr  ///     The name of an object in a module used to extract a module
14582717Sdillon  ///     within a module (.a files and modules that contain multiple
146119364Stjr  ///     architectures).
14782717Sdillon  ///
148119364Stjr  /// @param[in] object_offset
1491541Srgrimes  ///     The offset within an existing module used to extract a
1501541Srgrimes  ///     module within a module (.a files and modules that contain
15182717Sdillon  ///     multiple architectures).
15282717Sdillon  //------------------------------------------------------------------
15382717Sdillon  Module(
1541549Srgrimes      const FileSpec &file_spec, const ArchSpec &arch,
15583366Sjulian      const ConstString *object_name = nullptr,
15683366Sjulian      lldb::offset_t object_offset = 0,
15712200Sbde      const llvm::sys::TimePoint<> &object_mod_time = llvm::sys::TimePoint<>());
1581541Srgrimes
1591541Srgrimes  Module(const ModuleSpec &module_spec);
1601541Srgrimes
1611541Srgrimes  static lldb::ModuleSP
1621549Srgrimes  CreateJITModule(const lldb::ObjectFileJITDelegateSP &delegate_sp);
16374729Speter
16474729Speter  //------------------------------------------------------------------
16574729Speter  /// Destructor.
16674729Speter  //------------------------------------------------------------------
16774729Speter  ~Module() override;
16874729Speter
16974729Speter  bool MatchesModuleSpec(const ModuleSpec &module_ref);
17074729Speter
17112221Sbde  //------------------------------------------------------------------
1721549Srgrimes  /// Set the load address for all sections in a module to be the
1731549Srgrimes  /// file address plus \a slide.
1741549Srgrimes  ///
17512221Sbde  /// Many times a module will be loaded in a target with a constant
1761549Srgrimes  /// offset applied to all top level sections. This function can
17782717Sdillon  /// set the load address for all top level sections to be the
17882717Sdillon  /// section file address + offset.
17982717Sdillon  ///
1801549Srgrimes  /// @param[in] target
1811549Srgrimes  ///     The target in which to apply the section load addresses.
18283366Sjulian  ///
18383366Sjulian  /// @param[in] value
1841549Srgrimes  ///     if \a value_is_offset is true, then value is the offset to
1851549Srgrimes  ///     apply to all file addresses for all top level sections in
18682717Sdillon  ///     the object file as each section load address is being set.
18738517Sdfr  ///     If \a value_is_offset is false, then "value" is the new
1881549Srgrimes  ///     absolute base address for the image.
1891549Srgrimes  ///
19012171Sphk  /// @param[in] value_is_offset
19112171Sphk  ///     If \b true, then \a value is an offset to apply to each
19282717Sdillon  ///     file address of each top level section.
19382717Sdillon  ///     If \b false, then \a value is the image base address that
19483366Sjulian  ///     will be used to rigidly slide all loadable sections.
195136404Speter  ///
19682717Sdillon  /// @param[out] changed
19782717Sdillon  ///     If any section load addresses were changed in \a target,
1981549Srgrimes  ///     then \a changed will be set to \b true. Else \a changed
1991549Srgrimes  ///     will be set to false. This allows this function to be
20012171Sphk  ///     called multiple times on the same module for the same
2011549Srgrimes  ///     target. If the module hasn't moved, then \a changed will
20283366Sjulian  ///     be false and no module updated notification will need to
203136404Speter  ///     be sent out.
20482717Sdillon  ///
20582717Sdillon  /// @return
2061549Srgrimes  ///     /b True if any sections were successfully loaded in \a target,
2071549Srgrimes  ///     /b false otherwise.
20812171Sphk  //------------------------------------------------------------------
2091549Srgrimes  bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset,
21083366Sjulian                      bool &changed);
211136404Speter
21282717Sdillon  //------------------------------------------------------------------
21382717Sdillon  /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
2141549Srgrimes  ///
2151549Srgrimes  /// @see SymbolContextScope
2161549Srgrimes  //------------------------------------------------------------------
2171549Srgrimes  void CalculateSymbolContext(SymbolContext *sc) override;
2181549Srgrimes
21983366Sjulian  lldb::ModuleSP CalculateSymbolContextModule() override;
220136404Speter
22182717Sdillon  void
22282717Sdillon  GetDescription(Stream *s,
2231549Srgrimes                 lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
2241549Srgrimes
2251549Srgrimes  //------------------------------------------------------------------
2261549Srgrimes  /// Get the module path and object name.
2271549Srgrimes  ///
2281549Srgrimes  /// Modules can refer to object files. In this case the specification
2291549Srgrimes  /// is simple and would return the path to the file:
2301549Srgrimes  ///
2311549Srgrimes  ///     "/usr/lib/foo.dylib"
23282717Sdillon  ///
23382717Sdillon  /// Modules can be .o files inside of a BSD archive (.a file). In
23482717Sdillon  /// this case, the object specification will look like:
2351549Srgrimes  ///
23682717Sdillon  ///     "/usr/lib/foo.a(bar.o)"
23782717Sdillon  ///
23882717Sdillon  /// There are many places where logging wants to log this fully
2391549Srgrimes  /// qualified specification, so we centralize this functionality
24038517Sdfr  /// here.
24112171Sphk  ///
2421549Srgrimes  /// @return
24383366Sjulian  ///     The object path + object name if there is one.
244136404Speter  //------------------------------------------------------------------
24582717Sdillon  std::string GetSpecificationDescription() const;
24682717Sdillon
2471549Srgrimes  //------------------------------------------------------------------
24882717Sdillon  /// Dump a description of this object to a Stream.
24982717Sdillon  ///
25082717Sdillon  /// Dump a description of the contents of this object to the
2511549Srgrimes  /// supplied stream \a s. The dumped content will be only what has
2521549Srgrimes  /// been loaded or parsed up to this point at which this function
25312221Sbde  /// is called, so this is a good way to see what has been parsed
2541549Srgrimes  /// in a module.
2551549Srgrimes  ///
25612222Sbde  /// @param[in] s
2571549Srgrimes  ///     The stream to which to dump the object description.
25812222Sbde  //------------------------------------------------------------------
2591549Srgrimes  void Dump(Stream *s);
26082717Sdillon
26182717Sdillon  //------------------------------------------------------------------
26282717Sdillon  /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
2631549Srgrimes  ///
2641549Srgrimes  /// @see SymbolContextScope
26583366Sjulian  //------------------------------------------------------------------
26683366Sjulian  void DumpSymbolContext(Stream *s) override;
2671549Srgrimes
2681549Srgrimes  //------------------------------------------------------------------
26982717Sdillon  /// Find a symbol in the object file's symbol table.
27082717Sdillon  ///
27182717Sdillon  /// @param[in] name
27282717Sdillon  ///     The name of the symbol that we are looking for.
27382717Sdillon  ///
274120029Snectar  /// @param[in] symbol_type
275120029Snectar  ///     If set to eSymbolTypeAny, find a symbol of any type that
27699012Salfred  ///     has a name that matches \a name. If set to any other valid
27782717Sdillon  ///     SymbolType enumeration value, then search only for
27882717Sdillon  ///     symbols that match \a symbol_type.
2791549Srgrimes  ///
2801549Srgrimes  /// @return
28112221Sbde  ///     Returns a valid symbol pointer if a symbol was found,
2821549Srgrimes  ///     nullptr otherwise.
2831549Srgrimes  //------------------------------------------------------------------
28412222Sbde  const Symbol *FindFirstSymbolWithNameAndType(
2851549Srgrimes      const ConstString &name,
28612221Sbde      lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
2871549Srgrimes
28882717Sdillon  size_t FindSymbolsWithNameAndType(const ConstString &name,
28982717Sdillon                                    lldb::SymbolType symbol_type,
29082717Sdillon                                    SymbolContextList &sc_list);
2911549Srgrimes
2921549Srgrimes  size_t FindSymbolsMatchingRegExAndType(const RegularExpression &regex,
29383366Sjulian                                         lldb::SymbolType symbol_type,
29483366Sjulian                                         SymbolContextList &sc_list);
2951549Srgrimes
2961549Srgrimes  //------------------------------------------------------------------
29712280Sphk  /// Find a function symbols in the object file's symbol table.
2981549Srgrimes  ///
29982717Sdillon  /// @param[in] name
30093593Sjhb  ///     The name of the symbol that we are looking for.
30182717Sdillon  ///
30282717Sdillon  /// @param[in] name_type_mask
30382717Sdillon  ///     A mask that has one or more bitwise OR'ed values from the
30482717Sdillon  ///     lldb::FunctionNameType enumeration type that indicate what
30582717Sdillon  ///     kind of names we are looking for.
3061549Srgrimes  ///
30799012Salfred  /// @param[out] sc_list
3081549Srgrimes  ///     A list to append any matching symbol contexts to.
30982717Sdillon  ///
31082717Sdillon  /// @return
3111549Srgrimes  ///     The number of symbol contexts that were added to \a sc_list
3121549Srgrimes  //------------------------------------------------------------------
3131549Srgrimes  size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask,
314                             SymbolContextList &sc_list);
315
316  //------------------------------------------------------------------
317  /// Find compile units by partial or full path.
318  ///
319  /// Finds all compile units that match \a path in all of the modules
320  /// and returns the results in \a sc_list.
321  ///
322  /// @param[in] path
323  ///     The name of the function we are looking for.
324  ///
325  /// @param[in] append
326  ///     If \b true, then append any compile units that were found
327  ///     to \a sc_list. If \b false, then the \a sc_list is cleared
328  ///     and the contents of \a sc_list are replaced.
329  ///
330  /// @param[out] sc_list
331  ///     A symbol context list that gets filled in with all of the
332  ///     matches.
333  ///
334  /// @return
335  ///     The number of matches added to \a sc_list.
336  //------------------------------------------------------------------
337  size_t FindCompileUnits(const FileSpec &path, bool append,
338                          SymbolContextList &sc_list);
339
340  //------------------------------------------------------------------
341  /// Find functions by name.
342  ///
343  /// If the function is an inlined function, it will have a block,
344  /// representing the inlined function, and the function will be the
345  /// containing function.  If it is not inlined, then the block will
346  /// be NULL.
347  ///
348  /// @param[in] name
349  ///     The name of the compile unit we are looking for.
350  ///
351  /// @param[in] namespace_decl
352  ///     If valid, a namespace to search in.
353  ///
354  /// @param[in] name_type_mask
355  ///     A bit mask of bits that indicate what kind of names should
356  ///     be used when doing the lookup. Bits include fully qualified
357  ///     names, base names, C++ methods, or ObjC selectors.
358  ///     See FunctionNameType for more details.
359  ///
360  /// @param[in] append
361  ///     If \b true, any matches will be appended to \a sc_list, else
362  ///     matches replace the contents of \a sc_list.
363  ///
364  /// @param[out] sc_list
365  ///     A symbol context list that gets filled in with all of the
366  ///     matches.
367  ///
368  /// @return
369  ///     The number of matches added to \a sc_list.
370  //------------------------------------------------------------------
371  size_t FindFunctions(const ConstString &name,
372                       const CompilerDeclContext *parent_decl_ctx,
373                       uint32_t name_type_mask, bool symbols_ok,
374                       bool inlines_ok, bool append,
375                       SymbolContextList &sc_list);
376
377  //------------------------------------------------------------------
378  /// Find functions by name.
379  ///
380  /// If the function is an inlined function, it will have a block,
381  /// representing the inlined function, and the function will be the
382  /// containing function.  If it is not inlined, then the block will
383  /// be NULL.
384  ///
385  /// @param[in] regex
386  ///     A regular expression to use when matching the name.
387  ///
388  /// @param[in] append
389  ///     If \b true, any matches will be appended to \a sc_list, else
390  ///     matches replace the contents of \a sc_list.
391  ///
392  /// @param[out] sc_list
393  ///     A symbol context list that gets filled in with all of the
394  ///     matches.
395  ///
396  /// @return
397  ///     The number of matches added to \a sc_list.
398  //------------------------------------------------------------------
399  size_t FindFunctions(const RegularExpression &regex, bool symbols_ok,
400                       bool inlines_ok, bool append,
401                       SymbolContextList &sc_list);
402
403  //------------------------------------------------------------------
404  /// Find addresses by file/line
405  ///
406  /// @param[in] target_sp
407  ///     The target the addresses are desired for.
408  ///
409  /// @param[in] file
410  ///     Source file to locate.
411  ///
412  /// @param[in] line
413  ///     Source line to locate.
414  ///
415  /// @param[in] function
416  ///	    Optional filter function. Addresses within this function will be
417  ///     added to the 'local' list. All others will be added to the 'extern'
418  ///     list.
419  ///
420  /// @param[out] output_local
421  ///     All matching addresses within 'function'
422  ///
423  /// @param[out] output_extern
424  ///     All matching addresses not within 'function'
425  void FindAddressesForLine(const lldb::TargetSP target_sp,
426                            const FileSpec &file, uint32_t line,
427                            Function *function,
428                            std::vector<Address> &output_local,
429                            std::vector<Address> &output_extern);
430
431  //------------------------------------------------------------------
432  /// Find global and static variables by name.
433  ///
434  /// @param[in] name
435  ///     The name of the global or static variable we are looking
436  ///     for.
437  ///
438  /// @param[in] parent_decl_ctx
439  ///     If valid, a decl context that results must exist within
440  ///
441  /// @param[in] append
442  ///     If \b true, any matches will be appended to \a
443  ///     variable_list, else matches replace the contents of
444  ///     \a variable_list.
445  ///
446  /// @param[in] max_matches
447  ///     Allow the number of matches to be limited to \a
448  ///     max_matches. Specify UINT32_MAX to get all possible matches.
449  ///
450  /// @param[in] variable_list
451  ///     A list of variables that gets the matches appended to (if
452  ///     \a append it \b true), or replace (if \a append is \b false).
453  ///
454  /// @return
455  ///     The number of matches added to \a variable_list.
456  //------------------------------------------------------------------
457  size_t FindGlobalVariables(const ConstString &name,
458                             const CompilerDeclContext *parent_decl_ctx,
459                             bool append, size_t max_matches,
460                             VariableList &variable_list);
461
462  //------------------------------------------------------------------
463  /// Find global and static variables by regular expression.
464  ///
465  /// @param[in] regex
466  ///     A regular expression to use when matching the name.
467  ///
468  /// @param[in] append
469  ///     If \b true, any matches will be appended to \a
470  ///     variable_list, else matches replace the contents of
471  ///     \a variable_list.
472  ///
473  /// @param[in] max_matches
474  ///     Allow the number of matches to be limited to \a
475  ///     max_matches. Specify UINT32_MAX to get all possible matches.
476  ///
477  /// @param[in] variable_list
478  ///     A list of variables that gets the matches appended to (if
479  ///     \a append it \b true), or replace (if \a append is \b false).
480  ///
481  /// @return
482  ///     The number of matches added to \a variable_list.
483  //------------------------------------------------------------------
484  size_t FindGlobalVariables(const RegularExpression &regex, bool append,
485                             size_t max_matches, VariableList &variable_list);
486
487  //------------------------------------------------------------------
488  /// Find types by name.
489  ///
490  /// Type lookups in modules go through the SymbolVendor (which will
491  /// use one or more SymbolFile subclasses). The SymbolFile needs to
492  /// be able to lookup types by basename and not the fully qualified
493  /// typename. This allows the type accelerator tables to stay small,
494  /// even with heavily templatized C++. The type search will then
495  /// narrow down the search results. If "exact_match" is true, then
496  /// the type search will only match exact type name matches. If
497  /// "exact_match" is false, the type will match as long as the base
498  /// typename matches and as long as any immediate containing
499  /// namespaces/class scopes that are specified match. So to search
500  /// for a type "d" in "b::c", the name "b::c::d" can be specified
501  /// and it will match any class/namespace "b" which contains a
502  /// class/namespace "c" which contains type "d". We do this to
503  /// allow users to not always have to specify complete scoping on
504  /// all expressions, but it also allows for exact matching when
505  /// required.
506  ///
507  /// @param[in] sc
508  ///     A symbol context that scopes where to extract a type list
509  ///     from.
510  ///
511  /// @param[in] type_name
512  ///     The name of the type we are looking for that is a fully
513  ///     or partially qualified type name.
514  ///
515  /// @param[in] exact_match
516  ///     If \b true, \a type_name is fully qualified and must match
517  ///     exactly. If \b false, \a type_name is a partially qualified
518  ///     name where the leading namespaces or classes can be
519  ///     omitted to make finding types that a user may type
520  ///     easier.
521  ///
522  /// @param[out] type_list
523  ///     A type list gets populated with any matches.
524  ///
525  /// @return
526  ///     The number of matches added to \a type_list.
527  //------------------------------------------------------------------
528  size_t
529  FindTypes(const SymbolContext &sc, const ConstString &type_name,
530            bool exact_match, size_t max_matches,
531            llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
532            TypeList &types);
533
534  lldb::TypeSP FindFirstType(const SymbolContext &sc,
535                             const ConstString &type_name, bool exact_match);
536
537  //------------------------------------------------------------------
538  /// Find types by name that are in a namespace. This function is
539  /// used by the expression parser when searches need to happen in
540  /// an exact namespace scope.
541  ///
542  /// @param[in] sc
543  ///     A symbol context that scopes where to extract a type list
544  ///     from.
545  ///
546  /// @param[in] type_name
547  ///     The name of a type within a namespace that should not include
548  ///     any qualifying namespaces (just a type basename).
549  ///
550  /// @param[in] namespace_decl
551  ///     The namespace declaration that this type must exist in.
552  ///
553  /// @param[out] type_list
554  ///     A type list gets populated with any matches.
555  ///
556  /// @return
557  ///     The number of matches added to \a type_list.
558  //------------------------------------------------------------------
559  size_t FindTypesInNamespace(const SymbolContext &sc,
560                              const ConstString &type_name,
561                              const CompilerDeclContext *parent_decl_ctx,
562                              size_t max_matches, TypeList &type_list);
563
564  //------------------------------------------------------------------
565  /// Get const accessor for the module architecture.
566  ///
567  /// @return
568  ///     A const reference to the architecture object.
569  //------------------------------------------------------------------
570  const ArchSpec &GetArchitecture() const;
571
572  //------------------------------------------------------------------
573  /// Get const accessor for the module file specification.
574  ///
575  /// This function returns the file for the module on the host system
576  /// that is running LLDB. This can differ from the path on the
577  /// platform since we might be doing remote debugging.
578  ///
579  /// @return
580  ///     A const reference to the file specification object.
581  //------------------------------------------------------------------
582  const FileSpec &GetFileSpec() const { return m_file; }
583
584  //------------------------------------------------------------------
585  /// Get accessor for the module platform file specification.
586  ///
587  /// Platform file refers to the path of the module as it is known on
588  /// the remote system on which it is being debugged. For local
589  /// debugging this is always the same as Module::GetFileSpec(). But
590  /// remote debugging might mention a file "/usr/lib/liba.dylib"
591  /// which might be locally downloaded and cached. In this case the
592  /// platform file could be something like:
593  /// "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib"
594  /// The file could also be cached in a local developer kit directory.
595  ///
596  /// @return
597  ///     A const reference to the file specification object.
598  //------------------------------------------------------------------
599  const FileSpec &GetPlatformFileSpec() const {
600    if (m_platform_file)
601      return m_platform_file;
602    return m_file;
603  }
604
605  void SetPlatformFileSpec(const FileSpec &file) { m_platform_file = file; }
606
607  const FileSpec &GetRemoteInstallFileSpec() const {
608    return m_remote_install_file;
609  }
610
611  void SetRemoteInstallFileSpec(const FileSpec &file) {
612    m_remote_install_file = file;
613  }
614
615  const FileSpec &GetSymbolFileFileSpec() const { return m_symfile_spec; }
616
617  void PreloadSymbols();
618
619  void SetSymbolFileFileSpec(const FileSpec &file);
620
621  const llvm::sys::TimePoint<> &GetModificationTime() const {
622    return m_mod_time;
623  }
624
625  const llvm::sys::TimePoint<> &GetObjectModificationTime() const {
626    return m_object_mod_time;
627  }
628
629  void SetObjectModificationTime(const llvm::sys::TimePoint<> &mod_time) {
630    m_mod_time = mod_time;
631  }
632
633  //------------------------------------------------------------------
634  /// Tells whether this module is capable of being the main executable
635  /// for a process.
636  ///
637  /// @return
638  ///     \b true if it is, \b false otherwise.
639  //------------------------------------------------------------------
640  bool IsExecutable();
641
642  //------------------------------------------------------------------
643  /// Tells whether this module has been loaded in the target passed in.
644  /// This call doesn't distinguish between whether the module is loaded
645  /// by the dynamic loader, or by a "target module add" type call.
646  ///
647  /// @param[in] target
648  ///    The target to check whether this is loaded in.
649  ///
650  /// @return
651  ///     \b true if it is, \b false otherwise.
652  //------------------------------------------------------------------
653  bool IsLoadedInTarget(Target *target);
654
655  bool LoadScriptingResourceInTarget(Target *target, Status &error,
656                                     Stream *feedback_stream = nullptr);
657
658  //------------------------------------------------------------------
659  /// Get the number of compile units for this module.
660  ///
661  /// @return
662  ///     The number of compile units that the symbol vendor plug-in
663  ///     finds.
664  //------------------------------------------------------------------
665  size_t GetNumCompileUnits();
666
667  lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
668
669  const ConstString &GetObjectName() const;
670
671  uint64_t GetObjectOffset() const { return m_object_offset; }
672
673  //------------------------------------------------------------------
674  /// Get the object file representation for the current architecture.
675  ///
676  /// If the object file has not been located or parsed yet, this
677  /// function will find the best ObjectFile plug-in that can parse
678  /// Module::m_file.
679  ///
680  /// @return
681  ///     If Module::m_file does not exist, or no plug-in was found
682  ///     that can parse the file, or the object file doesn't contain
683  ///     the current architecture in Module::m_arch, nullptr will be
684  ///     returned, else a valid object file interface will be
685  ///     returned. The returned pointer is owned by this object and
686  ///     remains valid as long as the object is around.
687  //------------------------------------------------------------------
688  virtual ObjectFile *GetObjectFile();
689
690  //------------------------------------------------------------------
691  /// Get the unified section list for the module. This is the section
692  /// list created by the module's object file and any debug info and
693  /// symbol files created by the symbol vendor.
694  ///
695  /// If the symbol vendor has not been loaded yet, this function
696  /// will return the section list for the object file.
697  ///
698  /// @return
699  ///     Unified module section list.
700  //------------------------------------------------------------------
701  virtual SectionList *GetSectionList();
702
703  //------------------------------------------------------------------
704  /// Notify the module that the file addresses for the Sections have
705  /// been updated.
706  ///
707  /// If the Section file addresses for a module are updated, this
708  /// method should be called.  Any parts of the module, object file,
709  /// or symbol file that has cached those file addresses must invalidate
710  /// or update its cache.
711  //------------------------------------------------------------------
712  virtual void SectionFileAddressesChanged();
713
714  uint32_t GetVersion(uint32_t *versions, uint32_t num_versions);
715
716  //------------------------------------------------------------------
717  /// Load an object file from memory.
718  ///
719  /// If available, the size of the object file in memory may be
720  /// passed to avoid additional round trips to process memory.
721  /// If the size is not provided, a default value is used. This
722  /// value should be large enough to enable the ObjectFile plugins
723  /// to read the header of the object file without going back to the
724  /// process.
725  ///
726  /// @return
727  ///     The object file loaded from memory or nullptr, if the operation
728  ///     failed (see the `error` for more information in that case).
729  //------------------------------------------------------------------
730  ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
731                                  lldb::addr_t header_addr, Status &error,
732                                  size_t size_to_read = 512);
733  //------------------------------------------------------------------
734  /// Get the symbol vendor interface for the current architecture.
735  ///
736  /// If the symbol vendor file has not been located yet, this
737  /// function will find the best SymbolVendor plug-in that can
738  /// use the current object file.
739  ///
740  /// @return
741  ///     If this module does not have a valid object file, or no
742  ///     plug-in can be found that can use the object file, nullptr will
743  ///     be returned, else a valid symbol vendor plug-in interface
744  ///     will be returned. The returned pointer is owned by this
745  ///     object and remains valid as long as the object is around.
746  //------------------------------------------------------------------
747  virtual SymbolVendor *
748  GetSymbolVendor(bool can_create = true,
749                  lldb_private::Stream *feedback_strm = nullptr);
750
751  //------------------------------------------------------------------
752  /// Get accessor the type list for this module.
753  ///
754  /// @return
755  ///     A valid type list pointer, or nullptr if there is no valid
756  ///     symbol vendor for this module.
757  //------------------------------------------------------------------
758  TypeList *GetTypeList();
759
760  //------------------------------------------------------------------
761  /// Get a pointer to the UUID value contained in this object.
762  ///
763  /// If the executable image file doesn't not have a UUID value built
764  /// into the file format, an MD5 checksum of the entire file, or
765  /// slice of the file for the current architecture should be used.
766  ///
767  /// @return
768  ///     A const pointer to the internal copy of the UUID value in
769  ///     this module if this module has a valid UUID value, NULL
770  ///     otherwise.
771  //------------------------------------------------------------------
772  const lldb_private::UUID &GetUUID();
773
774  //------------------------------------------------------------------
775  /// A debugging function that will cause everything in a module to
776  /// be parsed.
777  ///
778  /// All compile units will be parsed, along with all globals and
779  /// static variables and all functions for those compile units.
780  /// All types, scopes, local variables, static variables, global
781  /// variables, and line tables will be parsed. This can be used
782  /// prior to dumping a module to see a complete list of the
783  /// resulting debug information that gets parsed, or as a debug
784  /// function to ensure that the module can consume all of the
785  /// debug data the symbol vendor provides.
786  //------------------------------------------------------------------
787  void ParseAllDebugSymbols();
788
789  bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr);
790
791  //------------------------------------------------------------------
792  /// Resolve the symbol context for the given address.
793  ///
794  /// Tries to resolve the matching symbol context based on a lookup
795  /// from the current symbol vendor.  If the lazy lookup fails,
796  /// an attempt is made to parse the eh_frame section to handle
797  /// stripped symbols.  If this fails, an attempt is made to resolve
798  /// the symbol to the previous address to handle the case of a
799  /// function with a tail call.
800  ///
801  /// Use properties of the modified SymbolContext to inspect any
802  /// resolved target, module, compilation unit, symbol, function,
803  /// function block or line entry.  Use the return value to determine
804  /// which of these properties have been modified.
805  ///
806  /// @param[in] so_addr
807  ///     A load address to resolve.
808  ///
809  /// @param[in] resolve_scope
810  ///     The scope that should be resolved (see SymbolContext::Scope).
811  ///     A combination of flags from the enumeration SymbolContextItem
812  ///     requesting a resolution depth.  Note that the flags that are
813  ///     actually resolved may be a superset of the requested flags.
814  ///     For instance, eSymbolContextSymbol requires resolution of
815  ///     eSymbolContextModule, and eSymbolContextFunction requires
816  ///     eSymbolContextSymbol.
817  ///
818  /// @param[out] sc
819  ///     The SymbolContext that is modified based on symbol resolution.
820  ///
821  /// @param[in] resolve_tail_call_address
822  ///     Determines if so_addr should resolve to a symbol in the case
823  ///     of a function whose last instruction is a call.  In this case,
824  ///     the PC can be one past the address range of the function.
825  ///
826  /// @return
827  ///     The scope that has been resolved (see SymbolContext::Scope).
828  ///
829  /// @see SymbolContext::Scope
830  //------------------------------------------------------------------
831  uint32_t
832  ResolveSymbolContextForAddress(const Address &so_addr, uint32_t resolve_scope,
833                                 SymbolContext &sc,
834                                 bool resolve_tail_call_address = false);
835
836  //------------------------------------------------------------------
837  /// Resolve items in the symbol context for a given file and line.
838  ///
839  /// Tries to resolve \a file_path and \a line to a list of matching
840  /// symbol contexts.
841  ///
842  /// The line table entries contains addresses that can be used to
843  /// further resolve the values in each match: the function, block,
844  /// symbol. Care should be taken to minimize the amount of
845  /// information that is requested to only what is needed --
846  /// typically the module, compile unit, line table and line table
847  /// entry are sufficient.
848  ///
849  /// @param[in] file_path
850  ///     A path to a source file to match. If \a file_path does not
851  ///     specify a directory, then this query will match all files
852  ///     whose base filename matches. If \a file_path does specify
853  ///     a directory, the fullpath to the file must match.
854  ///
855  /// @param[in] line
856  ///     The source line to match, or zero if just the compile unit
857  ///     should be resolved.
858  ///
859  /// @param[in] check_inlines
860  ///     Check for inline file and line number matches. This option
861  ///     should be used sparingly as it will cause all line tables
862  ///     for every compile unit to be parsed and searched for
863  ///     matching inline file entries.
864  ///
865  /// @param[in] resolve_scope
866  ///     The scope that should be resolved (see
867  ///     SymbolContext::Scope).
868  ///
869  /// @param[out] sc_list
870  ///     A symbol context list that gets matching symbols contexts
871  ///     appended to.
872  ///
873  /// @return
874  ///     The number of matches that were added to \a sc_list.
875  ///
876  /// @see SymbolContext::Scope
877  //------------------------------------------------------------------
878  uint32_t ResolveSymbolContextForFilePath(const char *file_path, uint32_t line,
879                                           bool check_inlines,
880                                           uint32_t resolve_scope,
881                                           SymbolContextList &sc_list);
882
883  //------------------------------------------------------------------
884  /// Resolve items in the symbol context for a given file and line.
885  ///
886  /// Tries to resolve \a file_spec and \a line to a list of matching
887  /// symbol contexts.
888  ///
889  /// The line table entries contains addresses that can be used to
890  /// further resolve the values in each match: the function, block,
891  /// symbol. Care should be taken to minimize the amount of
892  /// information that is requested to only what is needed --
893  /// typically the module, compile unit, line table and line table
894  /// entry are sufficient.
895  ///
896  /// @param[in] file_spec
897  ///     A file spec to a source file to match. If \a file_path does
898  ///     not specify a directory, then this query will match all
899  ///     files whose base filename matches. If \a file_path does
900  ///     specify a directory, the fullpath to the file must match.
901  ///
902  /// @param[in] line
903  ///     The source line to match, or zero if just the compile unit
904  ///     should be resolved.
905  ///
906  /// @param[in] check_inlines
907  ///     Check for inline file and line number matches. This option
908  ///     should be used sparingly as it will cause all line tables
909  ///     for every compile unit to be parsed and searched for
910  ///     matching inline file entries.
911  ///
912  /// @param[in] resolve_scope
913  ///     The scope that should be resolved (see
914  ///     SymbolContext::Scope).
915  ///
916  /// @param[out] sc_list
917  ///     A symbol context list that gets filled in with all of the
918  ///     matches.
919  ///
920  /// @return
921  ///     A integer that contains SymbolContext::Scope bits set for
922  ///     each item that was successfully resolved.
923  ///
924  /// @see SymbolContext::Scope
925  //------------------------------------------------------------------
926  uint32_t ResolveSymbolContextsForFileSpec(const FileSpec &file_spec,
927                                            uint32_t line, bool check_inlines,
928                                            uint32_t resolve_scope,
929                                            SymbolContextList &sc_list);
930
931  void SetFileSpecAndObjectName(const FileSpec &file,
932                                const ConstString &object_name);
933
934  bool GetIsDynamicLinkEditor();
935
936  TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language);
937
938  // Special error functions that can do printf style formatting that will
939  // prepend the message with
940  // something appropriate for this module (like the architecture, path and
941  // object name (if any)).
942  // This centralizes code so that everyone doesn't need to format their error
943  // and log messages on
944  // their own and keeps the output a bit more consistent.
945  void LogMessage(Log *log, const char *format, ...)
946      __attribute__((format(printf, 3, 4)));
947
948  void LogMessageVerboseBacktrace(Log *log, const char *format, ...)
949      __attribute__((format(printf, 3, 4)));
950
951  void ReportWarning(const char *format, ...)
952      __attribute__((format(printf, 2, 3)));
953
954  void ReportError(const char *format, ...)
955      __attribute__((format(printf, 2, 3)));
956
957  // Only report an error once when the module is first detected to be modified
958  // so we don't spam the console with many messages.
959  void ReportErrorIfModifyDetected(const char *format, ...)
960      __attribute__((format(printf, 2, 3)));
961
962  //------------------------------------------------------------------
963  // Return true if the file backing this module has changed since the
964  // module was originally created  since we saved the initial file
965  // modification time when the module first gets created.
966  //------------------------------------------------------------------
967  bool FileHasChanged() const;
968
969  //------------------------------------------------------------------
970  // SymbolVendor, SymbolFile and ObjectFile member objects should
971  // lock the module mutex to avoid deadlocks.
972  //------------------------------------------------------------------
973  std::recursive_mutex &GetMutex() const { return m_mutex; }
974
975  PathMappingList &GetSourceMappingList() { return m_source_mappings; }
976
977  const PathMappingList &GetSourceMappingList() const {
978    return m_source_mappings;
979  }
980
981  //------------------------------------------------------------------
982  /// Finds a source file given a file spec using the module source
983  /// path remappings (if any).
984  ///
985  /// Tries to resolve \a orig_spec by checking the module source path
986  /// remappings. It makes sure the file exists, so this call can be
987  /// expensive if the remappings are on a network file system, so
988  /// use this function sparingly (not in a tight debug info parsing
989  /// loop).
990  ///
991  /// @param[in] orig_spec
992  ///     The original source file path to try and remap.
993  ///
994  /// @param[out] new_spec
995  ///     The newly remapped filespec that is guaranteed to exist.
996  ///
997  /// @return
998  ///     /b true if \a orig_spec was successfully located and
999  ///     \a new_spec is filled in with an existing file spec,
1000  ///     \b false otherwise.
1001  //------------------------------------------------------------------
1002  bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
1003
1004  //------------------------------------------------------------------
1005  /// Remaps a source file given \a path into \a new_path.
1006  ///
1007  /// Remaps \a path if any source remappings match. This function
1008  /// does NOT stat the file system so it can be used in tight loops
1009  /// where debug info is being parsed.
1010  ///
1011  /// @param[in] path
1012  ///     The original source file path to try and remap.
1013  ///
1014  /// @param[out] new_path
1015  ///     The newly remapped filespec that is may or may not exist.
1016  ///
1017  /// @return
1018  ///     /b true if \a path was successfully located and \a new_path
1019  ///     is filled in with a new source path, \b false otherwise.
1020  //------------------------------------------------------------------
1021  bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
1022  bool RemapSourceFile(const char *, std::string &) const = delete;
1023
1024  //------------------------------------------------------------------
1025  /// Loads this module to memory.
1026  ///
1027  /// Loads the bits needed to create an executable image to the memory.
1028  /// It is useful with bare-metal targets where target does not have the
1029  /// ability to start a process itself.
1030  ///
1031  /// @param[in] target
1032  ///     Target where to load the module.
1033  ///
1034  /// @return
1035  //------------------------------------------------------------------
1036  Status LoadInMemory(Target &target, bool set_pc);
1037
1038  //----------------------------------------------------------------------
1039  /// @class LookupInfo Module.h "lldb/Core/Module.h"
1040  /// @brief A class that encapsulates name lookup information.
1041  ///
1042  /// Users can type a wide variety of partial names when setting
1043  /// breakpoints by name or when looking for functions by name.
1044  /// SymbolVendor and SymbolFile objects are only required to implement
1045  /// name lookup for function basenames and for fully mangled names.
1046  /// This means if the user types in a partial name, we must reduce this
1047  /// to a name lookup that will work with all SymbolFile objects. So we
1048  /// might reduce a name lookup to look for a basename, and then prune
1049  /// out any results that don't match.
1050  ///
1051  /// The "m_name" member variable represents the name as it was typed
1052  /// by the user. "m_lookup_name" will be the name we actually search
1053  /// for through the symbol or objects files. Lanaguage is included in
1054  /// case we need to filter results by language at a later date. The
1055  /// "m_name_type_mask" member variable tells us what kinds of names we
1056  /// are looking for and can help us prune out unwanted results.
1057  ///
1058  /// Function lookups are done in Module.cpp, ModuleList.cpp and in
1059  /// BreakpointResolverName.cpp and they all now use this class to do
1060  /// lookups correctly.
1061  //----------------------------------------------------------------------
1062  class LookupInfo {
1063  public:
1064    LookupInfo()
1065        : m_name(), m_lookup_name(), m_language(lldb::eLanguageTypeUnknown),
1066          m_name_type_mask(0), m_match_name_after_lookup(false) {}
1067
1068    LookupInfo(const ConstString &name, uint32_t name_type_mask,
1069               lldb::LanguageType language);
1070
1071    const ConstString &GetName() const { return m_name; }
1072
1073    void SetName(const ConstString &name) { m_name = name; }
1074
1075    const ConstString &GetLookupName() const { return m_lookup_name; }
1076
1077    void SetLookupName(const ConstString &name) { m_lookup_name = name; }
1078
1079    uint32_t GetNameTypeMask() const { return m_name_type_mask; }
1080
1081    void SetNameTypeMask(uint32_t mask) { m_name_type_mask = mask; }
1082
1083    void Prune(SymbolContextList &sc_list, size_t start_idx) const;
1084
1085  protected:
1086    ConstString m_name;        ///< What the user originally typed
1087    ConstString m_lookup_name; ///< The actual name will lookup when calling in
1088                               ///the object or symbol file
1089    lldb::LanguageType
1090        m_language;            ///< Limit matches to only be for this language
1091    uint32_t m_name_type_mask; ///< One or more bits from lldb::FunctionNameType
1092                               ///that indicate what kind of names we are
1093                               ///looking for
1094    bool m_match_name_after_lookup; ///< If \b true, then demangled names that
1095                                    ///match will need to contain "m_name" in
1096                                    ///order to be considered a match
1097  };
1098
1099protected:
1100  //------------------------------------------------------------------
1101  // Member Variables
1102  //------------------------------------------------------------------
1103  mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy
1104                                        ///in multi-threaded environments.
1105
1106  /// The modification time for this module when it was created.
1107  llvm::sys::TimePoint<> m_mod_time;
1108
1109  ArchSpec m_arch;      ///< The architecture for this module.
1110  UUID m_uuid; ///< Each module is assumed to have a unique identifier to help
1111               ///match it up to debug symbols.
1112  FileSpec m_file; ///< The file representation on disk for this module (if
1113                   ///there is one).
1114  FileSpec m_platform_file; ///< The path to the module on the platform on which
1115                            ///it is being debugged
1116  FileSpec m_remote_install_file; ///< If set when debugging on remote
1117                                  ///platforms, this module will be installed at
1118                                  ///this location
1119  FileSpec m_symfile_spec;   ///< If this path is valid, then this is the file
1120                             ///that _will_ be used as the symbol file for this
1121                             ///module
1122  ConstString m_object_name; ///< The name an object within this module that is
1123                             ///selected, or empty of the module is represented
1124                             ///by \a m_file.
1125  uint64_t m_object_offset;
1126  llvm::sys::TimePoint<> m_object_mod_time;
1127  lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
1128                                   ///parser for this module as it may or may
1129                                   ///not be shared with the SymbolFile
1130  lldb::SymbolVendorUP
1131      m_symfile_ap; ///< A pointer to the symbol vendor for this module.
1132  std::vector<lldb::SymbolVendorUP>
1133      m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and
1134                      ///changes the symbol file,
1135  ///< we need to keep all old symbol files around in case anyone has type
1136  ///references to them
1137  TypeSystemMap m_type_system_map;   ///< A map of any type systems associated
1138                                     ///with this module
1139  PathMappingList m_source_mappings; ///< Module specific source remappings for
1140                                     ///when you have debug info for a module
1141                                     ///that doesn't match where the sources
1142                                     ///currently are
1143  lldb::SectionListUP m_sections_ap; ///< Unified section list for module that
1144                                     ///is used by the ObjectFile and and
1145                                     ///ObjectFile instances for the debug info
1146
1147  std::atomic<bool> m_did_load_objfile{false};
1148  std::atomic<bool> m_did_load_symbol_vendor{false};
1149  std::atomic<bool> m_did_parse_uuid{false};
1150  mutable bool m_file_has_changed : 1,
1151      m_first_file_changed_log : 1; /// See if the module was modified after it
1152                                    /// was initially opened.
1153
1154  //------------------------------------------------------------------
1155  /// Resolve a file or load virtual address.
1156  ///
1157  /// Tries to resolve \a vm_addr as a file address (if \a
1158  /// vm_addr_is_file_addr is true) or as a load address if \a
1159  /// vm_addr_is_file_addr is false) in the symbol vendor.
1160  /// \a resolve_scope indicates what clients wish to resolve
1161  /// and can be used to limit the scope of what is parsed.
1162  ///
1163  /// @param[in] vm_addr
1164  ///     The load virtual address to resolve.
1165  ///
1166  /// @param[in] vm_addr_is_file_addr
1167  ///     If \b true, \a vm_addr is a file address, else \a vm_addr
1168  ///     if a load address.
1169  ///
1170  /// @param[in] resolve_scope
1171  ///     The scope that should be resolved (see
1172  ///     SymbolContext::Scope).
1173  ///
1174  /// @param[out] so_addr
1175  ///     The section offset based address that got resolved if
1176  ///     any bits are returned.
1177  ///
1178  /// @param[out] sc
1179  //      The symbol context that has objects filled in. Each bit
1180  ///     in the \a resolve_scope pertains to a member in the \a sc.
1181  ///
1182  /// @return
1183  ///     A integer that contains SymbolContext::Scope bits set for
1184  ///     each item that was successfully resolved.
1185  ///
1186  /// @see SymbolContext::Scope
1187  //------------------------------------------------------------------
1188  uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr,
1189                                          bool vm_addr_is_file_addr,
1190                                          uint32_t resolve_scope,
1191                                          Address &so_addr, SymbolContext &sc);
1192
1193  void SymbolIndicesToSymbolContextList(Symtab *symtab,
1194                                        std::vector<uint32_t> &symbol_indexes,
1195                                        SymbolContextList &sc_list);
1196
1197  bool SetArchitecture(const ArchSpec &new_arch);
1198
1199  SectionList *GetUnifiedSectionList();
1200
1201  friend class ModuleList;
1202  friend class ObjectFile;
1203  friend class SymbolFile;
1204
1205private:
1206  Module(); // Only used internally by CreateJITModule ()
1207
1208  size_t FindTypes_Impl(
1209      const SymbolContext &sc, const ConstString &name,
1210      const CompilerDeclContext *parent_decl_ctx, bool append,
1211      size_t max_matches,
1212      llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
1213      TypeMap &types);
1214
1215  DISALLOW_COPY_AND_ASSIGN(Module);
1216};
1217
1218} // namespace lldb_private
1219
1220#endif // liblldb_Module_h_
1221