LLDB  mainline
Module.h
Go to the documentation of this file.
1 //===-- Module.h ------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_CORE_MODULE_H
10 #define LLDB_CORE_MODULE_H
11 
12 #include "lldb/Core/Address.h"
13 #include "lldb/Core/ModuleList.h"
14 #include "lldb/Core/ModuleSpec.h"
15 #include "lldb/Symbol/ObjectFile.h"
17 #include "lldb/Symbol/TypeSystem.h"
19 #include "lldb/Utility/ArchSpec.h"
21 #include "lldb/Utility/FileSpec.h"
22 #include "lldb/Utility/Status.h"
23 #include "lldb/Utility/XcodeSDK.h"
24 #include "lldb/Utility/UUID.h"
25 #include "lldb/lldb-defines.h"
26 #include "lldb/lldb-enumerations.h"
27 #include "lldb/lldb-forward.h"
28 #include "lldb/lldb-types.h"
29 
30 #include "llvm/ADT/DenseSet.h"
31 #include "llvm/ADT/StringRef.h"
32 #include "llvm/Support/Chrono.h"
33 
34 #include <atomic>
35 #include <cstddef>
36 #include <cstdint>
37 #include <memory>
38 #include <mutex>
39 #include <string>
40 #include <vector>
41 
42 namespace lldb_private {
43 class CompilerDeclContext;
44 class Function;
45 class Log;
46 class ObjectFile;
47 class RegularExpression;
48 class SectionList;
49 class Stream;
50 class Symbol;
51 class SymbolContext;
52 class SymbolContextList;
53 class SymbolFile;
54 class Symtab;
55 class Target;
56 class TypeList;
57 class TypeMap;
58 class VariableList;
59 
60 /// Options used by Module::FindFunctions. This cannot be a nested class
61 /// because it must be forward-declared in ModuleList.h.
63  /// Include the symbol table.
64  bool include_symbols = false;
65  /// Include inlined functions.
66  bool include_inlines = false;
67 };
68 
69 /// \class Module Module.h "lldb/Core/Module.h"
70 /// A class that describes an executable image and its associated
71 /// object and symbol files.
72 ///
73 /// The module is designed to be able to select a single slice of an
74 /// executable image as it would appear on disk and during program execution.
75 ///
76 /// Modules control when and if information is parsed according to which
77 /// accessors are called. For example the object file (ObjectFile)
78 /// representation will only be parsed if the object file is requested using
79 /// the Module::GetObjectFile() is called. The debug symbols will only be
80 /// parsed if the symbol file (SymbolFile) is requested using the
81 /// Module::GetSymbolFile() method.
82 ///
83 /// The module will parse more detailed information as more queries are made.
84 class Module : public std::enable_shared_from_this<Module>,
85  public SymbolContextScope {
86 public:
87  // Static functions that can track the lifetime of module objects. This is
88  // handy because we might have Module objects that are in shared pointers
89  // that aren't in the global module list (from ModuleList). If this is the
90  // case we need to know about it. The modules in the global list maintained
91  // by these functions can be viewed using the "target modules list" command
92  // using the "--global" (-g for short).
93  static size_t GetNumberAllocatedModules();
94 
95  static Module *GetAllocatedModuleAtIndex(size_t idx);
96 
97  static std::recursive_mutex &GetAllocationModuleCollectionMutex();
98 
99  /// Construct with file specification and architecture.
100  ///
101  /// Clients that wish to share modules with other targets should use
102  /// ModuleList::GetSharedModule().
103  ///
104  /// \param[in] file_spec
105  /// The file specification for the on disk representation of
106  /// this executable image.
107  ///
108  /// \param[in] arch
109  /// The architecture to set as the current architecture in
110  /// this module.
111  ///
112  /// \param[in] object_name
113  /// The name of an object in a module used to extract a module
114  /// within a module (.a files and modules that contain multiple
115  /// architectures).
116  ///
117  /// \param[in] object_offset
118  /// The offset within an existing module used to extract a
119  /// module within a module (.a files and modules that contain
120  /// multiple architectures).
121  Module(
122  const FileSpec &file_spec, const ArchSpec &arch,
123  const ConstString *object_name = nullptr,
124  lldb::offset_t object_offset = 0,
125  const llvm::sys::TimePoint<> &object_mod_time = llvm::sys::TimePoint<>());
126 
127  Module(const ModuleSpec &module_spec);
128 
129  template <typename ObjFilePlugin, typename... Args>
130  static lldb::ModuleSP CreateModuleFromObjectFile(Args &&... args) {
131  // Must create a module and place it into a shared pointer before we can
132  // create an object file since it has a std::weak_ptr back to the module,
133  // so we need to control the creation carefully in this static function
134  lldb::ModuleSP module_sp(new Module());
135  module_sp->m_objfile_sp =
136  std::make_shared<ObjFilePlugin>(module_sp, std::forward<Args>(args)...);
137  module_sp->m_did_load_objfile.store(true, std::memory_order_relaxed);
138 
139  // Once we get the object file, set module ArchSpec to the one we get from
140  // the object file. If the object file does not have an architecture, we
141  // consider the creation a failure.
142  ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture();
143  if (!arch)
144  return nullptr;
145  module_sp->m_arch = arch;
146 
147  // Also copy the object file's FileSpec.
148  module_sp->m_file = module_sp->m_objfile_sp->GetFileSpec();
149  return module_sp;
150  }
151 
152  /// Destructor.
153  ~Module() override;
154 
155  bool MatchesModuleSpec(const ModuleSpec &module_ref);
156 
157  /// Set the load address for all sections in a module to be the file address
158  /// plus \a slide.
159  ///
160  /// Many times a module will be loaded in a target with a constant offset
161  /// applied to all top level sections. This function can set the load
162  /// address for all top level sections to be the section file address +
163  /// offset.
164  ///
165  /// \param[in] target
166  /// The target in which to apply the section load addresses.
167  ///
168  /// \param[in] value
169  /// if \a value_is_offset is true, then value is the offset to
170  /// apply to all file addresses for all top level sections in
171  /// the object file as each section load address is being set.
172  /// If \a value_is_offset is false, then "value" is the new
173  /// absolute base address for the image.
174  ///
175  /// \param[in] value_is_offset
176  /// If \b true, then \a value is an offset to apply to each
177  /// file address of each top level section.
178  /// If \b false, then \a value is the image base address that
179  /// will be used to rigidly slide all loadable sections.
180  ///
181  /// \param[out] changed
182  /// If any section load addresses were changed in \a target,
183  /// then \a changed will be set to \b true. Else \a changed
184  /// will be set to false. This allows this function to be
185  /// called multiple times on the same module for the same
186  /// target. If the module hasn't moved, then \a changed will
187  /// be false and no module updated notification will need to
188  /// be sent out.
189  ///
190  /// \return
191  /// /b True if any sections were successfully loaded in \a target,
192  /// /b false otherwise.
193  bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset,
194  bool &changed);
195 
196  /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
197  ///
198  /// \see SymbolContextScope
199  void CalculateSymbolContext(SymbolContext *sc) override;
200 
201  lldb::ModuleSP CalculateSymbolContextModule() override;
202 
203  void
204  GetDescription(llvm::raw_ostream &s,
206 
207  /// Get the module path and object name.
208  ///
209  /// Modules can refer to object files. In this case the specification is
210  /// simple and would return the path to the file:
211  ///
212  /// "/usr/lib/foo.dylib"
213  ///
214  /// Modules can be .o files inside of a BSD archive (.a file). In this case,
215  /// the object specification will look like:
216  ///
217  /// "/usr/lib/foo.a(bar.o)"
218  ///
219  /// There are many places where logging wants to log this fully qualified
220  /// specification, so we centralize this functionality here.
221  ///
222  /// \return
223  /// The object path + object name if there is one.
225 
226  /// Dump a description of this object to a Stream.
227  ///
228  /// Dump a description of the contents of this object to the supplied stream
229  /// \a s. The dumped content will be only what has been loaded or parsed up
230  /// to this point at which this function is called, so this is a good way to
231  /// see what has been parsed in a module.
232  ///
233  /// \param[in] s
234  /// The stream to which to dump the object description.
235  void Dump(Stream *s);
236 
237  /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
238  ///
239  /// \see SymbolContextScope
240  void DumpSymbolContext(Stream *s) override;
241 
242  /// Find a symbol in the object file's symbol table.
243  ///
244  /// \param[in] name
245  /// The name of the symbol that we are looking for.
246  ///
247  /// \param[in] symbol_type
248  /// If set to eSymbolTypeAny, find a symbol of any type that
249  /// has a name that matches \a name. If set to any other valid
250  /// SymbolType enumeration value, then search only for
251  /// symbols that match \a symbol_type.
252  ///
253  /// \return
254  /// Returns a valid symbol pointer if a symbol was found,
255  /// nullptr otherwise.
257  ConstString name,
258  lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
259 
261  lldb::SymbolType symbol_type,
262  SymbolContextList &sc_list);
263 
265  lldb::SymbolType symbol_type,
266  SymbolContextList &sc_list);
267 
268  /// Find a function symbols in the object file's symbol table.
269  ///
270  /// \param[in] name
271  /// The name of the symbol that we are looking for.
272  ///
273  /// \param[in] name_type_mask
274  /// A mask that has one or more bitwise OR'ed values from the
275  /// lldb::FunctionNameType enumeration type that indicate what
276  /// kind of names we are looking for.
277  ///
278  /// \param[out] sc_list
279  /// A list to append any matching symbol contexts to.
280  void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
281  SymbolContextList &sc_list);
282 
283  /// Find compile units by partial or full path.
284  ///
285  /// Finds all compile units that match \a path in all of the modules and
286  /// returns the results in \a sc_list.
287  ///
288  /// \param[in] path
289  /// The name of the function we are looking for.
290  ///
291  /// \param[out] sc_list
292  /// A symbol context list that gets filled in with all of the
293  /// matches.
294  void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list);
295 
296  /// Find functions by name.
297  ///
298  /// If the function is an inlined function, it will have a block,
299  /// representing the inlined function, and the function will be the
300  /// containing function. If it is not inlined, then the block will be NULL.
301  ///
302  /// \param[in] name
303  /// The name of the compile unit we are looking for.
304  ///
305  /// \param[in] name_type_mask
306  /// A bit mask of bits that indicate what kind of names should
307  /// be used when doing the lookup. Bits include fully qualified
308  /// names, base names, C++ methods, or ObjC selectors.
309  /// See FunctionNameType for more details.
310  ///
311  /// \param[out] sc_list
312  /// A symbol context list that gets filled in with all of the
313  /// matches.
314  void FindFunctions(ConstString name,
315  const CompilerDeclContext &parent_decl_ctx,
316  lldb::FunctionNameType name_type_mask,
317  const ModuleFunctionSearchOptions &options,
318  SymbolContextList &sc_list);
319 
320  /// Find functions by name.
321  ///
322  /// If the function is an inlined function, it will have a block,
323  /// representing the inlined function, and the function will be the
324  /// containing function. If it is not inlined, then the block will be NULL.
325  ///
326  /// \param[in] regex
327  /// A regular expression to use when matching the name.
328  ///
329  /// \param[out] sc_list
330  /// A symbol context list that gets filled in with all of the
331  /// matches.
332  void FindFunctions(const RegularExpression &regex,
333  const ModuleFunctionSearchOptions &options,
334  SymbolContextList &sc_list);
335 
336  /// Find addresses by file/line
337  ///
338  /// \param[in] target_sp
339  /// The target the addresses are desired for.
340  ///
341  /// \param[in] file
342  /// Source file to locate.
343  ///
344  /// \param[in] line
345  /// Source line to locate.
346  ///
347  /// \param[in] function
348  /// Optional filter function. Addresses within this function will be
349  /// added to the 'local' list. All others will be added to the 'extern'
350  /// list.
351  ///
352  /// \param[out] output_local
353  /// All matching addresses within 'function'
354  ///
355  /// \param[out] output_extern
356  /// All matching addresses not within 'function'
357  void FindAddressesForLine(const lldb::TargetSP target_sp,
358  const FileSpec &file, uint32_t line,
359  Function *function,
360  std::vector<Address> &output_local,
361  std::vector<Address> &output_extern);
362 
363  /// Find global and static variables by name.
364  ///
365  /// \param[in] name
366  /// The name of the global or static variable we are looking
367  /// for.
368  ///
369  /// \param[in] parent_decl_ctx
370  /// If valid, a decl context that results must exist within
371  ///
372  /// \param[in] max_matches
373  /// Allow the number of matches to be limited to \a
374  /// max_matches. Specify UINT32_MAX to get all possible matches.
375  ///
376  /// \param[in] variable_list
377  /// A list of variables that gets the matches appended to.
378  ///
380  const CompilerDeclContext &parent_decl_ctx,
381  size_t max_matches, VariableList &variable_list);
382 
383  /// Find global and static variables by regular expression.
384  ///
385  /// \param[in] regex
386  /// A regular expression to use when matching the name.
387  ///
388  /// \param[in] max_matches
389  /// Allow the number of matches to be limited to \a
390  /// max_matches. Specify UINT32_MAX to get all possible matches.
391  ///
392  /// \param[in] variable_list
393  /// A list of variables that gets the matches appended to.
394  ///
395  void FindGlobalVariables(const RegularExpression &regex, size_t max_matches,
396  VariableList &variable_list);
397 
398  /// Find types by name.
399  ///
400  /// Type lookups in modules go through the SymbolFile. The SymbolFile needs to
401  /// be able to lookup types by basename and not the fully qualified typename.
402  /// This allows the type accelerator tables to stay small, even with heavily
403  /// templatized C++. The type search will then narrow down the search
404  /// results. If "exact_match" is true, then the type search will only match
405  /// exact type name matches. If "exact_match" is false, the type will match
406  /// as long as the base typename matches and as long as any immediate
407  /// containing namespaces/class scopes that are specified match. So to
408  /// search for a type "d" in "b::c", the name "b::c::d" can be specified and
409  /// it will match any class/namespace "b" which contains a class/namespace
410  /// "c" which contains type "d". We do this to allow users to not always
411  /// have to specify complete scoping on all expressions, but it also allows
412  /// for exact matching when required.
413  ///
414  /// \param[in] type_name
415  /// The name of the type we are looking for that is a fully
416  /// or partially qualified type name.
417  ///
418  /// \param[in] exact_match
419  /// If \b true, \a type_name is fully qualified and must match
420  /// exactly. If \b false, \a type_name is a partially qualified
421  /// name where the leading namespaces or classes can be
422  /// omitted to make finding types that a user may type
423  /// easier.
424  ///
425  /// \param[out] types
426  /// A type list gets populated with any matches.
427  ///
428  void
429  FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
430  llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
431  TypeList &types);
432 
433  /// Find types by name.
434  ///
435  /// This behaves like the other FindTypes method but allows to
436  /// specify a DeclContext and a language for the type being searched
437  /// for.
438  ///
439  /// \param searched_symbol_files
440  /// Prevents one file from being visited multiple times.
441  void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
442  llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
443  TypeMap &types);
444 
445  lldb::TypeSP FindFirstType(const SymbolContext &sc,
446  ConstString type_name, bool exact_match);
447 
448  /// Find types by name that are in a namespace. This function is used by the
449  /// expression parser when searches need to happen in an exact namespace
450  /// scope.
451  ///
452  /// \param[in] type_name
453  /// The name of a type within a namespace that should not include
454  /// any qualifying namespaces (just a type basename).
455  ///
456  /// \param[out] type_list
457  /// A type list gets populated with any matches.
458  void FindTypesInNamespace(ConstString type_name,
459  const CompilerDeclContext &parent_decl_ctx,
460  size_t max_matches, TypeList &type_list);
461 
462  /// Get const accessor for the module architecture.
463  ///
464  /// \return
465  /// A const reference to the architecture object.
466  const ArchSpec &GetArchitecture() const;
467 
468  /// Get const accessor for the module file specification.
469  ///
470  /// This function returns the file for the module on the host system that is
471  /// running LLDB. This can differ from the path on the platform since we
472  /// might be doing remote debugging.
473  ///
474  /// \return
475  /// A const reference to the file specification object.
476  const FileSpec &GetFileSpec() const { return m_file; }
477 
478  /// Get accessor for the module platform file specification.
479  ///
480  /// Platform file refers to the path of the module as it is known on the
481  /// remote system on which it is being debugged. For local debugging this is
482  /// always the same as Module::GetFileSpec(). But remote debugging might
483  /// mention a file "/usr/lib/liba.dylib" which might be locally downloaded
484  /// and cached. In this case the platform file could be something like:
485  /// "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib" The
486  /// file could also be cached in a local developer kit directory.
487  ///
488  /// \return
489  /// A const reference to the file specification object.
490  const FileSpec &GetPlatformFileSpec() const {
491  if (m_platform_file)
492  return m_platform_file;
493  return m_file;
494  }
495 
496  void SetPlatformFileSpec(const FileSpec &file) { m_platform_file = file; }
497 
499  return m_remote_install_file;
500  }
501 
502  void SetRemoteInstallFileSpec(const FileSpec &file) {
503  m_remote_install_file = file;
504  }
505 
506  const FileSpec &GetSymbolFileFileSpec() const { return m_symfile_spec; }
507 
508  void PreloadSymbols();
509 
510  void SetSymbolFileFileSpec(const FileSpec &file);
511 
512  const llvm::sys::TimePoint<> &GetModificationTime() const {
513  return m_mod_time;
514  }
515 
516  const llvm::sys::TimePoint<> &GetObjectModificationTime() const {
517  return m_object_mod_time;
518  }
519 
520  /// This callback will be called by SymbolFile implementations when
521  /// parsing a compile unit that contains SDK information.
522  /// \param sysroot will be added to the path remapping dictionary.
523  void RegisterXcodeSDK(llvm::StringRef sdk, llvm::StringRef sysroot);
524 
525  /// Tells whether this module is capable of being the main executable for a
526  /// process.
527  ///
528  /// \return
529  /// \b true if it is, \b false otherwise.
530  bool IsExecutable();
531 
532  /// Tells whether this module has been loaded in the target passed in. This
533  /// call doesn't distinguish between whether the module is loaded by the
534  /// dynamic loader, or by a "target module add" type call.
535  ///
536  /// \param[in] target
537  /// The target to check whether this is loaded in.
538  ///
539  /// \return
540  /// \b true if it is, \b false otherwise.
541  bool IsLoadedInTarget(Target *target);
542 
544  Stream *feedback_stream = nullptr);
545 
546  /// Get the number of compile units for this module.
547  ///
548  /// \return
549  /// The number of compile units that the symbol vendor plug-in
550  /// finds.
551  size_t GetNumCompileUnits();
552 
553  lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
554 
555  ConstString GetObjectName() const;
556 
557  uint64_t GetObjectOffset() const { return m_object_offset; }
558 
559  /// Get the object file representation for the current architecture.
560  ///
561  /// If the object file has not been located or parsed yet, this function
562  /// will find the best ObjectFile plug-in that can parse Module::m_file.
563  ///
564  /// \return
565  /// If Module::m_file does not exist, or no plug-in was found
566  /// that can parse the file, or the object file doesn't contain
567  /// the current architecture in Module::m_arch, nullptr will be
568  /// returned, else a valid object file interface will be
569  /// returned. The returned pointer is owned by this object and
570  /// remains valid as long as the object is around.
571  virtual ObjectFile *GetObjectFile();
572 
573  /// Get the unified section list for the module. This is the section list
574  /// created by the module's object file and any debug info and symbol files
575  /// created by the symbol vendor.
576  ///
577  /// If the symbol vendor has not been loaded yet, this function will return
578  /// the section list for the object file.
579  ///
580  /// \return
581  /// Unified module section list.
582  virtual SectionList *GetSectionList();
583 
584  /// Notify the module that the file addresses for the Sections have been
585  /// updated.
586  ///
587  /// If the Section file addresses for a module are updated, this method
588  /// should be called. Any parts of the module, object file, or symbol file
589  /// that has cached those file addresses must invalidate or update its
590  /// cache.
591  virtual void SectionFileAddressesChanged();
592 
593  /// Returns a reference to the UnwindTable for this Module
594  ///
595  /// The UnwindTable contains FuncUnwinders objects for any function in this
596  /// Module. If a FuncUnwinders object hasn't been created yet (i.e. the
597  /// function has yet to be unwound in a stack walk), it will be created when
598  /// requested. Specifically, we do not create FuncUnwinders objects for
599  /// functions until they are needed.
600  ///
601  /// \return
602  /// Returns the unwind table for this module. If this object has no
603  /// associated object file, an empty UnwindTable is returned.
605 
606  llvm::VersionTuple GetVersion();
607 
608  /// Load an object file from memory.
609  ///
610  /// If available, the size of the object file in memory may be passed to
611  /// avoid additional round trips to process memory. If the size is not
612  /// provided, a default value is used. This value should be large enough to
613  /// enable the ObjectFile plugins to read the header of the object file
614  /// without going back to the process.
615  ///
616  /// \return
617  /// The object file loaded from memory or nullptr, if the operation
618  /// failed (see the `error` for more information in that case).
619  ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
620  lldb::addr_t header_addr, Status &error,
621  size_t size_to_read = 512);
622 
623  /// Get the module's symbol file
624  ///
625  /// If the symbol file has already been loaded, this function returns it. All
626  /// arguments are ignored. If the symbol file has not been located yet, and
627  /// the can_create argument is false, the function returns nullptr. If
628  /// can_create is true, this function will find the best SymbolFile plug-in
629  /// that can use the current object file. feedback_strm, if not null, is used
630  /// to report the details of the search process.
631  virtual SymbolFile *GetSymbolFile(bool can_create = true,
632  Stream *feedback_strm = nullptr);
633 
634  Symtab *GetSymtab();
635 
636  /// Get a reference to the UUID value contained in this object.
637  ///
638  /// If the executable image file doesn't not have a UUID value built into
639  /// the file format, an MD5 checksum of the entire file, or slice of the
640  /// file for the current architecture should be used.
641  ///
642  /// \return
643  /// A const pointer to the internal copy of the UUID value in
644  /// this module if this module has a valid UUID value, NULL
645  /// otherwise.
646  const lldb_private::UUID &GetUUID();
647 
648  /// A debugging function that will cause everything in a module to
649  /// be parsed.
650  ///
651  /// All compile units will be parsed, along with all globals and static
652  /// variables and all functions for those compile units. All types, scopes,
653  /// local variables, static variables, global variables, and line tables
654  /// will be parsed. This can be used prior to dumping a module to see a
655  /// complete list of the resulting debug information that gets parsed, or as
656  /// a debug function to ensure that the module can consume all of the debug
657  /// data the symbol vendor provides.
658  void ParseAllDebugSymbols();
659 
660  bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr);
661 
662  /// Resolve the symbol context for the given address.
663  ///
664  /// Tries to resolve the matching symbol context based on a lookup from the
665  /// current symbol vendor. If the lazy lookup fails, an attempt is made to
666  /// parse the eh_frame section to handle stripped symbols. If this fails,
667  /// an attempt is made to resolve the symbol to the previous address to
668  /// handle the case of a function with a tail call.
669  ///
670  /// Use properties of the modified SymbolContext to inspect any resolved
671  /// target, module, compilation unit, symbol, function, function block or
672  /// line entry. Use the return value to determine which of these properties
673  /// have been modified.
674  ///
675  /// \param[in] so_addr
676  /// A load address to resolve.
677  ///
678  /// \param[in] resolve_scope
679  /// The scope that should be resolved (see SymbolContext::Scope).
680  /// A combination of flags from the enumeration SymbolContextItem
681  /// requesting a resolution depth. Note that the flags that are
682  /// actually resolved may be a superset of the requested flags.
683  /// For instance, eSymbolContextSymbol requires resolution of
684  /// eSymbolContextModule, and eSymbolContextFunction requires
685  /// eSymbolContextSymbol.
686  ///
687  /// \param[out] sc
688  /// The SymbolContext that is modified based on symbol resolution.
689  ///
690  /// \param[in] resolve_tail_call_address
691  /// Determines if so_addr should resolve to a symbol in the case
692  /// of a function whose last instruction is a call. In this case,
693  /// the PC can be one past the address range of the function.
694  ///
695  /// \return
696  /// The scope that has been resolved (see SymbolContext::Scope).
697  ///
698  /// \see SymbolContext::Scope
700  const Address &so_addr, lldb::SymbolContextItem resolve_scope,
701  SymbolContext &sc, bool resolve_tail_call_address = false);
702 
703  /// Resolve items in the symbol context for a given file and line.
704  ///
705  /// Tries to resolve \a file_path and \a line to a list of matching symbol
706  /// contexts.
707  ///
708  /// The line table entries contains addresses that can be used to further
709  /// resolve the values in each match: the function, block, symbol. Care
710  /// should be taken to minimize the amount of information that is requested
711  /// to only what is needed -- typically the module, compile unit, line table
712  /// and line table entry are sufficient.
713  ///
714  /// \param[in] file_path
715  /// A path to a source file to match. If \a file_path does not
716  /// specify a directory, then this query will match all files
717  /// whose base filename matches. If \a file_path does specify
718  /// a directory, the fullpath to the file must match.
719  ///
720  /// \param[in] line
721  /// The source line to match, or zero if just the compile unit
722  /// should be resolved.
723  ///
724  /// \param[in] check_inlines
725  /// Check for inline file and line number matches. This option
726  /// should be used sparingly as it will cause all line tables
727  /// for every compile unit to be parsed and searched for
728  /// matching inline file entries.
729  ///
730  /// \param[in] resolve_scope
731  /// The scope that should be resolved (see
732  /// SymbolContext::Scope).
733  ///
734  /// \param[out] sc_list
735  /// A symbol context list that gets matching symbols contexts
736  /// appended to.
737  ///
738  /// \return
739  /// The number of matches that were added to \a sc_list.
740  ///
741  /// \see SymbolContext::Scope
743  const char *file_path, uint32_t line, bool check_inlines,
744  lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
745 
746  /// Resolve items in the symbol context for a given file and line.
747  ///
748  /// Tries to resolve \a file_spec and \a line to a list of matching symbol
749  /// contexts.
750  ///
751  /// The line table entries contains addresses that can be used to further
752  /// resolve the values in each match: the function, block, symbol. Care
753  /// should be taken to minimize the amount of information that is requested
754  /// to only what is needed -- typically the module, compile unit, line table
755  /// and line table entry are sufficient.
756  ///
757  /// \param[in] file_spec
758  /// A file spec to a source file to match. If \a file_path does
759  /// not specify a directory, then this query will match all
760  /// files whose base filename matches. If \a file_path does
761  /// specify a directory, the fullpath to the file must match.
762  ///
763  /// \param[in] line
764  /// The source line to match, or zero if just the compile unit
765  /// should be resolved.
766  ///
767  /// \param[in] check_inlines
768  /// Check for inline file and line number matches. This option
769  /// should be used sparingly as it will cause all line tables
770  /// for every compile unit to be parsed and searched for
771  /// matching inline file entries.
772  ///
773  /// \param[in] resolve_scope
774  /// The scope that should be resolved (see
775  /// SymbolContext::Scope).
776  ///
777  /// \param[out] sc_list
778  /// A symbol context list that gets filled in with all of the
779  /// matches.
780  ///
781  /// \return
782  /// A integer that contains SymbolContext::Scope bits set for
783  /// each item that was successfully resolved.
784  ///
785  /// \see SymbolContext::Scope
787  const FileSpec &file_spec, uint32_t line, bool check_inlines,
788  lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
789 
790  void SetFileSpecAndObjectName(const FileSpec &file,
791  ConstString object_name);
792 
793  bool GetIsDynamicLinkEditor();
794 
795  llvm::Expected<TypeSystem &>
797 
798  // Special error functions that can do printf style formatting that will
799  // prepend the message with something appropriate for this module (like the
800  // architecture, path and object name (if any)). This centralizes code so
801  // that everyone doesn't need to format their error and log messages on their
802  // own and keeps the output a bit more consistent.
803  void LogMessage(Log *log, const char *format, ...)
804  __attribute__((format(printf, 3, 4)));
805 
806  void LogMessageVerboseBacktrace(Log *log, const char *format, ...)
807  __attribute__((format(printf, 3, 4)));
808 
809  void ReportWarning(const char *format, ...)
810  __attribute__((format(printf, 2, 3)));
811 
812  void ReportError(const char *format, ...)
813  __attribute__((format(printf, 2, 3)));
814 
815  // Only report an error once when the module is first detected to be modified
816  // so we don't spam the console with many messages.
817  void ReportErrorIfModifyDetected(const char *format, ...)
818  __attribute__((format(printf, 2, 3)));
819 
820  // Return true if the file backing this module has changed since the module
821  // was originally created since we saved the initial file modification time
822  // when the module first gets created.
823  bool FileHasChanged() const;
824 
825  // SymbolFile and ObjectFile member objects should lock the
826  // module mutex to avoid deadlocks.
827  std::recursive_mutex &GetMutex() const { return m_mutex; }
828 
830 
832  return m_source_mappings;
833  }
834 
835  /// Finds a source file given a file spec using the module source path
836  /// remappings (if any).
837  ///
838  /// Tries to resolve \a orig_spec by checking the module source path
839  /// remappings. It makes sure the file exists, so this call can be expensive
840  /// if the remappings are on a network file system, so use this function
841  /// sparingly (not in a tight debug info parsing loop).
842  ///
843  /// \param[in] orig_spec
844  /// The original source file path to try and remap.
845  ///
846  /// \param[out] new_spec
847  /// The newly remapped filespec that is guaranteed to exist.
848  ///
849  /// \return
850  /// /b true if \a orig_spec was successfully located and
851  /// \a new_spec is filled in with an existing file spec,
852  /// \b false otherwise.
853  bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
854 
855  /// Remaps a source file given \a path into \a new_path.
856  ///
857  /// Remaps \a path if any source remappings match. This function does NOT
858  /// stat the file system so it can be used in tight loops where debug info
859  /// is being parsed.
860  ///
861  /// \param[in] path
862  /// The original source file path to try and remap.
863  ///
864  /// \return
865  /// The newly remapped filespec that is may or may not exist if
866  /// \a path was successfully located.
867  llvm::Optional<std::string> RemapSourceFile(llvm::StringRef path) const;
868  bool RemapSourceFile(const char *, std::string &) const = delete;
869 
870  /// Update the ArchSpec to a more specific variant.
871  bool MergeArchitecture(const ArchSpec &arch_spec);
872 
873  /// \class LookupInfo Module.h "lldb/Core/Module.h"
874  /// A class that encapsulates name lookup information.
875  ///
876  /// Users can type a wide variety of partial names when setting breakpoints
877  /// by name or when looking for functions by name. The SymbolFile object is
878  /// only required to implement name lookup for function basenames and for
879  /// fully mangled names. This means if the user types in a partial name, we
880  /// must reduce this to a name lookup that will work with all SymbolFile
881  /// objects. So we might reduce a name lookup to look for a basename, and then
882  /// prune out any results that don't match.
883  ///
884  /// The "m_name" member variable represents the name as it was typed by the
885  /// user. "m_lookup_name" will be the name we actually search for through
886  /// the symbol or objects files. Lanaguage is included in case we need to
887  /// filter results by language at a later date. The "m_name_type_mask"
888  /// member variable tells us what kinds of names we are looking for and can
889  /// help us prune out unwanted results.
890  ///
891  /// Function lookups are done in Module.cpp, ModuleList.cpp and in
892  /// BreakpointResolverName.cpp and they all now use this class to do lookups
893  /// correctly.
894  class LookupInfo {
895  public:
897 
898  LookupInfo(ConstString name, lldb::FunctionNameType name_type_mask,
899  lldb::LanguageType language);
900 
901  ConstString GetName() const { return m_name; }
902 
903  void SetName(ConstString name) { m_name = name; }
904 
906 
907  void SetLookupName(ConstString name) { m_lookup_name = name; }
908 
909  lldb::FunctionNameType GetNameTypeMask() const { return m_name_type_mask; }
910 
911  void SetNameTypeMask(lldb::FunctionNameType mask) {
912  m_name_type_mask = mask;
913  }
914 
915  void Prune(SymbolContextList &sc_list, size_t start_idx) const;
916 
917  protected:
918  /// What the user originally typed
920 
921  /// The actual name will lookup when calling in the object or symbol file
923 
924  /// Limit matches to only be for this language
926 
927  /// One or more bits from lldb::FunctionNameType that indicate what kind of
928  /// names we are looking for
929  lldb::FunctionNameType m_name_type_mask = lldb::eFunctionNameTypeNone;
930 
931  ///< If \b true, then demangled names that match will need to contain
932  ///< "m_name" in order to be considered a match
934  };
935 
936 protected:
937  // Member Variables
938  mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy
939  ///in multi-threaded environments.
940 
941  /// The modification time for this module when it was created.
942  llvm::sys::TimePoint<> m_mod_time;
943 
944  ArchSpec m_arch; ///< The architecture for this module.
945  UUID m_uuid; ///< Each module is assumed to have a unique identifier to help
946  ///match it up to debug symbols.
947  FileSpec m_file; ///< The file representation on disk for this module (if
948  ///there is one).
949  FileSpec m_platform_file; ///< The path to the module on the platform on which
950  ///it is being debugged
951  FileSpec m_remote_install_file; ///< If set when debugging on remote
952  ///platforms, this module will be installed at
953  ///this location
954  FileSpec m_symfile_spec; ///< If this path is valid, then this is the file
955  ///that _will_ be used as the symbol file for this
956  ///module
957  ConstString m_object_name; ///< The name an object within this module that is
958  ///selected, or empty of the module is represented
959  ///by \a m_file.
960  uint64_t m_object_offset = 0;
961  llvm::sys::TimePoint<> m_object_mod_time;
962 
963  /// DataBuffer containing the module image, if it was provided at
964  /// construction time. Otherwise the data will be retrieved by mapping
965  /// one of the FileSpec members above.
966  lldb::DataBufferSP m_data_sp;
967 
968  lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
969  ///parser for this module as it may or may
970  ///not be shared with the SymbolFile
971  llvm::Optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders
972  /// objects created for this
973  /// Module's functions
974  lldb::SymbolVendorUP
975  m_symfile_up; ///< A pointer to the symbol vendor for this module.
976  std::vector<lldb::SymbolVendorUP>
977  m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and
978  ///changes the symbol file,
979  ///< we need to keep all old symbol files around in case anyone has type
980  ///references to them
981  TypeSystemMap m_type_system_map; ///< A map of any type systems associated
982  ///with this module
983  /// Module specific source remappings for when you have debug info for a
984  /// module that doesn't match where the sources currently are.
987 
988  lldb::SectionListUP m_sections_up; ///< Unified section list for module that
989  /// is used by the ObjectFile and and
990  /// ObjectFile instances for the debug info
991 
992  std::atomic<bool> m_did_load_objfile{false};
993  std::atomic<bool> m_did_load_symfile{false};
994  std::atomic<bool> m_did_set_uuid{false};
995  mutable bool m_file_has_changed : 1,
996  m_first_file_changed_log : 1; /// See if the module was modified after it
997  /// was initially opened.
998 
999  /// Resolve a file or load virtual address.
1000  ///
1001  /// Tries to resolve \a vm_addr as a file address (if \a
1002  /// vm_addr_is_file_addr is true) or as a load address if \a
1003  /// vm_addr_is_file_addr is false) in the symbol vendor. \a resolve_scope
1004  /// indicates what clients wish to resolve and can be used to limit the
1005  /// scope of what is parsed.
1006  ///
1007  /// \param[in] vm_addr
1008  /// The load virtual address to resolve.
1009  ///
1010  /// \param[in] vm_addr_is_file_addr
1011  /// If \b true, \a vm_addr is a file address, else \a vm_addr
1012  /// if a load address.
1013  ///
1014  /// \param[in] resolve_scope
1015  /// The scope that should be resolved (see
1016  /// SymbolContext::Scope).
1017  ///
1018  /// \param[out] so_addr
1019  /// The section offset based address that got resolved if
1020  /// any bits are returned.
1021  ///
1022  /// \param[out] sc
1023  // The symbol context that has objects filled in. Each bit
1024  /// in the \a resolve_scope pertains to a member in the \a sc.
1025  ///
1026  /// \return
1027  /// A integer that contains SymbolContext::Scope bits set for
1028  /// each item that was successfully resolved.
1029  ///
1030  /// \see SymbolContext::Scope
1032  bool vm_addr_is_file_addr,
1033  lldb::SymbolContextItem resolve_scope,
1034  Address &so_addr, SymbolContext &sc);
1035 
1037  std::vector<uint32_t> &symbol_indexes,
1038  SymbolContextList &sc_list);
1039 
1040  bool SetArchitecture(const ArchSpec &new_arch);
1041 
1042  void SetUUID(const lldb_private::UUID &uuid);
1043 
1045 
1046  friend class ModuleList;
1047  friend class ObjectFile;
1048  friend class SymbolFile;
1049 
1050 private:
1051  Module(); // Only used internally by CreateJITModule ()
1052 
1053  void FindTypes_Impl(
1054  ConstString name, const CompilerDeclContext &parent_decl_ctx,
1055  size_t max_matches,
1056  llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
1057  TypeMap &types);
1058 
1059  Module(const Module &) = delete;
1060  const Module &operator=(const Module &) = delete;
1061 };
1062 
1063 } // namespace lldb_private
1064 
1065 #endif // LLDB_CORE_MODULE_H
lldb_private::Module::SymbolIndicesToSymbolContextList
void SymbolIndicesToSymbolContextList(Symtab *symtab, std::vector< uint32_t > &symbol_indexes, SymbolContextList &sc_list)
Definition: Module.cpp:1317
lldb_private::UUID
Definition: UUID.h:23
lldb_private::Module::GetObjectFile
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
Definition: Module.cpp:1238
lldb_private::SymbolFile
Definition: SymbolFile.h:37
lldb_private::ModuleList::GetGlobalModuleListProperties
static ModuleListProperties & GetGlobalModuleListProperties()
Definition: ModuleList.cpp:723
lldb_private::Module::GetSourceMappingList
PathMappingList & GetSourceMappingList()
Definition: Module.h:829
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb_private::Module::CalculateSymbolContext
void CalculateSymbolContext(SymbolContext *sc) override
Reconstruct the object's symbol context into sc.
Definition: Module.cpp:408
lldb_private::Module::m_file_has_changed
bool m_file_has_changed
Definition: Module.h:995
lldb_private::Module::FileHasChanged
void void void void void bool FileHasChanged() const
Definition: Module.cpp:1121
lldb_private::Module::FindFunctions
void FindFunctions(ConstString name, const CompilerDeclContext &parent_decl_ctx, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list)
Find functions by name.
lldb_private::ModuleListProperties::GetSymlinkMappings
PathMappingList GetSymlinkMappings() const
Definition: ModuleList.cpp:130
lldb_private::Module::m_symfile_up
lldb::SymbolVendorUP m_symfile_up
A pointer to the symbol vendor for this module.
Definition: Module.h:975
ModuleSpec.h
lldb_private::Module::LookupInfo::LookupInfo
LookupInfo()
Definition: Module.h:896
lldb_private::Module::GetIsDynamicLinkEditor
bool GetIsDynamicLinkEditor()
Definition: Module.cpp:1654
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::Module::m_unwind_table
llvm::Optional< UnwindTable > m_unwind_table
Table of FuncUnwinders objects created for this Module's functions.
Definition: Module.h:971
UUID.h
lldb_private::Module::GetTypeSystemForLanguage
llvm::Expected< TypeSystem & > GetTypeSystemForLanguage(lldb::LanguageType language)
Definition: Module.cpp:371
lldb-defines.h
lldb_private::Module::GetSymtab
Symtab * GetSymtab()
Definition: Module.cpp:1051
lldb_private::Module::GetSymbolFileFileSpec
const FileSpec & GetSymbolFileFileSpec() const
Definition: Module.h:506
lldb_private::Module::ParseAllDebugSymbols
void ParseAllDebugSymbols()
A debugging function that will cause everything in a module to be parsed.
Definition: Module.cpp:375
lldb_private::Module::m_platform_file
FileSpec m_platform_file
The path to the module on the platform on which it is being debugged.
Definition: Module.h:949
lldb_private::Module::m_objfile_sp
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 Sy...
Definition: Module.h:968
lldb_private::Module::FindGlobalVariables
void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, VariableList &variable_list)
Find global and static variables by name.
Definition: Module.cpp:608
lldb_private::Module::LookupInfo::m_name
ConstString m_name
What the user originally typed.
Definition: Module.h:919
lldb_private::Module::LookupInfo::SetName
void SetName(ConstString name)
Definition: Module.h:903
lldb_private::Module::MergeArchitecture
bool MergeArchitecture(const ArchSpec &arch_spec)
Update the ArchSpec to a more specific variant.
Definition: Module.cpp:1628
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::Module::GetSymbolFile
virtual SymbolFile * GetSymbolFile(bool can_create=true, Stream *feedback_strm=nullptr)
Get the module's symbol file.
Definition: Module.cpp:1035
lldb_private::Module
Definition: Module.h:84
lldb_private::UnwindTable
Definition: UnwindTable.h:23
lldb_private::Module::FindTypes_Impl
void FindTypes_Impl(ConstString name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, TypeMap &types)
Definition: Module.cpp:938
lldb_private::SectionList
Definition: Section.h:34
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Args
Definition: Args.h:33
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::ModuleFunctionSearchOptions::include_symbols
bool include_symbols
Include the symbol table.
Definition: Module.h:64
lldb_private::Module::RegisterXcodeSDK
void RegisterXcodeSDK(llvm::StringRef sdk, llvm::StringRef sysroot)
This callback will be called by SymbolFile implementations when parsing a compile unit that contains ...
Definition: Module.cpp:1615
lldb_private::Module::SetPlatformFileSpec
void SetPlatformFileSpec(const FileSpec &file)
Definition: Module.h:496
lldb_private::Module::FindFirstType
lldb::TypeSP FindFirstType(const SymbolContext &sc, ConstString type_name, bool exact_match)
Definition: Module.cpp:963
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:454
lldb_private::Module::~Module
~Module() override
Destructor.
Definition: Module.cpp:266
lldb_private::Module::CalculateSymbolContextModule
lldb::ModuleSP CalculateSymbolContextModule() override
Definition: Module.cpp:412
lldb_private::Module::SetFileSpecAndObjectName
void SetFileSpecAndObjectName(const FileSpec &file, ConstString object_name)
Definition: Module.cpp:1057
lldb_private::Module::ResolveSymbolContextForFilePath
uint32_t ResolveSymbolContextForFilePath(const char *file_path, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
Resolve items in the symbol context for a given file and line.
Definition: Module.cpp:578
lldb_private::Module::ReportError
void void void void ReportError(const char *format,...) __attribute__((format(printf
Definition: Module.cpp:1100
lldb_private::VariableList
Definition: VariableList.h:18
XcodeSDK.h
lldb_private::Module::ReportErrorIfModifyDetected
void void void void void ReportErrorIfModifyDetected(const char *format,...) __attribute__((format(printf
Definition: Module.cpp:1132
lldb_private::Module::LookupInfo::SetNameTypeMask
void SetNameTypeMask(lldb::FunctionNameType mask)
Definition: Module.h:911
lldb_private::Module::GetAllocatedModuleAtIndex
static Module * GetAllocatedModuleAtIndex(size_t idx)
Definition: Module.cpp:118
lldb_private::Module::LookupInfo::m_language
lldb::LanguageType m_language
Limit matches to only be for this language.
Definition: Module.h:925
lldb_private::ModuleFunctionSearchOptions::include_inlines
bool include_inlines
Include inlined functions.
Definition: Module.h:66
lldb_private::Module::FindTypesInNamespace
void FindTypesInNamespace(ConstString type_name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, TypeList &type_list)
Find types by name that are in a namespace.
Definition: Module.cpp:949
lldb_private::Module::SetRemoteInstallFileSpec
void SetRemoteInstallFileSpec(const FileSpec &file)
Definition: Module.h:502
lldb_private::Module::GetPlatformFileSpec
const FileSpec & GetPlatformFileSpec() const
Get accessor for the module platform file specification.
Definition: Module.h:490
lldb_private::Module::m_did_load_symfile
std::atomic< bool > m_did_load_symfile
Definition: Module.h:993
lldb_private::Module::SetSymbolFileFileSpec
void SetSymbolFileFileSpec(const FileSpec &file)
Definition: Module.cpp:1390
lldb_private::Module::GetFileSpec
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition: Module.h:476
lldb_private::Module::LookupInfo
Definition: Module.h:894
lldb_private::Module::m_sections_up
lldb::SectionListUP m_sections_up
Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the d...
Definition: Module.h:988
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::Module::LogMessageVerboseBacktrace
void void LogMessageVerboseBacktrace(Log *log, const char *format,...) __attribute__((format(printf
Definition: Module.cpp:1196
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb::eSymbolTypeAny
@ eSymbolTypeAny
Definition: lldb-enumerations.h:613
lldb_private::Function
Definition: Function.h:413
ModuleList.h
lldb_private::Module::GetDescription
void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)
Definition: Module.cpp:1078
lldb_private::ModuleList
Definition: ModuleList.h:72
lldb_private::Module::m_uuid
UUID m_uuid
Each module is assumed to have a unique identifier to help match it up to debug symbols.
Definition: Module.h:945
lldb_private::Module::m_object_name
ConstString m_object_name
The name an object within this module that is selected, or empty of the module is represented by m_fi...
Definition: Module.h:957
lldb_private::Module::m_object_mod_time
llvm::sys::TimePoint m_object_mod_time
Definition: Module.h:961
lldb_private::Module::LookupInfo::m_name_type_mask
lldb::FunctionNameType m_name_type_mask
One or more bits from lldb::FunctionNameType that indicate what kind of names we are looking for.
Definition: Module.h:929
lldb_private::Module::LookupInfo::GetName
ConstString GetName() const
Definition: Module.h:901
lldb_private::Module::GetObjectOffset
uint64_t GetObjectOffset() const
Definition: Module.h:557
lldb_private::Module::ResolveSymbolContextsForFileSpec
uint32_t ResolveSymbolContextsForFileSpec(const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
Resolve items in the symbol context for a given file and line.
Definition: Module.cpp:586
lldb_private::TypeSystemMap
Definition: TypeSystem.h:501
lldb_private::NameMatch::RegularExpression
@ RegularExpression
lldb_private::Module::GetUnifiedSectionList
SectionList * GetUnifiedSectionList()
Definition: Module.cpp:1301
lldb_private::Module::ResolveFileAddress
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr)
Definition: Module.cpp:439
SymbolContextScope.h
lldb_private::Module::GetVersion
llvm::VersionTuple GetVersion()
Definition: Module.cpp:1648
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::Module::SectionFileAddressesChanged
virtual void SectionFileAddressesChanged()
Notify the module that the file addresses for the Sections have been updated.
Definition: Module.cpp:1287
lldb_private::Module::LoadScriptingResourceInTarget
bool LoadScriptingResourceInTarget(Target *target, Status &error, Stream *feedback_stream=nullptr)
Definition: Module.cpp:1480
lldb_private::Module::LogMessage
void LogMessage(Log *log, const char *format,...) __attribute__((format(printf
Definition: Module.cpp:1183
lldb::eDescriptionLevelFull
@ eDescriptionLevelFull
Definition: lldb-enumerations.h:209
lldb-enumerations.h
lldb_private::Module::LookupInfo::SetLookupName
void SetLookupName(ConstString name)
Definition: Module.h:907
lldb_private::Module::GetMemoryObjectFile
ObjectFile * GetMemoryObjectFile(const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, Status &error, size_t size_to_read=512)
Load an object file from memory.
Definition: Module.cpp:298
lldb_private::Module::GetObjectName
ConstString GetObjectName() const
Definition: Module.cpp:1236
lldb_private::Module::SetLoadAddress
bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset, bool &changed)
Set the load address for all sections in a module to be the file address plus slide.
Definition: Module.cpp:1555
lldb_private::Module::m_remote_install_file
FileSpec m_remote_install_file
If set when debugging on remote platforms, this module will be installed at this location.
Definition: Module.h:951
lldb_private::Module::ReportWarning
void void void ReportWarning(const char *format,...) __attribute__((format(printf
Definition: Module.cpp:1161
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:39
lldb_private::Module::m_data_sp
lldb::DataBufferSP m_data_sp
DataBuffer containing the module image, if it was provided at construction time.
Definition: Module.h:966
lldb_private::Module::m_first_file_changed_log
bool m_first_file_changed_log
Definition: Module.h:996
lldb_private::Module::GetMutex
std::recursive_mutex & GetMutex() const
Definition: Module.h:827
TypeSystem.h
lldb_private::Module::GetUnwindTable
UnwindTable & GetUnwindTable()
Returns a reference to the UnwindTable for this Module.
Definition: Module.cpp:1295
lldb::SymbolType
SymbolType
Symbol types.
Definition: lldb-enumerations.h:612
lldb_private::Module::m_mod_time
llvm::sys::TimePoint m_mod_time
The modification time for this module when it was created.
Definition: Module.h:942
Address.h
lldb_private::TypeMap
Definition: TypeMap.h:20
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
lldb_private::Module::FindCompileUnits
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list)
Find compile units by partial or full path.
Definition: Module.cpp:622
lldb_private::Module::GetNumCompileUnits
size_t GetNumCompileUnits()
Get the number of compile units for this module.
Definition: Module.cpp:418
lldb_private::SymbolContextScope
Definition: SymbolContextScope.h:64
ObjectFile.h
lldb_private::ModuleFunctionSearchOptions
Options used by Module::FindFunctions.
Definition: Module.h:62
lldb_private::Module::GetSourceMappingList
const PathMappingList & GetSourceMappingList() const
Definition: Module.h:831
lldb_private::Module::m_old_symfiles
std::vector< lldb::SymbolVendorUP > m_old_symfiles
If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,.
Definition: Module.h:977
lldb_private::Module::m_symfile_spec
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.
Definition: Module.h:954
lldb_private::Module::GetRemoteInstallFileSpec
const FileSpec & GetRemoteInstallFileSpec() const
Definition: Module.h:498
lldb-types.h
lldb_private::Module::GetSectionList
virtual SectionList * GetSectionList()
Get the unified section list for the module.
Definition: Module.cpp:1277
lldb_private::Module::SetArchitecture
bool SetArchitecture(const ArchSpec &new_arch)
Definition: Module.cpp:1547
lldb_private::Module::operator=
const Module & operator=(const Module &)=delete
lldb_private::ModuleSpec
Definition: ModuleSpec.h:26
lldb_private::Status
Definition: Status.h:44
lldb_private::Module::LookupInfo::GetLookupName
ConstString GetLookupName() const
Definition: Module.h:905
lldb_private::Module::GetSpecificationDescription
std::string GetSpecificationDescription() const
Get the module path and object name.
Definition: Module.cpp:1068
lldb_private::Module::LookupInfo::m_lookup_name
ConstString m_lookup_name
The actual name will lookup when calling in the object or symbol file.
Definition: Module.h:922
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:437
lldb_private::Symtab
Definition: Symtab.h:22
uint32_t
lldb_private::PathMappingList
Definition: PathMappingList.h:19
lldb_private::Address
Definition: Address.h:59
lldb_private::Module::DumpSymbolContext
void DumpSymbolContext(Stream *s) override
Dump the object's symbol context to the stream s.
Definition: Module.cpp:414
lldb_private::Module::LookupInfo::GetNameTypeMask
lldb::FunctionNameType GetNameTypeMask() const
Definition: Module.h:909
lldb_private::Module::PreloadSymbols
void PreloadSymbols()
Definition: Module.cpp:1376
lldb_private::Module::FindSymbolsMatchingRegExAndType
void FindSymbolsMatchingRegExAndType(const RegularExpression &regex, lldb::SymbolType symbol_type, SymbolContextList &sc_list)
Definition: Module.cpp:1359
lldb_private::Module::ResolveSymbolContextForAddress
uint32_t ResolveSymbolContextForAddress(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc, bool resolve_tail_call_address=false)
Resolve the symbol context for the given address.
Definition: Module.cpp:447
ArchSpec.h
lldb_private::Module::m_object_offset
uint64_t m_object_offset
Definition: Module.h:960
lldb_private::Module::SetUUID
void SetUUID(const lldb_private::UUID &uuid)
Definition: Module.cpp:360
lldb_private::Module::FindSourceFile
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const
Finds a source file given a file spec using the module source path remappings (if any).
Definition: Module.cpp:1598
lldb_private::Module::MatchesModuleSpec
bool MatchesModuleSpec(const ModuleSpec &module_ref)
Definition: Module.cpp:1567
lldb_private::Module::m_arch
ArchSpec m_arch
The architecture for this module.
Definition: Module.h:944
lldb_private::Module::LookupInfo::m_match_name_after_lookup
bool m_match_name_after_lookup
Definition: Module.h:933
lldb_private::Module::FindAddressesForLine
void FindAddressesForLine(const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, Function *function, std::vector< Address > &output_local, std::vector< Address > &output_extern)
Find addresses by file/line.
Definition: Module.cpp:914
lldb_private::Module::m_type_system_map
TypeSystemMap m_type_system_map
A map of any type systems associated with this module.
Definition: Module.h:981
lldb_private::Module::IsLoadedInTarget
bool IsLoadedInTarget(Target *target)
Tells whether this module has been loaded in the target passed in.
Definition: Module.cpp:1463
lldb-forward.h
lldb_private::Module::FindTypes
void FindTypes(ConstString type_name, bool exact_match, size_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, TypeList &types)
Find types by name.
Definition: Module.cpp:973
Status.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Module::GetNumberAllocatedModules
static size_t GetNumberAllocatedModules()
Definition: Module.cpp:112
lldb_private::Module::RemapSourceFile
llvm::Optional< std::string > RemapSourceFile(llvm::StringRef path) const
Remaps a source file given path into new_path.
Definition: Module.cpp:1608
lldb_private::TypeList
Definition: TypeList.h:20
FileSpec.h
lldb_private::Module::GetObjectModificationTime
const llvm::sys::TimePoint & GetObjectModificationTime() const
Definition: Module.h:516
ConstString.h
lldb_private::LanguageSet
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: TypeSystem.h:40
lldb_private::Module::FindSymbolsWithNameAndType
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list)
Definition: Module.cpp:1344
lldb_private::Module::LookupInfo::Prune
void Prune(SymbolContextList &sc_list, size_t start_idx) const
Definition: Module.cpp:736
lldb_private::Module::FindFirstSymbolWithNameAndType
const Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type=lldb::eSymbolTypeAny)
Find a symbol in the object file's symbol table.
Definition: Module.cpp:1307
lldb_private::Log
Definition: Log.h:49
lldb_private::Module::m_source_mappings
PathMappingList m_source_mappings
Module specific source remappings for when you have debug info for a module that doesn't match where ...
Definition: Module.h:985
lldb_private::Module::GetArchitecture
const ArchSpec & GetArchitecture() const
Get const accessor for the module architecture.
Definition: Module.cpp:1066
lldb_private::Module::GetUUID
const lldb_private::UUID & GetUUID()
Get a reference to the UUID value contained in this object.
Definition: Module.cpp:345
lldb_private::Module::Dump
void Dump(Stream *s)
Dump a description of this object to a Stream.
Definition: Module.cpp:1215
lldb_private::Module::FindFunctionSymbols
void FindFunctionSymbols(ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list)
Find a function symbols in the object file's symbol table.
Definition: Module.cpp:1335
PathMappingList.h
lldb_private::Module::m_mutex
std::recursive_mutex m_mutex
A mutex to keep this object happy in multi-threaded environments.
Definition: Module.h:938
lldb_private::Module::CreateModuleFromObjectFile
static lldb::ModuleSP CreateModuleFromObjectFile(Args &&... args)
Definition: Module.h:130
lldb_private::Module::GetAllocationModuleCollectionMutex
static std::recursive_mutex & GetAllocationModuleCollectionMutex()
Definition: Module.cpp:100
lldb_private::Module::IsExecutable
bool IsExecutable()
Tells whether this module is capable of being the main executable for a process.
Definition: Module.cpp:1456
lldb_private::Module::GetModificationTime
const llvm::sys::TimePoint & GetModificationTime() const
Definition: Module.h:512
lldb_private::ObjectFile
Definition: ObjectFile.h:58
lldb_private::CompilerContextKind::Function
@ Function
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::Module::Module
Module()
Definition: Module.cpp:260
lldb_private::Module::GetCompileUnitAtIndex
lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx)
Definition: Module.cpp:427
lldb_private::Module::m_file
FileSpec m_file
The file representation on disk for this module (if there is one).
Definition: Module.h:947
lldb_private::Module::m_did_set_uuid
std::atomic< bool > m_did_set_uuid
Definition: Module.h:994
lldb_private::Module::m_did_load_objfile
std::atomic< bool > m_did_load_objfile
Definition: Module.h:992