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