Skip to content

Commit

Permalink
Add basic fission support to SymbolFileDWARF
Browse files Browse the repository at this point in the history
* Create new dwo symbol file class
* Add handling for .dwo sections
* Change indexes in SymbolFileDWARF to store compile unit offset next to
  DIE offset
* Propagate queries from dwarf compile unit to the dwo compile unit
  where applicable

Differential revision: http://reviews.llvm.org/D12291

llvm-svn: 247132
  • Loading branch information
Tamas Berghammer committed Sep 9, 2015
1 parent 715cbe8 commit eb882fc
Show file tree
Hide file tree
Showing 25 changed files with 1,045 additions and 532 deletions.
2 changes: 1 addition & 1 deletion lldb/include/lldb/Symbol/ObjectFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ friend class lldb_private::Module;
/// The list of sections contained in this object file.
//------------------------------------------------------------------
virtual SectionList *
GetSectionList ();
GetSectionList (bool update_module_section_list = true);

virtual void
CreateSections (SectionList &unified_section_list) = 0;
Expand Down
16 changes: 16 additions & 0 deletions lldb/lldb.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,9 @@
6D55BAEE1A8CD0B200A70529 /* PlatformAndroidRemoteGDBServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D55BAEB1A8CD08C00A70529 /* PlatformAndroidRemoteGDBServer.cpp */; };
6D762BEE1B1605D2006C929D /* LLDBServerUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D762BEC1B1605CD006C929D /* LLDBServerUtilities.cpp */; };
6D86CEA01B440F8500A7FBFA /* CommandObjectBugreport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D86CE9E1B440F6B00A7FBFA /* CommandObjectBugreport.cpp */; };
6D95DC001B9DC057000E318A /* DIERef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D95DBFD1B9DC057000E318A /* DIERef.cpp */; };
6D95DC011B9DC057000E318A /* HashedNameToDIE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D95DBFE1B9DC057000E318A /* HashedNameToDIE.cpp */; };
6D95DC021B9DC057000E318A /* SymbolFileDWARFDwo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D95DBFF1B9DC057000E318A /* SymbolFileDWARFDwo.cpp */; };
8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; };
8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; };
8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */; };
Expand Down Expand Up @@ -2385,6 +2388,11 @@
6D762BED1B1605CD006C929D /* LLDBServerUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LLDBServerUtilities.h; path = "tools/lldb-server/LLDBServerUtilities.h"; sourceTree = "<group>"; };
6D86CE9E1B440F6B00A7FBFA /* CommandObjectBugreport.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBugreport.cpp; path = source/Commands/CommandObjectBugreport.cpp; sourceTree = "<group>"; };
6D86CE9F1B440F6B00A7FBFA /* CommandObjectBugreport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommandObjectBugreport.h; path = source/Commands/CommandObjectBugreport.h; sourceTree = "<group>"; };
6D95DBFD1B9DC057000E318A /* DIERef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DIERef.cpp; sourceTree = "<group>"; };
6D95DBFE1B9DC057000E318A /* HashedNameToDIE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HashedNameToDIE.cpp; sourceTree = "<group>"; };
6D95DBFF1B9DC057000E318A /* SymbolFileDWARFDwo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolFileDWARFDwo.cpp; sourceTree = "<group>"; };
6D95DC031B9DC06F000E318A /* DIERef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DIERef.h; sourceTree = "<group>"; };
6D95DC041B9DC06F000E318A /* SymbolFileDWARFDwo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolFileDWARFDwo.h; sourceTree = "<group>"; };
8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemoryHistory.cpp; path = source/Target/MemoryHistory.cpp; sourceTree = "<group>"; };
8C2D6A54197A1EBE006989C9 /* MemoryHistory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MemoryHistory.h; path = include/lldb/Target/MemoryHistory.h; sourceTree = "<group>"; };
8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryHistoryASan.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3115,6 +3123,11 @@
260C89B210F57C5600BB2B04 /* DWARF */ = {
isa = PBXGroup;
children = (
6D95DC031B9DC06F000E318A /* DIERef.h */,
6D95DC041B9DC06F000E318A /* SymbolFileDWARFDwo.h */,
6D95DBFD1B9DC057000E318A /* DIERef.cpp */,
6D95DBFE1B9DC057000E318A /* HashedNameToDIE.cpp */,
6D95DBFF1B9DC057000E318A /* SymbolFileDWARFDwo.cpp */,
260C89B310F57C5600BB2B04 /* DWARFAbbreviationDeclaration.cpp */,
260C89B410F57C5600BB2B04 /* DWARFAbbreviationDeclaration.h */,
269DDD451B8FD01A00D0DBD8 /* DWARFASTParser.h */,
Expand Down Expand Up @@ -6258,6 +6271,7 @@
2689005C13353E0400698AC0 /* ValueObjectVariable.cpp in Sources */,
264A58EE1A7DBCAD00A6B1B0 /* OptionValueFormatEntity.cpp in Sources */,
8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */,
6D95DC021B9DC057000E318A /* SymbolFileDWARFDwo.cpp in Sources */,
942612F71B95000000EF842E /* LanguageCategory.cpp in Sources */,
2689005D13353E0400698AC0 /* VMRange.cpp in Sources */,
2689005E13353E0E00698AC0 /* ClangASTSource.cpp in Sources */,
Expand Down Expand Up @@ -6319,6 +6333,7 @@
2689008313353E2200698AC0 /* CommandObjectMultiword.cpp in Sources */,
2689008413353E2200698AC0 /* CommandObjectRegexCommand.cpp in Sources */,
2689008513353E2200698AC0 /* CommandReturnObject.cpp in Sources */,
6D95DC001B9DC057000E318A /* DIERef.cpp in Sources */,
3FDFE53519A29327009756A7 /* HostInfoBase.cpp in Sources */,
26474CBE18D0CB2D0073DEBA /* RegisterContextMach_i386.cpp in Sources */,
2689008613353E2200698AC0 /* Options.cpp in Sources */,
Expand Down Expand Up @@ -6487,6 +6502,7 @@
26744EF31338317700EF765A /* GDBRemoteCommunicationServer.cpp in Sources */,
264A97BF133918BC0017F0BE /* PlatformRemoteGDBServer.cpp in Sources */,
EB8375E71B553DE800BA907D /* ThreadPlanCallFunctionUsingABI.cpp in Sources */,
6D95DC011B9DC057000E318A /* HashedNameToDIE.cpp in Sources */,
2697A54D133A6305004E4240 /* PlatformDarwin.cpp in Sources */,
26651A18133BF9E0005B64B7 /* Opcode.cpp in Sources */,
3FDFED0B19B7C8DE009756A7 /* HostThreadMacOSX.mm in Sources */,
Expand Down
40 changes: 26 additions & 14 deletions lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,12 @@ ObjectFileELF::CreateSections(SectionList &unified_section_list)
static ConstString g_sect_name_dwarf_debug_ranges (".debug_ranges");
static ConstString g_sect_name_dwarf_debug_str (".debug_str");
static ConstString g_sect_name_dwarf_debug_str_offsets (".debug_str_offsets");
static ConstString g_sect_name_dwarf_debug_abbrev_dwo (".debug_abbrev.dwo");
static ConstString g_sect_name_dwarf_debug_info_dwo (".debug_info.dwo");
static ConstString g_sect_name_dwarf_debug_line_dwo (".debug_line.dwo");
static ConstString g_sect_name_dwarf_debug_loc_dwo (".debug_loc.dwo");
static ConstString g_sect_name_dwarf_debug_str_dwo (".debug_str.dwo");
static ConstString g_sect_name_dwarf_debug_str_offsets_dwo (".debug_str_offsets.dwo");
static ConstString g_sect_name_eh_frame (".eh_frame");

SectionType sect_type = eSectionTypeOther;
Expand Down Expand Up @@ -1717,20 +1723,26 @@ ObjectFileELF::CreateSections(SectionList &unified_section_list)
// MISSING? .gnu_debugdata - "mini debuginfo / MiniDebugInfo" section, http://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html
// MISSING? .debug-index - http://src.chromium.org/viewvc/chrome/trunk/src/build/gdb-add-index?pathrev=144644
// MISSING? .debug_types - Type descriptions from DWARF 4? See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo
else if (name == g_sect_name_dwarf_debug_abbrev) sect_type = eSectionTypeDWARFDebugAbbrev;
else if (name == g_sect_name_dwarf_debug_addr) sect_type = eSectionTypeDWARFDebugAddr;
else if (name == g_sect_name_dwarf_debug_aranges) sect_type = eSectionTypeDWARFDebugAranges;
else if (name == g_sect_name_dwarf_debug_frame) sect_type = eSectionTypeDWARFDebugFrame;
else if (name == g_sect_name_dwarf_debug_info) sect_type = eSectionTypeDWARFDebugInfo;
else if (name == g_sect_name_dwarf_debug_line) sect_type = eSectionTypeDWARFDebugLine;
else if (name == g_sect_name_dwarf_debug_loc) sect_type = eSectionTypeDWARFDebugLoc;
else if (name == g_sect_name_dwarf_debug_macinfo) sect_type = eSectionTypeDWARFDebugMacInfo;
else if (name == g_sect_name_dwarf_debug_pubnames) sect_type = eSectionTypeDWARFDebugPubNames;
else if (name == g_sect_name_dwarf_debug_pubtypes) sect_type = eSectionTypeDWARFDebugPubTypes;
else if (name == g_sect_name_dwarf_debug_ranges) sect_type = eSectionTypeDWARFDebugRanges;
else if (name == g_sect_name_dwarf_debug_str) sect_type = eSectionTypeDWARFDebugStr;
else if (name == g_sect_name_dwarf_debug_str_offsets) sect_type = eSectionTypeDWARFDebugStrOffsets;
else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame;
else if (name == g_sect_name_dwarf_debug_abbrev) sect_type = eSectionTypeDWARFDebugAbbrev;
else if (name == g_sect_name_dwarf_debug_addr) sect_type = eSectionTypeDWARFDebugAddr;
else if (name == g_sect_name_dwarf_debug_aranges) sect_type = eSectionTypeDWARFDebugAranges;
else if (name == g_sect_name_dwarf_debug_frame) sect_type = eSectionTypeDWARFDebugFrame;
else if (name == g_sect_name_dwarf_debug_info) sect_type = eSectionTypeDWARFDebugInfo;
else if (name == g_sect_name_dwarf_debug_line) sect_type = eSectionTypeDWARFDebugLine;
else if (name == g_sect_name_dwarf_debug_loc) sect_type = eSectionTypeDWARFDebugLoc;
else if (name == g_sect_name_dwarf_debug_macinfo) sect_type = eSectionTypeDWARFDebugMacInfo;
else if (name == g_sect_name_dwarf_debug_pubnames) sect_type = eSectionTypeDWARFDebugPubNames;
else if (name == g_sect_name_dwarf_debug_pubtypes) sect_type = eSectionTypeDWARFDebugPubTypes;
else if (name == g_sect_name_dwarf_debug_ranges) sect_type = eSectionTypeDWARFDebugRanges;
else if (name == g_sect_name_dwarf_debug_str) sect_type = eSectionTypeDWARFDebugStr;
else if (name == g_sect_name_dwarf_debug_str_offsets) sect_type = eSectionTypeDWARFDebugStrOffsets;
else if (name == g_sect_name_dwarf_debug_abbrev_dwo) sect_type = eSectionTypeDWARFDebugAbbrev;
else if (name == g_sect_name_dwarf_debug_info_dwo) sect_type = eSectionTypeDWARFDebugInfo;
else if (name == g_sect_name_dwarf_debug_line_dwo) sect_type = eSectionTypeDWARFDebugLine;
else if (name == g_sect_name_dwarf_debug_loc_dwo) sect_type = eSectionTypeDWARFDebugLoc;
else if (name == g_sect_name_dwarf_debug_str_dwo) sect_type = eSectionTypeDWARFDebugStr;
else if (name == g_sect_name_dwarf_debug_str_offsets_dwo) sect_type = eSectionTypeDWARFDebugStrOffsets;
else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame;

switch (header.sh_type)
{
Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_lldb_library(lldbPluginSymbolFileDWARF
DIERef.cpp
DWARFAbbreviationDeclaration.cpp
DWARFASTParserClang.cpp
DWARFAttribute.cpp
Expand Down Expand Up @@ -26,6 +27,7 @@ add_lldb_library(lldbPluginSymbolFileDWARF
LogChannelDWARF.cpp
NameToDIE.cpp
SymbolFileDWARF.cpp
SymbolFileDWARFDwo.cpp
SymbolFileDWARFDebugMap.cpp
UniqueDWARFASTType.cpp
)
56 changes: 56 additions & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//===-- DIERef.cpp ----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "DIERef.h"
#include "DWARFCompileUnit.h"
#include "DWARFFormValue.h"

DIERef::DIERef() :
cu_offset(DW_INVALID_OFFSET),
die_offset(DW_INVALID_OFFSET)
{}

DIERef::DIERef(dw_offset_t d) :
cu_offset(DW_INVALID_OFFSET),
die_offset(d)
{}

DIERef::DIERef(dw_offset_t c, dw_offset_t d) :
cu_offset(c),
die_offset(d)
{}

DIERef::DIERef(lldb::user_id_t uid) :
cu_offset(uid>>32),
die_offset(uid&0xffffffff)
{}

DIERef::DIERef(const DWARFFormValue& form_value) :
cu_offset(DW_INVALID_OFFSET),
die_offset(DW_INVALID_OFFSET)
{
if (form_value.IsValid())
{
const DWARFCompileUnit* dwarf_cu = form_value.GetCompileUnit();
if (dwarf_cu)
{
if (dwarf_cu->GetBaseObjOffset() != DW_INVALID_OFFSET)
cu_offset = dwarf_cu->GetBaseObjOffset();
else
cu_offset = dwarf_cu->GetOffset();
}
die_offset = form_value.Reference();
}
}

lldb::user_id_t
DIERef::GetUID() const
{
return ((lldb::user_id_t)cu_offset) << 32 | die_offset;
}
42 changes: 42 additions & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//===-- DIERef.h ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef SymbolFileDWARF_DIERef_h_
#define SymbolFileDWARF_DIERef_h_

#include "lldb/Core/dwarf.h"
#include "lldb/lldb-defines.h"

class DWARFFormValue;

struct DIERef
{
DIERef();

explicit
DIERef(dw_offset_t d);

DIERef(dw_offset_t c, dw_offset_t d);

explicit
DIERef(lldb::user_id_t uid);

explicit
DIERef(const DWARFFormValue& form_value);

lldb::user_id_t
GetUID() const;

dw_offset_t cu_offset;
dw_offset_t die_offset;
};

typedef std::vector<DIERef> DIEArray;

#endif // SymbolFileDWARF_DIERef_h_
Loading

0 comments on commit eb882fc

Please sign in to comment.