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