LLDB mainline
Macros | Functions
SymbolFileDWARF.cpp File Reference
#include "SymbolFileDWARF.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/Support/Casting.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

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 FileSpecList ParseSupportFilesFromPrologue (const lldb::ModuleSP &module, const llvm::DWARFDebugLine::Prologue &prologue, FileSpec::Style style, llvm::StringRef compile_dir={})
 
static ConstString GetDWARFMachOSegmentName ()
 
static std::set< dw_form_tGetUnsupportedForms (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 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 SymbolfixupExternalAddrZeroVariable (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.
 

Macro Definition Documentation

◆ DEBUG_PRINTF

#define DEBUG_PRINTF (   fmt,
  ... 
)

Definition at line 95 of file SymbolFileDWARF.cpp.

◆ LLDB_PROPERTIES_symbolfiledwarf [1/2]

#define LLDB_PROPERTIES_symbolfiledwarf

Definition at line 113 of file SymbolFileDWARF.cpp.

◆ LLDB_PROPERTIES_symbolfiledwarf [2/2]

#define LLDB_PROPERTIES_symbolfiledwarf

Definition at line 113 of file SymbolFileDWARF.cpp.

Function Documentation

◆ CollectCallSiteParameters()

static CallSiteParameterArray CollectCallSiteParameters ( ModuleSP  module,
DWARFDIE  call_site_die 
)
static

◆ fixupExternalAddrZeroVariable()

static Symbol * fixupExternalAddrZeroVariable ( SymbolFileDWARFDebugMap debug_map_symfile,
llvm::StringRef  name,
DWARFExpressionList expr_list,
const DWARFDIE die 
)
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 3461 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().

◆ GetDWARFMachOSegmentName()

static ConstString GetDWARFMachOSegmentName ( )
static

◆ GetDWOId()

static std::optional< uint64_t > GetDWOId ( DWARFCompileUnit dwarf_cu,
const DWARFDebugInfoEntry cu_die 
)
static

Return the DW_AT_(GNU_)dwo_id.

Definition at line 1723 of file SymbolFileDWARF.cpp.

References lldb_private::plugin::dwarf::DWARFDebugInfoEntry::GetAttributeValueAsOptionalUnsigned().

◆ GetDWOName()

static const char * GetDWOName ( DWARFCompileUnit dwarf_cu,
const DWARFDebugInfoEntry cu_die 
)
static

◆ GetExprListFromAtConstValue()

static DWARFExpressionList GetExprListFromAtConstValue ( DWARFFormValue  form_value,
ModuleSP  module,
const DWARFDIE die 
)
static

◆ GetExprListFromAtLocation()

static DWARFExpressionList GetExprListFromAtLocation ( DWARFFormValue  form_value,
ModuleSP  module,
const DWARFDIE die,
const addr_t  func_low_pc 
)
static

◆ GetFileByIndex()

static std::optional< std::string > GetFileByIndex ( const llvm::DWARFDebugLine::Prologue &  prologue,
size_t  idx,
llvm::StringRef  compile_dir,
FileSpec::Style  style 
)
static

Definition at line 191 of file SymbolFileDWARF.cpp.

◆ GetGlobalPluginProperties()

static PluginProperties & GetGlobalPluginProperties ( )
static

Definition at line 135 of file SymbolFileDWARF.cpp.

◆ GetUnsupportedForms()

static std::set< dw_form_t > GetUnsupportedForms ( llvm::DWARFDebugAbbrev *  debug_abbrev)
static

◆ MakeAbsoluteAndRemap()

static void MakeAbsoluteAndRemap ( FileSpec file_spec,
DWARFUnit dwarf_cu,
const ModuleSP module_sp 
)
static

◆ ParseLLVMLineTable()

static const llvm::DWARFDebugLine::LineTable * ParseLLVMLineTable ( DWARFContext context,
llvm::DWARFDebugLine &  line,
dw_offset_t  line_offset,
dw_offset_t  unit_offset 
)
static

◆ ParseLLVMLineTablePrologue()

static bool ParseLLVMLineTablePrologue ( DWARFContext context,
llvm::DWARFDebugLine::Prologue &  prologue,
dw_offset_t  line_offset,
dw_offset_t  unit_offset 
)
static

◆ ParseSupportFilesFromPrologue()

static FileSpecList ParseSupportFilesFromPrologue ( const lldb::ModuleSP module,
const llvm::DWARFDebugLine::Prologue &  prologue,
FileSpec::Style  style,
llvm::StringRef  compile_dir = {} 
)
static