summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2018-04-29 19:47:48 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2018-04-29 19:47:48 +0000
commite4777a9df5c28a42476c7eea7901ddf52498948e (patch)
treef9c0204b1cfebb4d12906b878ce5c0c9a1fc4566
parent288c73e7be40be735b98a548983b4b58aa770e27 (diff)
downloadbcm5719-llvm-e4777a9df5c28a42476c7eea7901ddf52498948e.tar.gz
bcm5719-llvm-e4777a9df5c28a42476c7eea7901ddf52498948e.zip
Support reading section ".gnu_debugaltlink"
Differential revision: https://reviews.llvm.org/D40468 llvm-svn: 331148
-rw-r--r--lldb/include/lldb/Core/Section.h2
-rw-r--r--lldb/include/lldb/lldb-enumerations.h1
-rw-r--r--lldb/lit/Modules/build-id-case.yaml1
-rw-r--r--lldb/lit/Modules/compressed-sections.yaml2
-rw-r--r--lldb/lit/Modules/dwarf-gnu-debugaltlink.yaml25
-rw-r--r--lldb/source/Core/Section.cpp9
-rw-r--r--lldb/source/Expression/IRExecutionUnit.cpp1
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp3
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp1
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp5
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h2
-rw-r--r--lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp2
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp1
-rw-r--r--lldb/tools/lldb-test/lldb-test.cpp1
14 files changed, 51 insertions, 5 deletions
diff --git a/lldb/include/lldb/Core/Section.h b/lldb/include/lldb/Core/Section.h
index 2d5d6443ba7..9b6674f0748 100644
--- a/lldb/include/lldb/Core/Section.h
+++ b/lldb/include/lldb/Core/Section.h
@@ -182,6 +182,8 @@ public:
lldb::SectionType GetType() const { return m_type; }
+ const char *GetTypeAsCString() const;
+
lldb::SectionSP GetParent() const { return m_parent_wp.lock(); }
bool IsThreadSpecific() const { return m_thread_specific; }
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 760e12b0e79..62e05c5546b 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -656,6 +656,7 @@ enum SectionType {
eSectionTypeGoSymtab,
eSectionTypeAbsoluteAddress, // Dummy section for symbols with absolute
// address
+ eSectionTypeDWARFGNUDebugAltLink,
eSectionTypeOther
};
diff --git a/lldb/lit/Modules/build-id-case.yaml b/lldb/lit/Modules/build-id-case.yaml
index 8db60043196..bbad5125967 100644
--- a/lldb/lit/Modules/build-id-case.yaml
+++ b/lldb/lit/Modules/build-id-case.yaml
@@ -5,6 +5,7 @@
# RUN: lldb-test module-sections %t/stripped.out | FileCheck %s
# CHECK: Name: .debug_frame
+# CHECK-NEXT: Type: dwarf-frame
# CHECK-NEXT: VM size: 0
# CHECK-NEXT: File size: 8
diff --git a/lldb/lit/Modules/compressed-sections.yaml b/lldb/lit/Modules/compressed-sections.yaml
index 0eabd99f2d6..db189248221 100644
--- a/lldb/lit/Modules/compressed-sections.yaml
+++ b/lldb/lit/Modules/compressed-sections.yaml
@@ -18,12 +18,14 @@ Sections:
Content: deadbeefbaadf00d
# CHECK: Name: .hello_elf
+# CHECK-NEXT: Type: regular
# CHECK-NEXT: VM size: 0
# CHECK-NEXT: File size: 28
# CHECK-NEXT: Data:
# CHECK-NEXT: 20304050 60708090
# CHECK: Name: .bogus
+# CHECK-NEXT: Type: regular
# CHECK-NEXT: VM size: 0
# CHECK-NEXT: File size: 8
# CHECK-NEXT: Data:
diff --git a/lldb/lit/Modules/dwarf-gnu-debugaltlink.yaml b/lldb/lit/Modules/dwarf-gnu-debugaltlink.yaml
new file mode 100644
index 00000000000..65f8cc7a3a3
--- /dev/null
+++ b/lldb/lit/Modules/dwarf-gnu-debugaltlink.yaml
@@ -0,0 +1,25 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test module-sections %t | FileCheck %s
+
+# CHECK: Name: .gnu_debugaltlink
+# CHECK-NEXT: Type: dwarf-gnu-debugaltlink
+# CHECK-NEXT: VM size: 0
+# CHECK-NEXT: File size: 8
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+ Entry: 0x00000000000007A0
+Sections:
+ - Name: .debug_info
+ Type: SHT_PROGBITS
+ AddressAlign: 0x0000000000000001
+ Content: DEADBEEFBAADF00D
+ - Name: .gnu_debugaltlink
+ Type: SHT_PROGBITS
+ AddressAlign: 0x0000000000000001
+ Content: DEADBEEFBAADF00D
+...
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 635b3218673..3ce051e0e98 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -27,8 +27,8 @@ class DataExtractor;
using namespace lldb;
using namespace lldb_private;
-static const char *GetSectionTypeAsCString(lldb::SectionType sect_type) {
- switch (sect_type) {
+const char *Section::GetTypeAsCString() const {
+ switch (m_type) {
case eSectionTypeInvalid:
return "invalid";
case eSectionTypeCode:
@@ -117,6 +117,8 @@ static const char *GetSectionTypeAsCString(lldb::SectionType sect_type) {
return "go-symtab";
case eSectionTypeAbsoluteAddress:
return "absolute";
+ case eSectionTypeDWARFGNUDebugAltLink:
+ return "dwarf-gnu-debugaltlink";
case eSectionTypeOther:
return "regular";
}
@@ -283,8 +285,7 @@ int Section::Compare(const Section &a, const Section &b) {
void Section::Dump(Stream *s, Target *target, uint32_t depth) const {
// s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent();
- s->Printf("0x%8.8" PRIx64 " %-16s ", GetID(),
- GetSectionTypeAsCString(m_type));
+ s->Printf("0x%8.8" PRIx64 " %-16s ", GetID(), GetTypeAsCString());
bool resolved = true;
addr_t addr = LLDB_INVALID_ADDRESS;
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index ce88708c179..d5e5bf86a4c 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -1100,6 +1100,7 @@ bool IRExecutionUnit::CommitOneAllocation(lldb::ProcessSP &process_sp,
case lldb::eSectionTypeDWARFAppleTypes:
case lldb::eSectionTypeDWARFAppleNamespaces:
case lldb::eSectionTypeDWARFAppleObjC:
+ case lldb::eSectionTypeDWARFGNUDebugAltLink:
error.Clear();
break;
default:
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 3827995b832..a5f577f653c 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1823,6 +1823,7 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
static ConstString g_sect_name_arm_exidx(".ARM.exidx");
static ConstString g_sect_name_arm_extab(".ARM.extab");
static ConstString g_sect_name_go_symtab(".gosymtab");
+ static ConstString g_sect_name_dwarf_gnu_debugaltlink(".gnu_debugaltlink");
SectionType sect_type = eSectionTypeOther;
@@ -1913,6 +1914,8 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
sect_type = eSectionTypeARMextab;
else if (name == g_sect_name_go_symtab)
sect_type = eSectionTypeGoSymtab;
+ else if (name == g_sect_name_dwarf_gnu_debugaltlink)
+ sect_type = eSectionTypeDWARFGNUDebugAltLink;
const uint32_t permissions =
((header.sh_flags & SHF_ALLOC) ? ePermissionsReadable : 0u) |
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 7364fbd1779..b2fa02591ab 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1212,6 +1212,7 @@ AddressClass ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) {
case eSectionTypeDWARFAppleTypes:
case eSectionTypeDWARFAppleNamespaces:
case eSectionTypeDWARFAppleObjC:
+ case eSectionTypeDWARFGNUDebugAltLink:
return eAddressClassDebug;
case eSectionTypeEHFrame:
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 1385aa35708..bfcae5bf625 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -682,6 +682,11 @@ const DWARFDataExtractor &SymbolFileDWARF::get_apple_objc_data() {
return GetCachedSectionData(eSectionTypeDWARFAppleObjC, m_data_apple_objc);
}
+const DWARFDataExtractor &SymbolFileDWARF::get_gnu_debugaltlink() {
+ return GetCachedSectionData(eSectionTypeDWARFGNUDebugAltLink,
+ m_data_gnu_debugaltlink);
+}
+
DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
if (m_abbr.get() == NULL) {
const DWARFDataExtractor &debug_abbrev_data = get_debug_abbrev_data();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 148facd93c0..939222f690d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -250,6 +250,7 @@ public:
const lldb_private::DWARFDataExtractor &get_apple_types_data();
const lldb_private::DWARFDataExtractor &get_apple_namespaces_data();
const lldb_private::DWARFDataExtractor &get_apple_objc_data();
+ const lldb_private::DWARFDataExtractor &get_gnu_debugaltlink();
DWARFDebugAbbrev *DebugAbbrev();
@@ -495,6 +496,7 @@ protected:
DWARFDataSegment m_data_apple_types;
DWARFDataSegment m_data_apple_namespaces;
DWARFDataSegment m_data_apple_objc;
+ DWARFDataSegment m_data_gnu_debugaltlink;
// The unique pointer items below are generated on demand if and when someone
// accesses
diff --git a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
index a25119684c2..d2fadd833bb 100644
--- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
+++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
@@ -134,7 +134,7 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames,
eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges,
eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugStrOffsets,
- eSectionTypeELFSymbolTable,
+ eSectionTypeELFSymbolTable, eSectionTypeDWARFGNUDebugAltLink,
};
for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]);
++idx) {
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index a0cd94a45bc..9210b75d3d0 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -363,6 +363,7 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) {
case eSectionTypeDWARFAppleTypes:
case eSectionTypeDWARFAppleNamespaces:
case eSectionTypeDWARFAppleObjC:
+ case eSectionTypeDWARFGNUDebugAltLink:
return eAddressClassDebug;
case eSectionTypeEHFrame:
case eSectionTypeARMexidx:
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp
index 3d17ed8e2fb..3c55aa72800 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -213,6 +213,7 @@ static void dumpModules(Debugger &Dbg) {
assert(S);
Printer.formatLine("Index: {0}", I);
Printer.formatLine("Name: {0}", S->GetName().GetStringRef());
+ Printer.formatLine("Type: {0}", S->GetTypeAsCString());
Printer.formatLine("VM size: {0}", S->GetByteSize());
Printer.formatLine("File size: {0}", S->GetFileSize());
OpenPOWER on IntegriCloud