LLDB mainline
SymbolFileDWARF.h
Go to the documentation of this file.
1//===-- SymbolFileDWARF.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_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
11
12#include <list>
13#include <map>
14#include <mutex>
15#include <optional>
16#include <unordered_map>
17#include <vector>
18
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/SetVector.h"
21#include "llvm/Support/Threading.h"
22
24#include "lldb/Core/dwarf.h"
31#include "lldb/Utility/Flags.h"
34#include "lldb/lldb-private.h"
35
36#include "DWARFContext.h"
37#include "DWARFDataExtractor.h"
38#include "DWARFDefines.h"
39#include "DWARFIndex.h"
40#include "UniqueDWARFASTType.h"
41
43
44namespace llvm {
45class DWARFDebugAbbrev;
46} // namespace llvm
47
48namespace lldb_private::plugin {
49namespace dwarf {
50// Forward Declarations for this DWARF plugin
51class DebugMapModule;
54class DWARFDebugInfo;
56class DWARFDebugLine;
58class DWARFFormValue;
59class DWARFTypeUnit;
62class SymbolFileDWARFDwp;
63
64#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
65
67 /// LLVM RTTI support.
68 static char ID;
69
70public:
71 /// LLVM RTTI support.
72 /// \{
73 bool isA(const void *ClassID) const override {
74 return ClassID == &ID || SymbolFileCommon::isA(ClassID);
75 }
76 static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
77 /// \}
78
80 friend class SymbolFileDWARFDwo;
81 friend class DebugMapModule;
82 friend class DWARFCompileUnit;
83 friend class DWARFDIE;
84 friend class DWARFASTParser;
85
86 // Static Functions
87 static void Initialize();
88
89 static void Terminate();
90
91 static void DebuggerInitialize(Debugger &debugger);
92
93 static llvm::StringRef GetPluginNameStatic() { return "dwarf"; }
94
95 static llvm::StringRef GetPluginDescriptionStatic();
96
97 static llvm::StringRef GetDwoDiagnosticSuffix();
98
100
101 // Constructors and Destructors
102
103 SymbolFileDWARF(lldb::ObjectFileSP objfile_sp, SectionList *dwo_section_list);
104
106
107 uint32_t CalculateAbilities() override;
108
109 void InitializeObject() override;
110
111 // Compile Unit function calls
112
113 lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override;
114
115 XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) override;
116
117 size_t ParseFunctions(CompileUnit &comp_unit) override;
118
119 bool ParseLineTable(CompileUnit &comp_unit) override;
120
121 bool ParseDebugMacros(CompileUnit &comp_unit) override;
122
123 bool ForEachExternalModule(CompileUnit &, llvm::DenseSet<SymbolFile *> &,
124 llvm::function_ref<bool(Module &)>) override;
125
126 bool ParseSupportFiles(CompileUnit &comp_unit,
127 SupportFileList &support_files) override;
128
129 bool ParseIsOptimized(CompileUnit &comp_unit) override;
130
131 size_t ParseTypes(CompileUnit &comp_unit) override;
132
133 bool
135 std::vector<SourceModule> &imported_modules) override;
136
137 size_t ParseBlocksRecursive(Function &func) override;
138
139 size_t ParseVariablesForContext(const SymbolContext &sc) override;
140
141 std::optional<ArrayInfo>
143 const ExecutionContext *exe_ctx) override;
144
145 bool CompleteType(CompilerType &compiler_type) override;
146
147 Type *ResolveType(const DWARFDIE &die, bool assert_not_being_parsed = true,
148 bool resolve_function_context = false);
149
151
153
155
156 std::vector<CompilerContext>
158
159 void ParseDeclsForContext(CompilerDeclContext decl_ctx) override;
160
161 uint32_t ResolveSymbolContext(const Address &so_addr,
162 lldb::SymbolContextItem resolve_scope,
163 SymbolContext &sc) override;
164
166
167 uint32_t ResolveSymbolContext(const SourceLocationSpec &src_location_spec,
168 lldb::SymbolContextItem resolve_scope,
169 SymbolContextList &sc_list) override;
170
172 const CompilerDeclContext &parent_decl_ctx,
173 uint32_t max_matches,
174 VariableList &variables) override;
175
176 void FindGlobalVariables(const RegularExpression &regex, uint32_t max_matches,
177 VariableList &variables) override;
178
179 void FindFunctions(const Module::LookupInfo &lookup_info,
180 const CompilerDeclContext &parent_decl_ctx,
181 bool include_inlines, SymbolContextList &sc_list) override;
182
183 void FindFunctions(const RegularExpression &regex, bool include_inlines,
184 SymbolContextList &sc_list) override;
185
186 void
187 GetMangledNamesForFunction(const std::string &scope_qualified_name,
188 std::vector<ConstString> &mangled_names) override;
189
190 uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
191
192 void FindTypes(const lldb_private::TypeQuery &match,
193 lldb_private::TypeResults &results) override;
194
195 void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask,
196 TypeList &type_list) override;
197
198 llvm::Expected<lldb::TypeSystemSP>
200
202 const CompilerDeclContext &parent_decl_ctx,
203 bool only_root_namespaces) override;
204
205 void PreloadSymbols() override;
206
207 std::recursive_mutex &GetModuleMutex() const override;
208
209 // PluginInterface protocol
210 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
211
212 llvm::DWARFDebugAbbrev *DebugAbbrev();
213
215
216 static bool SupportedVersion(uint16_t version);
217
220
221 bool HasForwardDeclForCompilerType(const CompilerType &compiler_type);
222
224
225 virtual void
226 GetObjCMethods(ConstString class_name,
227 llvm::function_ref<IterationAction(DWARFDIE die)> callback);
228
230
232
234
235 typedef std::map<ConstString, lldb::ModuleSP> ExternalTypeModuleMap;
236
237 /// Return the list of Clang modules imported by this SymbolFile.
241
242 /// Given a DIERef, find the correct SymbolFileDWARF.
243 ///
244 /// A DIERef contains a file index that can uniquely identify a N_OSO file for
245 /// DWARF in .o files on mac, or a .dwo or .dwp file index for split DWARF.
246 /// Calling this function will find the correct symbol file to use so that
247 /// further lookups can be done on the correct symbol file so that the DIE
248 /// offset makes sense in the DIERef.
249 virtual SymbolFileDWARF *GetDIERefSymbolFile(const DIERef &die_ref);
250
251 virtual DWARFDIE GetDIE(const DIERef &die_ref);
252
254
255 std::shared_ptr<SymbolFileDWARFDwo>
257 const DWARFDebugInfoEntry &cu_die);
258
259 /// If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
260 std::optional<uint64_t> GetDWOId();
261
262 /// Given a DWO DWARFUnit, find the corresponding skeleton DWARFUnit
263 /// in the main symbol file. DWP files can have their DWARFUnits
264 /// parsed without the skeleton compile units having been parsed, so
265 /// sometimes we need to find the skeleton compile unit for a DWO
266 /// DWARFUnit so we can fill in this link. Currently unless the
267 /// skeleton compile unit has been parsed _and_ the Unit DIE has been
268 /// parsed, the DWO unit will not have a backward link setup correctly
269 /// which was causing crashes due to an assertion that was firing
270 /// in SymbolFileDWARF::GetCompUnitForDWARFCompUnit().
272
273 static bool DIEInDeclContext(const CompilerDeclContext &parent_decl_ctx,
274 const DWARFDIE &die,
275 bool only_root_namespaces = false);
276
277 std::vector<std::unique_ptr<CallEdge>>
278 ParseCallEdgesInFunction(UserID func_id) override;
279
280 void Dump(Stream &s) override;
281
282 void DumpClangAST(Stream &s, llvm::StringRef filter,
283 bool show_colors) override;
284
286
287 /// List separate dwo files.
288 bool GetSeparateDebugInfo(StructuredData::Dictionary &d, bool errors_only,
289 bool load_all_debug_info = false) override;
290
291 /// Gets statistics about dwo files associated with this symbol file.
292 /// For split-dwarf files, this reports the counts for successfully loaded DWO
293 /// CUs, total DWO CUs, and the number of DWO CUs with loading errors.
294 /// For non-split-dwarf files, this reports 0 for all.
295 DWOStats GetDwoStats() override;
296
298
299 const std::shared_ptr<SymbolFileDWARFDwo> &GetDwpSymbolFile();
300
301 FileSpec GetFile(DWARFUnit &unit, size_t file_idx);
302
303 static llvm::Expected<lldb::TypeSystemSP> GetTypeSystem(DWARFUnit &unit);
304
306
307 // CompilerDecl related functions
308
309 static CompilerDecl GetDecl(const DWARFDIE &die);
310
312
314
315 static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
316
318 /// Same as GetLanguage() but reports all C++ versions as C++ (no version).
320
325
327
328 void ResetStatistics() override;
329
330 virtual lldb::offset_t
332 const lldb::offset_t data_offset,
333 const uint8_t op) const {
334 return LLDB_INVALID_OFFSET;
335 }
336
337 virtual bool ParseVendorDWARFOpcode(uint8_t op,
338 const llvm::DataExtractor &opcodes,
339 lldb::offset_t &offset,
340 RegisterContext *reg_ctx,
341 lldb::RegisterKind reg_kind,
342 std::vector<Value> &stack) const {
343 return false;
344 }
345
347
348 std::optional<uint64_t> GetFileIndex() const { return m_file_index; }
349 void SetFileIndex(std::optional<uint64_t> file_index) {
350 m_file_index = file_index;
351 }
352
353 virtual llvm::DenseMap<const DWARFDebugInfoEntry *, Type *> &GetDIEToType();
354
355 virtual llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
357
358 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP>
360
362
364
365 bool ClassOrStructIsVirtual(const DWARFDIE &die);
366
368
369 virtual DWARFDIE FindDefinitionDIE(const DWARFDIE &die);
370
372 const DWARFDIE &die, ConstString type_name, bool must_be_implementation);
373
374 Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
375
376 Type *ResolveTypeUID(const DWARFDIE &die, bool assert_not_being_parsed);
377
378 Type *ResolveTypeUID(const DIERef &die_ref);
379
380 /// Returns the DWARFIndex for this symbol, if it exists.
381 DWARFIndex *getIndex() { return m_index.get(); }
382
383private:
384 /// Find the definition DIE for the specified \c label in this
385 /// SymbolFile.
386 ///
387 /// \returns A valid definition DIE on success.
388 llvm::Expected<DWARFDIE>
390 const DWARFDIE &declaration);
391
392protected:
394 const SymbolFileDWARF &operator=(const SymbolFileDWARF &) = delete;
395
396 virtual void LoadSectionData(lldb::SectionType sect_type,
397 DWARFDataExtractor &data);
398
400
401 uint32_t CalculateNumCompileUnits() override;
402
403 lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
404
405 TypeList &GetTypeList() override;
406
408
410
412
413 bool GetFunction(const DWARFDIE &die, SymbolContext &sc);
414
415 Function *ParseFunction(CompileUnit &comp_unit, const DWARFDIE &die);
416
417 size_t ParseBlocksRecursive(CompileUnit &comp_unit, Block *parent_block,
418 DWARFDIE die, lldb::addr_t function_file_addr);
419
420 size_t ParseTypes(const SymbolContext &sc, const DWARFDIE &die,
421 bool parse_siblings, bool parse_children);
422
423 lldb::TypeSP ParseType(const SymbolContext &sc, const DWARFDIE &die,
424 bool *type_is_new);
425
426 bool ParseSupportFiles(DWARFUnit &dwarf_cu, const lldb::ModuleSP &module,
427 SupportFileList &support_files);
428
430 const DWARFDIE &die,
431 const lldb::addr_t func_low_pc);
433 const DWARFDIE &die);
434
436 const DWARFDIE &die,
437 VariableList &cc_variable_list);
438
440 const DWARFDIE &die,
441 const lldb::addr_t func_low_pc);
442
444 const DWARFDIE &die,
445 lldb::addr_t func_low_pc,
446 DIEArray &accumulator);
447
448 size_t PopulateBlockVariableList(VariableList &variable_list,
449 const SymbolContext &sc,
450 llvm::ArrayRef<DIERef> variable_dies,
451 lldb::addr_t func_low_pc);
452
454 DIEArray &&variable_dies);
455
456 llvm::Expected<SymbolContext>
458
459 // Given a die_offset, figure out the symbol context representing that die.
460 bool ResolveFunction(const DWARFDIE &die, bool include_inlines,
461 SymbolContextList &sc_list);
462
463 /// Resolve functions and (possibly) blocks for the given file address and a
464 /// compile unit. The compile unit comes from the sc argument and it must be
465 /// set. The results of the lookup (if any) are written back to the symbol
466 /// context.
467 void ResolveFunctionAndBlock(lldb::addr_t file_vm_addr, bool lookup_block,
468 SymbolContext &sc);
469
470 Symbol *GetObjCClassSymbol(ConstString objc_class_name);
471
473 bool resolve_function_context = false);
474
475 void SetDebugMapModule(const lldb::ModuleSP &module_sp) {
476 m_debug_map_module_wp = module_sp;
477 }
478
480 FindBlockContainingSpecification(const DIERef &func_die_ref,
481 dw_offset_t spec_block_die_offset);
482
485 dw_offset_t spec_block_die_offset);
486
487 bool ClassContainsSelector(const DWARFDIE &class_die, ConstString selector);
488
489 /// Parse call site entries (DW_TAG_call_site), including any nested call site
490 /// parameters (DW_TAG_call_site_parameter).
491 std::vector<std::unique_ptr<CallEdge>>
492 CollectCallEdges(lldb::ModuleSP module, DWARFDIE function_die);
493
494 /// If this symbol file is linked to by a debug map (see
495 /// SymbolFileDWARFDebugMap), and \p file_addr is a file address relative to
496 /// an object file, adjust \p file_addr so that it is relative to the main
497 /// binary. Returns the adjusted address, or \p file_addr if no adjustment is
498 /// needed, on success and LLDB_INVALID_ADDRESS otherwise.
500
501 bool FixupAddress(Address &addr);
502
503 typedef llvm::SetVector<Type *> TypeSet;
504
505 void GetTypes(const DWARFDIE &die, dw_offset_t min_die_offset,
506 dw_offset_t max_die_offset, uint32_t type_mask,
507 TypeSet &type_set);
508
511
513
515
517 std::optional<uint32_t> GetDWARFUnitIndex(uint32_t cu_idx);
518
520
522
523 void InitializeFirstCodeAddressRecursive(const SectionList &section_list);
524
526
527 void
528 GetCompileOptions(std::unordered_map<lldb::CompUnitSP, Args> &args) override;
529
532
533 llvm::once_flag m_dwp_symfile_once_flag;
534 std::shared_ptr<SymbolFileDWARFDwo> m_dwp_symfile;
535
537
538 llvm::once_flag m_info_once_flag;
539 std::unique_ptr<DWARFDebugInfo> m_info;
540
541 std::unique_ptr<llvm::DWARFDebugAbbrev> m_abbr;
542 std::unique_ptr<GlobalVariableMap> m_global_aranges_up;
543
544 typedef std::unordered_map<lldb::offset_t, DebugMacrosSP> DebugMacrosMap;
546
548 std::unique_ptr<DWARFIndex> m_index;
550
551 typedef std::set<DIERef> DIERefSet;
552 typedef llvm::StringMap<DIERefSet> NameToOffsetMap;
555 // A map from DIE to lldb_private::Type. For record type, the key might be
556 // either declaration DIE or definition DIE.
557 llvm::DenseMap<const DWARFDebugInfoEntry *, Type *> m_die_to_type;
559 // A map from CompilerType to the struct/class/union/enum DIE (might be a
560 // declaration or a definition) that is used to construct it.
561 llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef>
563 llvm::DenseMap<dw_offset_t, std::unique_ptr<SupportFileList>>
565 std::vector<uint32_t> m_lldb_cu_to_dwarf_unit;
566 /// DWARF does not provide a good way for traditional (concatenating) linkers
567 /// to invalidate debug info describing dead-stripped code. These linkers will
568 /// keep the debug info but resolve any addresses referring to such code as
569 /// zero (BFD) or a small positive integer (zero + relocation addend -- GOLD).
570 /// Try to filter out this debug info by comparing it to the lowest code
571 /// address in the module.
574 std::atomic_flag m_dwo_warning_issued = ATOMIC_FLAG_INIT;
575 /// If this DWARF file a .DWO file or a DWARF .o file on mac when
576 /// no dSYM file is being used, this file index will be set to a
577 /// valid value that can be used in DIERef objects which will contain
578 /// an index that identifies the .DWO or .o file.
579 std::optional<uint64_t> m_file_index;
580};
581
582} // namespace dwarf
583} // namespace lldb_private::plugin
584
585#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
A section + offset based address class.
Definition Address.h:62
A class that describes a single lexical block.
Definition Block.h:41
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.
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
An data extractor class.
A class to manage flag bits.
Definition Debugger.h:100
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file utility class.
Definition FileSpec.h:56
A class that describes a function.
Definition Function.h:377
A class that encapsulates name lookup information.
Definition Module.h:935
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:91
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
This base class provides an interface to stack frames.
Definition StackFrame.h:44
std::chrono::duration< double > Duration
Definition Statistics.h:37
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A list of support files for a CompileUnit.
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.
bool isA(const void *ClassID) const override
LLVM RTTI support.
Definition SymbolFile.h:560
SymbolFileCommon(lldb::ObjectFileSP objfile_sp)
Definition SymbolFile.h:567
Provides public interface for all SymbolFiles.
Definition SymbolFile.h:51
virtual bool isA(const void *ClassID) const
LLVM RTTI support.
Definition SymbolFile.h:58
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:532
A class that contains all state required for type lookups.
Definition Type.h:104
This class tracks the state and results of a TypeQuery.
Definition Type.h:344
An abstraction for Xcode-style SDKs that works like ArchSpec.
Definition XcodeSDK.h:25
Identifies a DWARF debug info entry within a given Module.
Definition DIERef.h:31
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
static CompilerDeclContext GetContainingDeclContext(const DWARFDIE &die)
static bool SupportedVersion(uint16_t version)
std::optional< uint32_t > GetDWARFUnitIndex(uint32_t cu_idx)
CompileUnit * GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu)
lldb::ModuleSP GetExternalModule(ConstString name)
void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables) override
virtual DWARFDIE FindDefinitionDIE(const DWARFDIE &die)
DWARFDIE FindBlockContainingSpecification(const DIERef &func_die_ref, dw_offset_t spec_block_die_offset)
lldb::VariableSP ParseVariableDIE(const SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
static DWARFASTParser * GetDWARFParser(DWARFUnit &unit)
static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit)
Same as GetLanguage() but reports all C++ versions as C++ (no version).
bool ForEachExternalModule(CompileUnit &, llvm::DenseSet< SymbolFile * > &, llvm::function_ref< bool(Module &)>) override
static bool classof(const SymbolFile *obj)
std::unique_ptr< DWARFDebugInfo > m_info
bool DeclContextMatchesThisSymbolFile(const CompilerDeclContext &decl_ctx)
void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< ConstString > &mangled_names) override
std::map< ConstString, lldb::ModuleSP > ExternalTypeModuleMap
size_t PopulateBlockVariableList(VariableList &variable_list, const SymbolContext &sc, llvm::ArrayRef< DIERef > variable_dies, lldb::addr_t func_low_pc)
Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
DWOStats GetDwoStats() override
Gets statistics about dwo files associated with this symbol file.
virtual llvm::DenseMap< lldb::opaque_compiler_type_t, DIERef > & GetForwardDeclCompilerTypeToDIE()
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb::VariableSP > DIEToVariableSP
size_t ParseVariablesInFunctionContextRecursive(const SymbolContext &sc, const DWARFDIE &die, lldb::addr_t func_low_pc, DIEArray &accumulator)
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, ConstString type_name, bool must_be_implementation)
const std::shared_ptr< SymbolFileDWARFDwo > & GetDwpSymbolFile()
std::recursive_mutex & GetModuleMutex() const override
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
bool GetSeparateDebugInfo(StructuredData::Dictionary &d, bool errors_only, bool load_all_debug_info=false) override
List separate dwo files.
uint32_t ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) override
llvm::Expected< DWARFDIE > FindFunctionDefinition(const FunctionCallLabel &label, const DWARFDIE &declaration)
Find the definition DIE for the specified label in this SymbolFile.
virtual llvm::DenseMap< const DWARFDebugInfoEntry *, Type * > & GetDIEToType()
virtual DWARFCompileUnit * GetDWARFCompileUnit(CompileUnit *comp_unit)
Function * ParseFunction(CompileUnit &comp_unit, const DWARFDIE &die)
virtual bool ParseVendorDWARFOpcode(uint8_t op, const llvm::DataExtractor &opcodes, lldb::offset_t &offset, RegisterContext *reg_ctx, lldb::RegisterKind reg_kind, std::vector< Value > &stack) const
lldb::TypeSP GetTypeForDIE(const DWARFDIE &die, bool resolve_function_context=false)
llvm::Expected< SymbolContext > ResolveFunctionCallLabel(FunctionCallLabel &label) override
Resolves the function corresponding to the specified LLDB function call label.
lldb::addr_t m_first_code_address
DWARF does not provide a good way for traditional (concatenating) linkers to invalidate debug info de...
ConstString ConstructFunctionDemangledName(const DWARFDIE &die)
void SetDebugMapModule(const lldb::ModuleSP &module_sp)
DWARFUnit * GetSkeletonUnit(DWARFUnit *dwo_unit)
Given a DWO DWARFUnit, find the corresponding skeleton DWARFUnit in the main symbol file.
FileSpec GetFile(DWARFUnit &unit, size_t file_idx)
std::shared_ptr< SymbolFileDWARFDwo > m_dwp_symfile
void DumpClangAST(Stream &s, llvm::StringRef filter, bool show_colors) override
void InitializeFirstCodeAddressRecursive(const SectionList &section_list)
std::unique_ptr< llvm::DWARFDebugAbbrev > m_abbr
llvm::DenseMap< lldb::opaque_compiler_type_t, DIERef > m_forward_decl_compiler_type_to_die
DWARFUnit * GetNextUnparsedDWARFCompileUnit(DWARFUnit *prev_cu)
std::vector< CompilerContext > GetCompilerContextForUID(lldb::user_id_t uid) override
virtual DWARFDIE GetDIE(const DIERef &die_ref)
std::unique_ptr< GlobalVariableMap > m_global_aranges_up
virtual lldb::offset_t GetVendorDWARFOpcodeSize(const DataExtractor &data, const lldb::offset_t data_offset, const uint8_t op) const
DWARFIndex * getIndex()
Returns the DWARFIndex for this symbol, if it exists.
uint64_t GetDebugInfoSize(bool load_all_debug_info=false) override
Metrics gathering functions.
void FindTypes(const lldb_private::TypeQuery &match, lldb_private::TypeResults &results) override
Find types using a type-matching object that contains all search parameters.
static CompilerDecl GetDecl(const DWARFDIE &die)
void ResolveFunctionAndBlock(lldb::addr_t file_vm_addr, bool lookup_block, SymbolContext &sc)
Resolve functions and (possibly) blocks for the given file address and a compile unit.
void ResetStatistics() override
Reset the statistics for the symbol file.
size_t ParseVariablesForContext(const SymbolContext &sc) override
std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
size_t ParseBlocksRecursive(Function &func) override
Type * ResolveTypeUID(lldb::user_id_t type_uid) override
static lldb::LanguageType GetLanguage(DWARFUnit &unit)
llvm::DenseMap< dw_offset_t, std::unique_ptr< SupportFileList > > m_type_unit_support_files
size_t ParseFunctions(CompileUnit &comp_unit) override
bool ParseDebugMacros(CompileUnit &comp_unit) override
static SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
bool ClassContainsSelector(const DWARFDIE &class_die, ConstString selector)
bool ParseSupportFiles(CompileUnit &comp_unit, SupportFileList &support_files) override
XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
bool ParseImportedModules(const SymbolContext &sc, std::vector< SourceModule > &imported_modules) override
std::optional< uint64_t > GetDWOId()
If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask, TypeList &type_list) override
void ParseDeclsForContext(CompilerDeclContext decl_ctx) override
std::unordered_map< lldb::offset_t, DebugMacrosSP > DebugMacrosMap
size_t ParseTypes(CompileUnit &comp_unit) override
std::shared_ptr< SymbolFileDWARFDwo > GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
SymbolFileDWARF(lldb::ObjectFileSP objfile_sp, SectionList *dwo_section_list)
lldb::VariableSP ParseVariableDIECached(const SymbolContext &sc, const DWARFDIE &die)
lldb_private::ModuleSpecList GetSeparateDebugInfoFiles() override
Return a map of separate debug info files that are loaded.
StatsDuration::Duration GetDebugInfoIndexTime() override
Return the time it took to index the debug information in the object file.
bool CompleteType(CompilerType &compiler_type) override
bool ParseLineTable(CompileUnit &comp_unit) override
bool ResolveFunction(const DWARFDIE &die, bool include_inlines, SymbolContextList &sc_list)
bool ParseIsOptimized(CompileUnit &comp_unit) override
std::vector< std::unique_ptr< CallEdge > > CollectCallEdges(lldb::ModuleSP module, DWARFDIE function_die)
Parse call site entries (DW_TAG_call_site), including any nested call site parameters (DW_TAG_call_si...
DIEArray MergeBlockAbstractParameters(const DWARFDIE &block_die, DIEArray &&variable_dies)
DWARFDIE GetDeclContextDIEContainingDIE(const DWARFDIE &die)
void SetFileIndex(std::optional< uint64_t > file_index)
void InitializeObject() override
Initialize the SymbolFile object.
void ParseAndAppendGlobalVariable(const SymbolContext &sc, const DWARFDIE &die, VariableList &cc_variable_list)
static llvm::Expected< lldb::TypeSystemSP > GetTypeSystem(DWARFUnit &unit)
void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list) override
static bool DIEInDeclContext(const CompilerDeclContext &parent_decl_ctx, const DWARFDIE &die, bool only_root_namespaces=false)
uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) override
bool HasForwardDeclForCompilerType(const CompilerType &compiler_type)
StatsDuration::Duration GetDebugInfoParseTime() override
Return the time taken to parse the debug information.
const SymbolFileDWARF & operator=(const SymbolFileDWARF &)=delete
lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu)
CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces) override
Finds a namespace of name name and whose parent context is parent_decl_ctx.
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val)
lldb::TypeSP ParseType(const SymbolContext &sc, const DWARFDIE &die, bool *type_is_new)
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
std::vector< std::unique_ptr< CallEdge > > ParseCallEdgesInFunction(UserID func_id) override
lldb::addr_t FixupAddress(lldb::addr_t file_addr)
If this symbol file is linked to by a debug map (see SymbolFileDWARFDebugMap), and file_addr is a fil...
virtual void GetObjCMethods(ConstString class_name, llvm::function_ref< IterationAction(DWARFDIE die)> callback)
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
bool isA(const void *ClassID) const override
LLVM RTTI support.
CompilerDecl GetDeclForUID(lldb::user_id_t uid) override
virtual SymbolFileDWARF * GetDIERefSymbolFile(const DIERef &die_ref)
Given a DIERef, find the correct SymbolFileDWARF.
std::optional< uint64_t > m_file_index
If this DWARF file a .DWO file or a DWARF .o file on mac when no dSYM file is being used,...
lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override
CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
static void DebuggerInitialize(Debugger &debugger)
RangeDataVector< lldb::addr_t, lldb::addr_t, Variable * > GlobalVariableMap
size_t ParseVariablesInFunctionContext(const SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
const ExternalTypeModuleMap & getExternalTypeModules() const
Return the list of Clang modules imported by this SymbolFile.
llvm::DenseMap< const DWARFDebugInfoEntry *, Type * > m_die_to_type
SymbolFileDWARF(const SymbolFileDWARF &)=delete
bool GetFunction(const DWARFDIE &die, SymbolContext &sc)
const SupportFileList * GetTypeUnitSupportFiles(DWARFTypeUnit &tu)
llvm::StringMap< DIERefSet > NameToOffsetMap
std::optional< uint64_t > GetFileIndex() const
Symbol * GetObjCClassSymbol(ConstString objc_class_name)
static CompilerDeclContext GetDeclContext(const DWARFDIE &die)
virtual UniqueDWARFASTTypeMap & GetUniqueDWARFASTTypeMap()
virtual void LoadSectionData(lldb::SectionType sect_type, DWARFDataExtractor &data)
Status CalculateFrameVariableError(StackFrame &frame) override
Subclasses will override this function to for GetFrameVariableError().
uint64_t dw_offset_t
Definition dwarf.h:24
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_OFFSET
std::vector< DIERef > DIEArray
Definition DIERef.h:136
std::shared_ptr< DebugMacros > DebugMacrosSP
Definition DebugMacros.h:22
IterationAction
Useful for callbacks whose return type indicates whether to continue iteration or short-circuit.
std::weak_ptr< lldb_private::Module > ModuleWP
uint64_t offset_t
Definition lldb-types.h:86
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Variable > VariableSP
uint64_t user_id_t
Definition lldb-types.h:83
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
RegisterKind
Register numbering types.
Holds statistics about DWO (Debug With Object) files.
Definition Statistics.h:124
Holds parsed information about a function call label that LLDB attaches as an AsmLabel to function AS...
Definition Expression.h:110
A mix in class that contains a generic user ID.
Definition UserID.h:31