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