LLDB mainline
|
#include "SymbolFileDWARF.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Threading.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Progress.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/Value.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/Timer.h"
#include "Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h"
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
#include "Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerDeclContext.h"
#include "lldb/Symbol/DebugMacros.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/Target.h"
#include "AppleDWARFIndex.h"
#include "DWARFASTParser.h"
#include "DWARFASTParserClang.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugAranges.h"
#include "DWARFDebugInfo.h"
#include "DWARFDebugMacro.h"
#include "DWARFDebugRanges.h"
#include "DWARFDeclContext.h"
#include "DWARFFormValue.h"
#include "DWARFTypeUnit.h"
#include "DWARFUnit.h"
#include "DebugNamesDWARFIndex.h"
#include "LogChannelDWARF.h"
#include "ManualDWARFIndex.h"
#include "SymbolFileDWARFDebugMap.h"
#include "SymbolFileDWARFDwo.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include <algorithm>
#include <map>
#include <memory>
#include <optional>
#include <cctype>
#include <cstring>
#include "SymbolFileDWARFProperties.inc"
#include "SymbolFileDWARFPropertiesEnum.inc"
Go to the source code of this file.
Macros | |
#define | DEBUG_PRINTF(fmt, ...) |
#define | LLDB_PROPERTIES_symbolfiledwarf |
#define | LLDB_PROPERTIES_symbolfiledwarf |
Functions | |
bool | IsStructOrClassTag (llvm::dwarf::Tag Tag) |
static PluginProperties & | GetGlobalPluginProperties () |
static const llvm::DWARFDebugLine::LineTable * | ParseLLVMLineTable (DWARFContext &context, llvm::DWARFDebugLine &line, dw_offset_t line_offset, dw_offset_t unit_offset) |
static bool | ParseLLVMLineTablePrologue (DWARFContext &context, llvm::DWARFDebugLine::Prologue &prologue, dw_offset_t line_offset, dw_offset_t unit_offset) |
static std::optional< std::string > | GetFileByIndex (const llvm::DWARFDebugLine::Prologue &prologue, size_t idx, llvm::StringRef compile_dir, FileSpec::Style style) |
static void | ParseSupportFilesFromPrologue (SupportFileList &support_files, const lldb::ModuleSP &module, const llvm::DWARFDebugLine::Prologue &prologue, FileSpec::Style style, llvm::StringRef compile_dir={}) |
static ConstString | GetDWARFMachOSegmentName () |
static std::set< dw_form_t > | GetUnsupportedForms (llvm::DWARFDebugAbbrev *debug_abbrev) |
static void | MakeAbsoluteAndRemap (FileSpec &file_spec, DWARFUnit &dwarf_cu, const ModuleSP &module_sp) |
Make an absolute path out of file_spec and remap it using the module's source remapping dictionary. | |
static const char * | GetDWOName (DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die) |
Return the DW_AT_(GNU_)dwo_name. | |
static std::optional< uint64_t > | GetDWOId (DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die) |
Return the DW_AT_(GNU_)dwo_id. | |
static bool | SplitTemplateParams (llvm::StringRef fullname, llvm::StringRef &basename, llvm::StringRef &template_params) |
Split a name up into a basename and template parameters. | |
static bool | UpdateCompilerContextForSimpleTemplateNames (TypeQuery &match) |
static DWARFExpressionList | GetExprListFromAtLocation (DWARFFormValue form_value, ModuleSP module, const DWARFDIE &die, const addr_t func_low_pc) |
Creates a DWARFExpressionList from an DW_AT_location form_value. | |
static DWARFExpressionList | GetExprListFromAtConstValue (DWARFFormValue form_value, ModuleSP module, const DWARFDIE &die) |
Creates a DWARFExpressionList from an DW_AT_const_value. | |
static Symbol * | fixupExternalAddrZeroVariable (SymbolFileDWARFDebugMap &debug_map_symfile, llvm::StringRef name, DWARFExpressionList &expr_list, const DWARFDIE &die) |
Global variables that are not initialized may have their address set to zero. | |
static CallSiteParameterArray | CollectCallSiteParameters (ModuleSP module, DWARFDIE call_site_die) |
Collect call site parameters in a DW_TAG_call_site DIE. | |
#define DEBUG_PRINTF | ( | fmt, | |
... | |||
) |
Definition at line 96 of file SymbolFileDWARF.cpp.
#define LLDB_PROPERTIES_symbolfiledwarf |
Definition at line 114 of file SymbolFileDWARF.cpp.
#define LLDB_PROPERTIES_symbolfiledwarf |
Definition at line 114 of file SymbolFileDWARF.cpp.
|
static |
Collect call site parameters in a DW_TAG_call_site DIE.
Definition at line 3995 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFAttributes::AttributeAtIndex(), lldb_private::plugin::dwarf::DWARFFormValue::BlockData(), lldb_private::plugin::dwarf::DWARFDIE::children(), lldb_private::plugin::dwarf::DWARFAttributes::ExtractFormValueAtIndex(), lldb_private::plugin::dwarf::DWARFFormValue::Form(), lldb_private::plugin::dwarf::DWARFFormValue::IsBlockForm(), lldb_private::plugin::dwarf::DWARFAttributes::Size(), and lldb_private::plugin::dwarf::DWARFFormValue::Unsigned().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::CollectCallEdges().
|
static |
Global variables that are not initialized may have their address set to zero.
Since multiple variables may have this address, we cannot apply the OSO relink address approach we normally use. However, the executable will have a matching symbol with a good address; this function attempts to find the correct address by looking into the executable's symbol table. If it succeeds, the expr_list is updated with the new address and the executable's symbol is returned.
Definition at line 3427 of file SymbolFileDWARF.cpp.
References lldb_private::Symtab::eDebugYes, lldb::eSymbolTypeData, lldb_private::Symtab::eVisibilityExtern, lldb_private::Symtab::FindFirstSymbolWithNameAndType(), lldb_private::Symbol::GetAddressRef(), lldb_private::plugin::dwarf::DWARFBaseDIE::GetCU(), lldb_private::Address::GetFileAddress(), lldb_private::DWARFExpressionList::GetMutableExpressionAtAddress(), lldb_private::SymbolFileCommon::GetObjectFile(), lldb_private::ObjectFile::GetSymtab(), LLDB_INVALID_ADDRESS, lldb_private::DWARFExpression::Update_DW_OP_addr(), and lldb_private::Symbol::ValueIsAddress().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE().
|
static |
Definition at line 479 of file SymbolFileDWARF.cpp.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::CalculateAbilities().
|
static |
Return the DW_AT_(GNU_)dwo_id.
Definition at line 1804 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFDebugInfoEntry::GetAttributeValueAsOptionalUnsigned().
|
static |
Return the DW_AT_(GNU_)dwo_name.
Definition at line 769 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFDebugInfoEntry::GetAttributeValueAsString().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetSeparateDebugInfo(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseCompileUnit(), and lldb_private::plugin::dwarf::SymbolFileDWARF::UpdateExternalModuleListIfNeeded().
|
static |
Creates a DWARFExpressionList from an DW_AT_const_value.
This is either a block form, or a string, or a data form. For data forms, this returns an empty list, as we cannot initialize it properly without a SymbolFileType.
Definition at line 3399 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFFormValue::AsCString(), lldb_private::plugin::dwarf::DWARFFormValue::BlockData(), lldb_private::plugin::dwarf::DWARFFormValue::Form(), lldb_private::plugin::dwarf::DWARFUnit::GetAddressByteSize(), lldb_private::plugin::dwarf::DWARFUnit::GetByteOrder(), lldb_private::plugin::dwarf::DWARFBaseDIE::GetCU(), lldb_private::plugin::dwarf::DWARFBaseDIE::GetData(), lldb_private::DataExtractor::GetDataStart(), lldb_private::plugin::dwarf::DWARFFormValue::IsBlockForm(), and lldb_private::plugin::dwarf::DWARFFormValue::Unsigned().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE().
|
static |
Creates a DWARFExpressionList from an DW_AT_location form_value.
Definition at line 3367 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFFormValue::BlockData(), lldb_private::plugin::dwarf::DWARFFormValue::Form(), lldb_private::DataExtractor::GetByteSize(), lldb_private::plugin::dwarf::DWARFBaseDIE::GetCU(), lldb_private::plugin::dwarf::DWARFBaseDIE::GetData(), lldb_private::DataExtractor::GetDataStart(), lldb_private::plugin::dwarf::DWARFUnit::GetLocationData(), lldb_private::plugin::dwarf::DWARFUnit::GetLoclistOffset(), lldb_private::plugin::dwarf::DWARFFormValue::GetUnit(), lldb_private::plugin::dwarf::DWARFFormValue::IsBlockForm(), lldb_private::DWARFExpression::ParseDWARFLocationList(), lldb_private::DWARFExpressionList::SetFuncFileAddress(), lldb_private::plugin::dwarf::DWARFFormValue::Unsigned(), and lldb_private::DataExtractor::ValidOffset().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE().
|
static |
Definition at line 197 of file SymbolFileDWARF.cpp.
|
static |
Definition at line 141 of file SymbolFileDWARF.cpp.
|
static |
Definition at line 582 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFFormValue::FormIsSupported().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::CalculateAbilities().
bool IsStructOrClassTag | ( | llvm::dwarf::Tag | Tag | ) |
|
static |
Make an absolute path out of file_spec
and remap it using the module's source remapping dictionary.
Definition at line 755 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFUnit::GetCompilationDirectory(), lldb_private::FileSpec::GetPath(), lldb_private::FileSpec::MakeAbsolute(), and lldb_private::FileSpec::SetFile().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::ParseCompileUnit(), and lldb_private::plugin::dwarf::SymbolFileDWARF::ParseImportedModules().
|
static |
Definition at line 147 of file SymbolFileDWARF.cpp.
References lldb_private::plugin::dwarf::DWARFContext::GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVMDWARF(), lldb_private::GetLog(), lldb_private::plugin::dwarf::DWARFContext::getOrLoadLineData(), and LLDB_LOG_ERROR.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::ParseLineTable().
|
static |
Definition at line 169 of file SymbolFileDWARF.cpp.
References error(), lldb_private::plugin::dwarf::DWARFContext::GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVMDWARF(), lldb_private::GetLog(), lldb_private::plugin::dwarf::DWARFContext::getOrLoadLineData(), and LLDB_LOG_ERROR.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::ParseSupportFiles().
|
static |
Wrap a path for an in-DWARF source file. Lazily write it to disk when Materialize() is called.
The file contents buffer.
Deletes the temporary file at the end.
Write the file contents to a temporary file.
Definition at line 213 of file SymbolFileDWARF.cpp.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::GetTypeUnitSupportFiles(), and lldb_private::plugin::dwarf::SymbolFileDWARF::ParseSupportFiles().
|
static |
Split a name up into a basename and template parameters.
Definition at line 2683 of file SymbolFileDWARF.cpp.
Referenced by UpdateCompilerContextForSimpleTemplateNames().
|
static |
Definition at line 2697 of file SymbolFileDWARF.cpp.
References lldb_private::TypeQuery::GetContextRef(), and SplitTemplateParams().