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