LLDB  mainline
SymbolFile.h
Go to the documentation of this file.
1 //===-- SymbolFile.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_SYMBOL_SYMBOLFILE_H
10 #define LLDB_SYMBOL_SYMBOLFILE_H
11 
12 #include "lldb/Core/Module.h"
13 #include "lldb/Core/ModuleList.h"
19 #include "lldb/Symbol/Function.h"
21 #include "lldb/Symbol/Type.h"
22 #include "lldb/Symbol/TypeList.h"
23 #include "lldb/Symbol/TypeSystem.h"
24 #include "lldb/Target/Statistics.h"
25 #include "lldb/Utility/XcodeSDK.h"
26 #include "lldb/lldb-private.h"
27 #include "llvm/ADT/DenseSet.h"
28 #include "llvm/Support/Errc.h"
29 
30 #include <mutex>
31 #include <optional>
32 
33 #if defined(LLDB_CONFIGURATION_DEBUG)
34 #define ASSERT_MODULE_LOCK(expr) (expr->AssertModuleLock())
35 #else
36 #define ASSERT_MODULE_LOCK(expr) ((void)0)
37 #endif
38 
39 namespace lldb_private {
40 
41 /// Provides public interface for all SymbolFiles. Any protected
42 /// virtual members should go into SymbolFileCommon; most SymbolFile
43 /// implementations should inherit from SymbolFileCommon to override
44 /// the behaviors except SymbolFileOnDemand which inherits
45 /// public interfaces from SymbolFile and forward to underlying concrete
46 /// SymbolFile implementation.
47 class SymbolFile : public PluginInterface {
48  /// LLVM RTTI support.
49  static char ID;
50 
51 public:
52  /// LLVM RTTI support.
53  /// \{
54  virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
55  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
56  /// \}
57 
58  // Symbol file ability bits.
59  //
60  // Each symbol file can claim to support one or more symbol file abilities.
61  // These get returned from SymbolFile::GetAbilities(). These help us to
62  // determine which plug-in will be best to load the debug information found
63  // in files.
64  enum Abilities {
65  CompileUnits = (1u << 0),
66  LineTables = (1u << 1),
67  Functions = (1u << 2),
68  Blocks = (1u << 3),
69  GlobalVariables = (1u << 4),
70  LocalVariables = (1u << 5),
71  VariableTypes = (1u << 6),
72  kAllAbilities = ((1u << 7) - 1u)
73  };
74 
75  static SymbolFile *FindPlugin(lldb::ObjectFileSP objfile_sp);
76 
77  // Constructors and Destructors
78  SymbolFile() = default;
79 
80  ~SymbolFile() override = default;
81 
82  /// SymbolFileOnDemand class overrides this to return the underlying
83  /// backing SymbolFile implementation that loads on-demand.
84  virtual SymbolFile *GetBackingSymbolFile() { return this; }
85 
86  /// Get a mask of what this symbol file supports for the object file
87  /// that it was constructed with.
88  ///
89  /// Each symbol file gets to respond with a mask of abilities that
90  /// it supports for each object file. This happens when we are
91  /// trying to figure out which symbol file plug-in will get used
92  /// for a given object file. The plug-in that responds with the
93  /// best mix of "SymbolFile::Abilities" bits set, will get chosen to
94  /// be the symbol file parser. This allows each plug-in to check for
95  /// sections that contain data a symbol file plug-in would need. For
96  /// example the DWARF plug-in requires DWARF sections in a file that
97  /// contain debug information. If the DWARF plug-in doesn't find
98  /// these sections, it won't respond with many ability bits set, and
99  /// we will probably fall back to the symbol table SymbolFile plug-in
100  /// which uses any information in the symbol table. Also, plug-ins
101  /// might check for some specific symbols in a symbol table in the
102  /// case where the symbol table contains debug information (STABS
103  /// and COFF). Not a lot of work should happen in these functions
104  /// as the plug-in might not get selected due to another plug-in
105  /// having more abilities. Any initialization work should be saved
106  /// for "void SymbolFile::InitializeObject()" which will get called
107  /// on the SymbolFile object with the best set of abilities.
108  ///
109  /// \return
110  /// A uint32_t mask containing bits from the SymbolFile::Abilities
111  /// enumeration. Any bits that are set represent an ability that
112  /// this symbol plug-in can parse from the object file.
113  virtual uint32_t GetAbilities() = 0;
114  virtual uint32_t CalculateAbilities() = 0;
115 
116  /// Symbols file subclasses should override this to return the Module that
117  /// owns the TypeSystem that this symbol file modifies type information in.
118  virtual std::recursive_mutex &GetModuleMutex() const;
119 
120  /// Initialize the SymbolFile object.
121  ///
122  /// The SymbolFile object with the best set of abilities (detected
123  /// in "uint32_t SymbolFile::GetAbilities()) will have this function
124  /// called if it is chosen to parse an object file. More complete
125  /// initialization can happen in this function which will get called
126  /// prior to any other functions in the SymbolFile protocol.
127  virtual void InitializeObject() {}
128 
129  /// Whether debug info will be loaded or not.
130  ///
131  /// It will be true for most implementations except SymbolFileOnDemand.
132  virtual bool GetLoadDebugInfoEnabled() { return true; }
133 
134  /// Specify debug info should be loaded.
135  ///
136  /// It will be no-op for most implementations except SymbolFileOnDemand.
137  virtual void SetLoadDebugInfoEnabled() {}
138 
139  // Compile Unit function calls
140  // Approach 1 - iterator
141  virtual uint32_t GetNumCompileUnits() = 0;
142  virtual lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx) = 0;
143 
144  virtual Symtab *GetSymtab() = 0;
145 
146  virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
147  /// Return the Xcode SDK comp_unit was compiled against.
148  virtual XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) { return {}; }
149  virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
150  virtual bool ParseLineTable(CompileUnit &comp_unit) = 0;
151  virtual bool ParseDebugMacros(CompileUnit &comp_unit) = 0;
152 
153  /// Apply a lambda to each external lldb::Module referenced by this
154  /// \p comp_unit. Recursively also descends into the referenced external
155  /// modules of any encountered compilation unit.
156  ///
157  /// This function can be used to traverse Clang -gmodules debug
158  /// information, which is stored in DWARF files separate from the
159  /// object files.
160  ///
161  /// \param comp_unit
162  /// When this SymbolFile consists of multiple auxilliary
163  /// SymbolFiles, for example, a Darwin debug map that references
164  /// multiple .o files, comp_unit helps choose the auxilliary
165  /// file. In most other cases comp_unit's symbol file is
166  /// identical with *this.
167  ///
168  /// \param[in] lambda
169  /// The lambda that should be applied to every function. The lambda can
170  /// return true if the iteration should be aborted earlier.
171  ///
172  /// \param visited_symbol_files
173  /// A set of SymbolFiles that were already visited to avoid
174  /// visiting one file more than once.
175  ///
176  /// \return
177  /// If the lambda early-exited, this function returns true to
178  /// propagate the early exit.
179  virtual bool ForEachExternalModule(
180  lldb_private::CompileUnit &comp_unit,
181  llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
182  llvm::function_ref<bool(Module &)> lambda) {
183  return false;
184  }
185  virtual bool ParseSupportFiles(CompileUnit &comp_unit,
186  FileSpecList &support_files) = 0;
187  virtual size_t ParseTypes(CompileUnit &comp_unit) = 0;
188  virtual bool ParseIsOptimized(CompileUnit &comp_unit) { return false; }
189 
190  virtual bool
192  std::vector<SourceModule> &imported_modules) = 0;
193  virtual size_t ParseBlocksRecursive(Function &func) = 0;
194  virtual size_t ParseVariablesForContext(const SymbolContext &sc) = 0;
195  virtual Type *ResolveTypeUID(lldb::user_id_t type_uid) = 0;
196 
197  /// The characteristics of an array type.
198  struct ArrayInfo {
199  int64_t first_index = 0;
200  llvm::SmallVector<uint64_t, 1> element_orders;
203  };
204  /// If \c type_uid points to an array type, return its characteristics.
205  /// To support variable-length array types, this function takes an
206  /// optional \p ExecutionContext. If \c exe_ctx is non-null, the
207  /// dynamic characteristics for that context are returned.
208  virtual std::optional<ArrayInfo>
210  const lldb_private::ExecutionContext *exe_ctx) = 0;
211 
212  virtual bool CompleteType(CompilerType &compiler_type) = 0;
213  virtual void ParseDeclsForContext(CompilerDeclContext decl_ctx) {}
215  return CompilerDecl();
216  }
218  return CompilerDeclContext();
219  }
221  return CompilerDeclContext();
222  }
223  virtual uint32_t ResolveSymbolContext(const Address &so_addr,
224  lldb::SymbolContextItem resolve_scope,
225  SymbolContext &sc) = 0;
226 
227  /// Get an error that describes why variables might be missing for a given
228  /// symbol context.
229  ///
230  /// If there is an error in the debug information that prevents variables from
231  /// being fetched, this error will get filled in. If there is no debug
232  /// informaiton, no error should be returned. But if there is debug
233  /// information and something prevents the variables from being available a
234  /// valid error should be returned. Valid cases include:
235  /// - compiler option that removes variables (-gline-tables-only)
236  /// - missing external files
237  /// - .dwo files in fission are not accessible or missing
238  /// - .o files on darwin when not using dSYM files that are not accessible
239  /// or missing
240  /// - mismatched exteral files
241  /// - .dwo files in fission where the DWO ID doesn't match
242  /// - .o files on darwin when modification timestamp doesn't match
243  /// - corrupted debug info
244  ///
245  /// \param[in] frame
246  /// The stack frame to use as a basis for the context to check. The frame
247  /// address can be used if there is not debug info due to it not being able
248  /// to be loaded, or if there is a debug info context, like a compile unit,
249  /// or function, it can be used to track down more information on why
250  /// variables are missing.
251  ///
252  /// \returns
253  /// An error specifying why there should have been debug info with variable
254  /// information but the variables were not able to be resolved.
256  Status err = CalculateFrameVariableError(frame);
257  if (err.Fail())
259  return err;
260  }
261 
262  /// Subclasses will override this function to for GetFrameVariableError().
263  ///
264  /// This allows GetFrameVariableError() to set the member variable
265  /// m_debug_info_had_variable_errors correctly without users having to do it
266  /// manually which is error prone.
268  return Status();
269  }
270  virtual uint32_t
271  ResolveSymbolContext(const SourceLocationSpec &src_location_spec,
272  lldb::SymbolContextItem resolve_scope,
273  SymbolContextList &sc_list);
274 
275  virtual void DumpClangAST(Stream &s) {}
276  virtual void FindGlobalVariables(ConstString name,
277  const CompilerDeclContext &parent_decl_ctx,
278  uint32_t max_matches,
279  VariableList &variables);
280  virtual void FindGlobalVariables(const RegularExpression &regex,
281  uint32_t max_matches,
282  VariableList &variables);
283  virtual void FindFunctions(const Module::LookupInfo &lookup_info,
284  const CompilerDeclContext &parent_decl_ctx,
285  bool include_inlines, SymbolContextList &sc_list);
286  virtual void FindFunctions(const RegularExpression &regex,
287  bool include_inlines, SymbolContextList &sc_list);
288  virtual void
289  FindTypes(ConstString name, const CompilerDeclContext &parent_decl_ctx,
290  uint32_t max_matches,
291  llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
292  TypeMap &types);
293 
294  /// Find types specified by a CompilerContextPattern.
295  /// \param languages
296  /// Only return results in these languages.
297  /// \param searched_symbol_files
298  /// Prevents one file from being visited multiple times.
299  virtual void
300  FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
301  llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
302  TypeMap &types);
303 
304  virtual void
305  GetMangledNamesForFunction(const std::string &scope_qualified_name,
306  std::vector<ConstString> &mangled_names);
307 
308  virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
309  lldb::TypeClass type_mask,
310  lldb_private::TypeList &type_list) = 0;
311 
312  virtual void PreloadSymbols();
313 
314  virtual llvm::Expected<lldb::TypeSystemSP>
316 
317  virtual CompilerDeclContext
318  FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx) {
319  return CompilerDeclContext();
320  }
321 
322  virtual ObjectFile *GetObjectFile() = 0;
323  virtual const ObjectFile *GetObjectFile() const = 0;
324  virtual ObjectFile *GetMainObjectFile() = 0;
325 
326  virtual std::vector<std::unique_ptr<CallEdge>>
328  return {};
329  }
330 
331  virtual void AddSymbols(Symtab &symtab) {}
332 
333  /// Notify the SymbolFile that the file addresses in the Sections
334  /// for this module have been changed.
335  virtual void SectionFileAddressesChanged() = 0;
336 
338  virtual ~RegisterInfoResolver(); // anchor
339 
340  virtual const RegisterInfo *ResolveName(llvm::StringRef name) const = 0;
341  virtual const RegisterInfo *ResolveNumber(lldb::RegisterKind kind,
342  uint32_t number) const = 0;
343  };
344  virtual lldb::UnwindPlanSP
345  GetUnwindPlan(const Address &address, const RegisterInfoResolver &resolver) {
346  return nullptr;
347  }
348 
349  /// Return the number of stack bytes taken up by the parameters to this
350  /// function.
351  virtual llvm::Expected<lldb::addr_t> GetParameterStackSize(Symbol &symbol) {
352  return llvm::createStringError(make_error_code(llvm::errc::not_supported),
353  "Operation not supported.");
354  }
355 
356  virtual void Dump(Stream &s) = 0;
357 
358  /// Metrics gathering functions
359 
360  /// Return the size in bytes of all debug information in the symbol file.
361  ///
362  /// If the debug information is contained in sections of an ObjectFile, then
363  /// this call should add the size of all sections that contain debug
364  /// information. Symbols the symbol tables are not considered debug
365  /// information for this call to make it easy and quick for this number to be
366  /// calculated. If the symbol file is all debug information, the size of the
367  /// entire file should be returned. The default implementation of this
368  /// function will iterate over all sections in a module and add up their
369  /// debug info only section byte sizes.
370  virtual uint64_t GetDebugInfoSize() = 0;
371 
372  /// Return the time taken to parse the debug information.
373  ///
374  /// \returns 0.0 if no information has been parsed or if there is
375  /// no computational cost to parsing the debug information.
377 
378  /// Return the time it took to index the debug information in the object
379  /// file.
380  ///
381  /// \returns 0.0 if the file doesn't need to be indexed or if it
382  /// hasn't been indexed yet, or a valid duration if it has.
384 
385  /// Get the additional modules that this symbol file uses to parse debug info.
386  ///
387  /// Some debug info is stored in stand alone object files that are represented
388  /// by unique modules that will show up in the statistics module list. Return
389  /// a list of modules that are not in the target module list that this symbol
390  /// file is currently using so that they can be tracked and assoicated with
391  /// the module in the statistics.
392  virtual ModuleList GetDebugInfoModules() { return ModuleList(); }
393 
394  /// Accessors for the bool that indicates if the debug info index was loaded
395  /// from, or saved to the module index cache.
396  ///
397  /// In statistics it is handy to know if a module's debug info was loaded from
398  /// or saved to the cache. When the debug info index is loaded from the cache
399  /// startup times can be faster. When the cache is enabled and the debug info
400  /// index is saved to the cache, debug sessions can be slower. These accessors
401  /// can be accessed by the statistics and emitted to help track these costs.
402  /// \{
403  virtual bool GetDebugInfoIndexWasLoadedFromCache() const = 0;
404  virtual void SetDebugInfoIndexWasLoadedFromCache() = 0;
405  virtual bool GetDebugInfoIndexWasSavedToCache() const = 0;
406  virtual void SetDebugInfoIndexWasSavedToCache() = 0;
407  /// \}
408 
409  /// Accessors for the bool that indicates if there was debug info, but errors
410  /// stopped variables from being able to be displayed correctly. See
411  /// GetFrameVariableError() for details on what are considered errors.
412  virtual bool GetDebugInfoHadFrameVariableErrors() const = 0;
413  virtual void SetDebugInfoHadFrameVariableErrors() = 0;
414 
415  virtual lldb::TypeSP
417  std::optional<uint64_t> byte_size, SymbolContextScope *context,
418  lldb::user_id_t encoding_uid,
419  Type::EncodingDataType encoding_uid_type, const Declaration &decl,
420  const CompilerType &compiler_qual_type,
421  Type::ResolveState compiler_type_resolve_state,
422  uint32_t opaque_payload = 0) = 0;
423 
424  virtual lldb::TypeSP CopyType(const lldb::TypeSP &other_type) = 0;
425 
426 protected:
427  void AssertModuleLock();
428 
429 private:
430  SymbolFile(const SymbolFile &) = delete;
431  const SymbolFile &operator=(const SymbolFile &) = delete;
432 };
433 
434 /// Containing protected virtual methods for child classes to override.
435 /// Most actual SymbolFile implementations should inherit from this class.
436 class SymbolFileCommon : public SymbolFile {
437  /// LLVM RTTI support.
438  static char ID;
439 
440 public:
441  /// LLVM RTTI support.
442  /// \{
443  bool isA(const void *ClassID) const override {
444  return ClassID == &ID || SymbolFile::isA(ClassID);
445  }
446  static bool classof(const SymbolFileCommon *obj) { return obj->isA(&ID); }
447  /// \}
448 
449  // Constructors and Destructors
450  SymbolFileCommon(lldb::ObjectFileSP objfile_sp)
451  : m_objfile_sp(std::move(objfile_sp)) {}
452 
453  ~SymbolFileCommon() override = default;
454 
455  uint32_t GetAbilities() override {
456  if (!m_calculated_abilities) {
458  m_calculated_abilities = true;
459  }
460  return m_abilities;
461  }
462 
463  Symtab *GetSymtab() override;
464 
465  ObjectFile *GetObjectFile() override { return m_objfile_sp.get(); }
466  const ObjectFile *GetObjectFile() const override {
467  return m_objfile_sp.get();
468  }
469  ObjectFile *GetMainObjectFile() override;
470 
471  /// Notify the SymbolFile that the file addresses in the Sections
472  /// for this module have been changed.
473  void SectionFileAddressesChanged() override;
474 
475  // Compile Unit function calls
476  // Approach 1 - iterator
477  uint32_t GetNumCompileUnits() override;
478  lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx) override;
479 
480  llvm::Expected<lldb::TypeSystemSP>
481  GetTypeSystemForLanguage(lldb::LanguageType language) override;
482 
483  void Dump(Stream &s) override;
484 
485  uint64_t GetDebugInfoSize() override;
486 
487  bool GetDebugInfoIndexWasLoadedFromCache() const override {
489  }
492  }
493  bool GetDebugInfoIndexWasSavedToCache() const override {
495  }
498  }
499  bool GetDebugInfoHadFrameVariableErrors() const override {
501  }
504  }
505 
506  /// This function is used to create types that belong to a SymbolFile. The
507  /// symbol file will own a strong reference to the type in an internal type
508  /// list.
509  lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name,
510  std::optional<uint64_t> byte_size,
511  SymbolContextScope *context,
512  lldb::user_id_t encoding_uid,
513  Type::EncodingDataType encoding_uid_type,
514  const Declaration &decl,
515  const CompilerType &compiler_qual_type,
516  Type::ResolveState compiler_type_resolve_state,
517  uint32_t opaque_payload = 0) override {
518  lldb::TypeSP type_sp (new Type(
519  uid, this, name, byte_size, context, encoding_uid,
520  encoding_uid_type, decl, compiler_qual_type,
521  compiler_type_resolve_state, opaque_payload));
522  m_type_list.Insert(type_sp);
523  return type_sp;
524  }
525 
526  lldb::TypeSP CopyType(const lldb::TypeSP &other_type) override {
527  // Make sure the real symbol file matches when copying types.
528  if (GetBackingSymbolFile() != other_type->GetSymbolFile())
529  return lldb::TypeSP();
530  lldb::TypeSP type_sp(new Type(*other_type));
531  m_type_list.Insert(type_sp);
532  return type_sp;
533  }
534 
535 protected:
536  virtual uint32_t CalculateNumCompileUnits() = 0;
537  virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx) = 0;
538  virtual TypeList &GetTypeList() { return m_type_list; }
539  void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp);
540 
541  lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
542  // case it isn't the same as the module
543  // object file (debug symbols in a separate
544  // file)
545  std::optional<std::vector<lldb::CompUnitSP>> m_compile_units;
551  /// Set to true if any variable feteching errors have been found when calling
552  /// GetFrameVariableError(). This will be emitted in the "statistics dump"
553  /// information for a module.
555 
556 private:
557  SymbolFileCommon(const SymbolFileCommon &) = delete;
558  const SymbolFileCommon &operator=(const SymbolFileCommon &) = delete;
559 
560  /// Do not use m_symtab directly, as it may be freed. Use GetSymtab()
561  /// to access it instead.
562  Symtab *m_symtab = nullptr;
563 };
564 
565 } // namespace lldb_private
566 
567 #endif // LLDB_SYMBOL_SYMBOLFILE_H
lldb_private::SymbolFile::SetDebugInfoIndexWasSavedToCache
virtual void SetDebugInfoIndexWasSavedToCache()=0
lldb_private::SymbolFile::SymbolFile
SymbolFile()=default
lldb_private::SymbolFile::FindPlugin
static SymbolFile * FindPlugin(lldb::ObjectFileSP objfile_sp)
Definition: SymbolFile.cpp:39
lldb_private::SymbolFileCommon::SetDebugInfoIndexWasLoadedFromCache
void SetDebugInfoIndexWasLoadedFromCache() override
Definition: SymbolFile.h:490
lldb_private::SymbolFile
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:47
lldb_private::SymbolFile::GetDeclForUID
virtual CompilerDecl GetDeclForUID(lldb::user_id_t uid)
Definition: SymbolFile.h:214
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::SymbolFile::ParseCallEdgesInFunction
virtual std::vector< std::unique_ptr< CallEdge > > ParseCallEdgesInFunction(UserID func_id)
Definition: SymbolFile.h:327
lldb_private::SymbolFile::FindTypes
virtual void FindTypes(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, TypeMap &types)
Definition: SymbolFile.cpp:136
lldb_private::Type::EncodingDataType
EncodingDataType
Definition: Type.h:70
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb_private::SymbolFileCommon::GetSymtab
Symtab * GetSymtab() override
Definition: SymbolFile.cpp:165
lldb_private::SymbolFileCommon::classof
static bool classof(const SymbolFileCommon *obj)
Definition: SymbolFile.h:446
lldb_private::SymbolFile::CalculateFrameVariableError
virtual Status CalculateFrameVariableError(StackFrame &frame)
Subclasses will override this function to for GetFrameVariableError().
Definition: SymbolFile.h:267
lldb_private::SymbolFileCommon::m_type_list
TypeList m_type_list
Definition: SymbolFile.h:546
CompilerDecl.h
lldb_private::SymbolFile::GetDebugInfoIndexTime
virtual StatsDuration::Duration GetDebugInfoIndexTime()
Return the time it took to index the debug information in the object file.
Definition: SymbolFile.h:383
lldb_private::SymbolFileCommon::GetAbilities
uint32_t GetAbilities() override
Get a mask of what this symbol file supports for the object file that it was constructed with.
Definition: SymbolFile.h:455
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::SourceLocationSpec
Definition: SourceLocationSpec.h:27
lldb_private::SymbolFile::VariableTypes
@ VariableTypes
Definition: SymbolFile.h:71
lldb_private::SymbolFile::ParseDeclsForContext
virtual void ParseDeclsForContext(CompilerDeclContext decl_ctx)
Definition: SymbolFile.h:213
lldb_private::PluginInterface
Definition: PluginInterface.h:16
lldb_private::SymbolFileCommon::CalculateNumCompileUnits
virtual uint32_t CalculateNumCompileUnits()=0
lldb_private::UserID
Definition: UserID.h:31
lldb_private::SymbolFile::ArrayInfo::byte_stride
uint32_t byte_stride
Definition: SymbolFile.h:201
lldb_private::SymbolFile::GetMainObjectFile
virtual ObjectFile * GetMainObjectFile()=0
lldb_private::StatsDuration::Duration
std::chrono::duration< double > Duration
Definition: Statistics.h:31
lldb_private::SymbolFile::GetModuleMutex
virtual std::recursive_mutex & GetModuleMutex() const
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
Definition: SymbolFile.cpp:35
lldb_private::SymbolFile::GetAbilities
virtual uint32_t GetAbilities()=0
Get a mask of what this symbol file supports for the object file that it was constructed with.
lldb_private::SymbolFile::ParseFunctions
virtual size_t ParseFunctions(CompileUnit &comp_unit)=0
lldb_private::SymbolFile::ParseBlocksRecursive
virtual size_t ParseBlocksRecursive(Function &func)=0
Module.h
lldb_private::SymbolFile::GetTypeSystemForLanguage
virtual llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language)=0
lldb_private::SymbolFileCommon::m_index_was_loaded_from_cache
bool m_index_was_loaded_from_cache
Definition: SymbolFile.h:549
lldb_private::XcodeSDK
An abstraction for Xcode-style SDKs that works like ArchSpec.
Definition: XcodeSDK.h:24
lldb_private::SymbolFile::SectionFileAddressesChanged
virtual void SectionFileAddressesChanged()=0
Notify the SymbolFile that the file addresses in the Sections for this module have been changed.
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:443
lldb_private::SymbolFile::CalculateAbilities
virtual uint32_t CalculateAbilities()=0
lldb_private::SymbolFileCommon::m_compile_units
std::optional< std::vector< lldb::CompUnitSP > > m_compile_units
Definition: SymbolFile.h:545
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::CompilerDecl
Represents a generic declaration such as a function declaration.
Definition: CompilerDecl.h:28
lldb_private::Module
Definition: Module.h:87
lldb_private::SymbolFile::CompileUnits
@ CompileUnits
Definition: SymbolFile.h:65
lldb_private::Stream
Definition: Stream.h:28
lldb_private::SymbolFileCommon
Containing protected virtual methods for child classes to override.
Definition: SymbolFile.h:436
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::SymbolFile::ParseIsOptimized
virtual bool ParseIsOptimized(CompileUnit &comp_unit)
Definition: SymbolFile.h:188
lldb_private::SymbolFile::Abilities
Abilities
Definition: SymbolFile.h:64
lldb_private::SymbolFile::GetUnwindPlan
virtual lldb::UnwindPlanSP GetUnwindPlan(const Address &address, const RegisterInfoResolver &resolver)
Definition: SymbolFile.h:345
lldb_private::SymbolFile::Functions
@ Functions
Definition: SymbolFile.h:67
lldb_private::VariableList
Definition: VariableList.h:18
XcodeSDK.h
lldb_private::SymbolFileCommon::GetDebugInfoIndexWasSavedToCache
bool GetDebugInfoIndexWasSavedToCache() const override
Definition: SymbolFile.h:493
lldb_private::SymbolFileCommon::m_debug_info_had_variable_errors
bool m_debug_info_had_variable_errors
Set to true if any variable feteching errors have been found when calling GetFrameVariableError().
Definition: SymbolFile.h:554
lldb_private::SymbolFile::CopyType
virtual lldb::TypeSP CopyType(const lldb::TypeSP &other_type)=0
lldb_private::CompileUnit
Definition: CompileUnit.h:38
lldb_private::SymbolFile::FindFunctions
virtual void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list)
Definition: SymbolFile.cpp:123
lldb_private::Type::ResolveState
ResolveState
Definition: Type.h:98
lldb_private::Module::LookupInfo
Definition: Module.h:950
lldb_private::SymbolFileCommon::SectionFileAddressesChanged
void SectionFileAddressesChanged() override
Notify the SymbolFile that the file addresses in the Sections for this module have been changed.
Definition: SymbolFile.cpp:183
lldb_private::SymbolFileCommon::m_objfile_sp
lldb::ObjectFileSP m_objfile_sp
Definition: SymbolFile.h:541
lldb_private::Function
Definition: Function.h:409
lldb_private::SymbolFile::AssertModuleLock
void AssertModuleLock()
Definition: SymbolFile.cpp:147
ModuleList.h
lldb_private::SymbolFileCommon::GetTypeList
virtual TypeList & GetTypeList()
Definition: SymbolFile.h:538
lldb_private::SymbolFile::ResolveTypeUID
virtual Type * ResolveTypeUID(lldb::user_id_t type_uid)=0
lldb_private::ModuleList
Definition: ModuleList.h:82
SourceLocationSpec.h
lldb_private::SymbolFile::LocalVariables
@ LocalVariables
Definition: SymbolFile.h:70
lldb_private::TypeList::Insert
void Insert(const lldb::TypeSP &type)
Definition: TypeList.cpp:27
lldb_private::SymbolFileCommon::Dump
void Dump(Stream &s) override
Definition: SymbolFile.cpp:252
lldb_private::SymbolFile::ParseLineTable
virtual bool ParseLineTable(CompileUnit &comp_unit)=0
lldb_private::SymbolFile::ID
static char ID
LLVM RTTI support.
Definition: SymbolFile.h:49
lldb_private::Status::Fail
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
lldb_private::SymbolFileCommon::ID
static char ID
LLVM RTTI support.
Definition: SymbolFile.h:438
SourceModule.h
lldb_private::SymbolFile::ParseTypes
virtual size_t ParseTypes(CompileUnit &comp_unit)=0
lldb_private::SymbolFile::Dump
virtual void Dump(Stream &s)=0
Type.h
lldb_private::ConstString
Definition: ConstString.h:39
lldb_private::SymbolFile::RegisterInfoResolver::ResolveNumber
virtual const RegisterInfo * ResolveNumber(lldb::RegisterKind kind, uint32_t number) const =0
lldb_private::SymbolFile::SetDebugInfoHadFrameVariableErrors
virtual void SetDebugInfoHadFrameVariableErrors()=0
lldb_private::SymbolFile::isA
virtual bool isA(const void *ClassID) const
LLVM RTTI support.
Definition: SymbolFile.h:54
lldb_private::SymbolFile::InitializeObject
virtual void InitializeObject()
Initialize the SymbolFile object.
Definition: SymbolFile.h:127
lldb_private::SymbolFileCommon::m_abilities
uint32_t m_abilities
Definition: SymbolFile.h:547
PluginInterface.h
lldb_private::SymbolFile::FindNamespace
virtual CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx)
Definition: SymbolFile.h:318
lldb_private::SymbolFile::kAllAbilities
@ kAllAbilities
Definition: SymbolFile.h:72
lldb_private::SymbolFile::ParseImportedModules
virtual bool ParseImportedModules(const SymbolContext &sc, std::vector< SourceModule > &imported_modules)=0
lldb_private::SymbolFile::ForEachExternalModule
virtual bool ForEachExternalModule(lldb_private::CompileUnit &comp_unit, llvm::DenseSet< lldb_private::SymbolFile * > &visited_symbol_files, llvm::function_ref< bool(Module &)> lambda)
Apply a lambda to each external lldb::Module referenced by this comp_unit.
Definition: SymbolFile.h:179
lldb_private::SymbolFile::GetLoadDebugInfoEnabled
virtual bool GetLoadDebugInfoEnabled()
Whether debug info will be loaded or not.
Definition: SymbolFile.h:132
lldb_private::SymbolFile::RegisterInfoResolver
Definition: SymbolFile.h:337
lldb_private::SymbolFileCommon::GetNumCompileUnits
uint32_t GetNumCompileUnits() override
Definition: SymbolFile.cpp:192
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::SymbolFile::RegisterInfoResolver::ResolveName
virtual const RegisterInfo * ResolveName(llvm::StringRef name) const =0
TypeSystem.h
lldb_private::SymbolFile::GetDebugInfoSize
virtual uint64_t GetDebugInfoSize()=0
Metrics gathering functions.
lldb_private::SymbolFileCommon::MakeType
lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, Type::EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, Type::ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0) override
This function is used to create types that belong to a SymbolFile.
Definition: SymbolFile.h:509
CompilerType.h
lldb_private::TypeMap
Definition: TypeMap.h:20
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
lldb_private::SymbolFileCommon::m_index_was_saved_to_cache
bool m_index_was_saved_to_cache
Definition: SymbolFile.h:550
lldb_private::SymbolContextScope
Definition: SymbolContextScope.h:64
lldb_private::SymbolFile::ParseSupportFiles
virtual bool ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files)=0
lldb::RegisterKind
RegisterKind
Register numbering types.
Definition: lldb-enumerations.h:228
lldb-private.h
lldb_private::SymbolFile::PreloadSymbols
virtual void PreloadSymbols()
Definition: SymbolFile.cpp:31
lldb_private::SymbolFile::GetFrameVariableError
Status GetFrameVariableError(StackFrame &frame)
Get an error that describes why variables might be missing for a given symbol context.
Definition: SymbolFile.h:255
TypeList.h
lldb_private::SymbolFile::CompleteType
virtual bool CompleteType(CompilerType &compiler_type)=0
lldb_private::SymbolFileCommon::SetDebugInfoIndexWasSavedToCache
void SetDebugInfoIndexWasSavedToCache() override
Definition: SymbolFile.h:496
lldb_private::SymbolFile::classof
static bool classof(const SymbolFile *obj)
Definition: SymbolFile.h:55
lldb_private::SymbolFileCommon::GetTypeSystemForLanguage
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
Definition: SymbolFile.cpp:230
lldb_private::Status
Definition: Status.h:44
lldb_private::SymbolFileCommon::GetMainObjectFile
ObjectFile * GetMainObjectFile() override
Definition: SymbolFile.cpp:179
lldb_private::Symtab
Definition: Symtab.h:22
lldb_private::SymbolFile::GetDebugInfoIndexWasSavedToCache
virtual bool GetDebugInfoIndexWasSavedToCache() const =0
uint32_t
lldb_private::SymbolFile::ParseXcodeSDK
virtual XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit)
Return the Xcode SDK comp_unit was compiled against.
Definition: SymbolFile.h:148
lldb_private::SymbolFile::GetDebugInfoParseTime
virtual StatsDuration::Duration GetDebugInfoParseTime()
Return the time taken to parse the debug information.
Definition: SymbolFile.h:376
lldb_private::SymbolFileCommon::~SymbolFileCommon
~SymbolFileCommon() override=default
lldb_private::SymbolFile::GetDeclContextForUID
virtual CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid)
Definition: SymbolFile.h:217
lldb_private::SymbolFileCommon::SetDebugInfoHadFrameVariableErrors
void SetDebugInfoHadFrameVariableErrors() override
Definition: SymbolFile.h:502
lldb_private::SymbolFile::GetDeclContextContainingUID
virtual CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid)
Definition: SymbolFile.h:220
lldb_private::Address
Definition: Address.h:59
lldb_private::SymbolFile::SetLoadDebugInfoEnabled
virtual void SetLoadDebugInfoEnabled()
Specify debug info should be loaded.
Definition: SymbolFile.h:137
lldb_private::Type
Definition: Type.h:68
lldb_private::SymbolFile::GetBackingSymbolFile
virtual SymbolFile * GetBackingSymbolFile()
SymbolFileOnDemand class overrides this to return the underlying backing SymbolFile implementation th...
Definition: SymbolFile.h:84
lldb_private::SymbolFileCommon::ParseCompileUnitAtIndex
virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx)=0
lldb_private::SymbolFile::AddSymbols
virtual void AddSymbols(Symtab &symtab)
Definition: SymbolFile.h:331
lldb_private::SymbolFile::ParseLanguage
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit)=0
lldb_private::SymbolFile::~SymbolFile
~SymbolFile() override=default
lldb_private::SymbolFile::GetParameterStackSize
virtual llvm::Expected< lldb::addr_t > GetParameterStackSize(Symbol &symbol)
Return the number of stack bytes taken up by the parameters to this function.
Definition: SymbolFile.h:351
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
Function.h
lldb_private::SymbolFile::ArrayInfo::element_orders
llvm::SmallVector< uint64_t, 1 > element_orders
Definition: SymbolFile.h:200
lldb_private::SymbolFileCommon::GetCompileUnitAtIndex
lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx) override
Definition: SymbolFile.cpp:202
Statistics.h
lldb_private::SymbolFile::GetDebugInfoHadFrameVariableErrors
virtual bool GetDebugInfoHadFrameVariableErrors() const =0
Accessors for the bool that indicates if there was debug info, but errors stopped variables from bein...
lldb_private::SymbolFileCommon::GetObjectFile
ObjectFile * GetObjectFile() override
Definition: SymbolFile.h:465
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private::SymbolFile::GetCompileUnitAtIndex
virtual lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx)=0
CompilerDeclContext.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::SymbolFile::ResolveSymbolContext
virtual uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc)=0
lldb_private::SymbolFileCommon::operator=
const SymbolFileCommon & operator=(const SymbolFileCommon &)=delete
lldb_private::SymbolFileCommon::GetDebugInfoHadFrameVariableErrors
bool GetDebugInfoHadFrameVariableErrors() const override
Accessors for the bool that indicates if there was debug info, but errors stopped variables from bein...
Definition: SymbolFile.h:499
lldb_private::SymbolFileCommon::m_calculated_abilities
bool m_calculated_abilities
Definition: SymbolFile.h:548
lldb_private::SymbolFile::GetSymtab
virtual Symtab * GetSymtab()=0
lldb_private::TypeList
Definition: TypeList.h:20
lldb_private::SymbolFile::ArrayInfo
The characteristics of an array type.
Definition: SymbolFile.h:198
lldb_private::SymbolFile::RegisterInfoResolver::~RegisterInfoResolver
virtual ~RegisterInfoResolver()
lldb_private::SymbolFile::ParseDebugMacros
virtual bool ParseDebugMacros(CompileUnit &comp_unit)=0
lldb_private::SymbolFile::GetNumCompileUnits
virtual uint32_t GetNumCompileUnits()=0
lldb_private::SymbolFileCommon::GetDebugInfoIndexWasLoadedFromCache
bool GetDebugInfoIndexWasLoadedFromCache() const override
Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module...
Definition: SymbolFile.h:487
lldb_private::LanguageSet
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: TypeSystem.h:45
lldb_private::SymbolFile::GetTypes
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list)=0
lldb_private::SymbolFile::Blocks
@ Blocks
Definition: SymbolFile.h:68
lldb_private::SymbolFile::GlobalVariables
@ GlobalVariables
Definition: SymbolFile.h:69
lldb_private::SymbolFile::GetDebugInfoModules
virtual ModuleList GetDebugInfoModules()
Get the additional modules that this symbol file uses to parse debug info.
Definition: SymbolFile.h:392
lldb_private::SymbolFile::operator=
const SymbolFile & operator=(const SymbolFile &)=delete
lldb_private::SymbolFile::GetDynamicArrayInfoForUID
virtual std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx)=0
If type_uid points to an array type, return its characteristics.
lldb_private::SymbolFile::GetObjectFile
virtual ObjectFile * GetObjectFile()=0
lldb_private::SymbolFile::MakeType
virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, Type::EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, Type::ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0)=0
lldb_private::SymbolFileCommon::GetDebugInfoSize
uint64_t GetDebugInfoSize() override
Metrics gathering functions.
Definition: SymbolFile.cpp:240
lldb_private::Declaration
Definition: Declaration.h:24
lldb_private::SymbolFile::GetMangledNamesForFunction
virtual void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< ConstString > &mangled_names)
Definition: SymbolFile.cpp:132
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::SymbolFileCommon::isA
bool isA(const void *ClassID) const override
LLVM RTTI support.
Definition: SymbolFile.h:443
lldb_private::SymbolFile::ArrayInfo::bit_stride
uint32_t bit_stride
Definition: SymbolFile.h:202
lldb_private::SymbolFile::ArrayInfo::first_index
int64_t first_index
Definition: SymbolFile.h:199
lldb_private::SymbolFile::FindGlobalVariables
virtual void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables)
Definition: SymbolFile.cpp:114
lldb_private::SymbolFileCommon::CopyType
lldb::TypeSP CopyType(const lldb::TypeSP &other_type) override
Definition: SymbolFile.h:526
lldb_private::SymbolFile::LineTables
@ LineTables
Definition: SymbolFile.h:66
lldb_private::SymbolFileCommon::SymbolFileCommon
SymbolFileCommon(lldb::ObjectFileSP objfile_sp)
Definition: SymbolFile.h:450
lldb_private::SymbolFile::GetDebugInfoIndexWasLoadedFromCache
virtual bool GetDebugInfoIndexWasLoadedFromCache() const =0
Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module...
lldb_private::SymbolFileCommon::GetObjectFile
const ObjectFile * GetObjectFile() const override
Definition: SymbolFile.h:466
lldb_private::ObjectFile
Definition: ObjectFile.h:60
lldb_private::SymbolFileCommon::SetCompileUnitAtIndex
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp)
Definition: SymbolFile.cpp:213
lldb_private::SymbolFile::ParseVariablesForContext
virtual size_t ParseVariablesForContext(const SymbolContext &sc)=0
lldb_private::SymbolFileCommon::m_symtab
Symtab * m_symtab
Do not use m_symtab directly, as it may be freed.
Definition: SymbolFile.h:562
lldb_private::SymbolFile::DumpClangAST
virtual void DumpClangAST(Stream &s)
Definition: SymbolFile.h:275
lldb_private::SymbolFile::SetDebugInfoIndexWasLoadedFromCache
virtual void SetDebugInfoIndexWasLoadedFromCache()=0