[Lldb-commits] [lldb] r331148 - Support reading section ".gnu_debugaltlink"

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 29 12:47:48 PDT 2018


Author: jankratochvil
Date: Sun Apr 29 12:47:48 2018
New Revision: 331148

URL: http://llvm.org/viewvc/llvm-project?rev=331148&view=rev
Log:
Support reading section ".gnu_debugaltlink"

Differential revision: https://reviews.llvm.org/D40468

Added:
    lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml
Modified:
    lldb/trunk/include/lldb/Core/Section.h
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/lit/Modules/build-id-case.yaml
    lldb/trunk/lit/Modules/compressed-sections.yaml
    lldb/trunk/source/Core/Section.cpp
    lldb/trunk/source/Expression/IRExecutionUnit.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
    lldb/trunk/source/Symbol/ObjectFile.cpp
    lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Core/Section.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Section.h?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Section.h (original)
+++ lldb/trunk/include/lldb/Core/Section.h Sun Apr 29 12:47:48 2018
@@ -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; }

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Sun Apr 29 12:47:48 2018
@@ -656,6 +656,7 @@ enum SectionType {
   eSectionTypeGoSymtab,
   eSectionTypeAbsoluteAddress, // Dummy section for symbols with absolute
                                // address
+  eSectionTypeDWARFGNUDebugAltLink,
   eSectionTypeOther
 };
 

Modified: lldb/trunk/lit/Modules/build-id-case.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/build-id-case.yaml?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/lit/Modules/build-id-case.yaml (original)
+++ lldb/trunk/lit/Modules/build-id-case.yaml Sun Apr 29 12:47:48 2018
@@ -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
 

Modified: lldb/trunk/lit/Modules/compressed-sections.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/compressed-sections.yaml?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/lit/Modules/compressed-sections.yaml (original)
+++ lldb/trunk/lit/Modules/compressed-sections.yaml Sun Apr 29 12:47:48 2018
@@ -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:

Added: lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml?rev=331148&view=auto
==============================================================================
--- lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml (added)
+++ lldb/trunk/lit/Modules/dwarf-gnu-debugaltlink.yaml Sun Apr 29 12:47:48 2018
@@ -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
+...

Modified: lldb/trunk/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Core/Section.cpp (original)
+++ lldb/trunk/source/Core/Section.cpp Sun Apr 29 12:47:48 2018
@@ -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 *GetSectionTypeAsCStri
     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, c
 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;
 

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Sun Apr 29 12:47:48 2018
@@ -1100,6 +1100,7 @@ bool IRExecutionUnit::CommitOneAllocatio
   case lldb::eSectionTypeDWARFAppleTypes:
   case lldb::eSectionTypeDWARFAppleNamespaces:
   case lldb::eSectionTypeDWARFAppleObjC:
+  case lldb::eSectionTypeDWARFGNUDebugAltLink:
     error.Clear();
     break;
   default:

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Sun Apr 29 12:47:48 2018
@@ -1823,6 +1823,7 @@ void ObjectFileELF::CreateSections(Secti
       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(Secti
         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) |

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Sun Apr 29 12:47:48 2018
@@ -1212,6 +1212,7 @@ AddressClass ObjectFileMachO::GetAddress
           case eSectionTypeDWARFAppleTypes:
           case eSectionTypeDWARFAppleNamespaces:
           case eSectionTypeDWARFAppleObjC:
+          case eSectionTypeDWARFGNUDebugAltLink:
             return eAddressClassDebug;
 
           case eSectionTypeEHFrame:

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sun Apr 29 12:47:48 2018
@@ -682,6 +682,11 @@ const DWARFDataExtractor &SymbolFileDWAR
   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();

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Sun Apr 29 12:47:48 2018
@@ -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

Modified: lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp Sun Apr 29 12:47:48 2018
@@ -134,7 +134,7 @@ SymbolVendorELF::CreateInstance(const ll
               eSectionTypeDWARFDebugMacInfo,  eSectionTypeDWARFDebugPubNames,
               eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges,
               eSectionTypeDWARFDebugStr,      eSectionTypeDWARFDebugStrOffsets,
-              eSectionTypeELFSymbolTable,
+              eSectionTypeELFSymbolTable,     eSectionTypeDWARFGNUDebugAltLink,
           };
           for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]);
                ++idx) {

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Sun Apr 29 12:47:48 2018
@@ -363,6 +363,7 @@ AddressClass ObjectFile::GetAddressClass
           case eSectionTypeDWARFAppleTypes:
           case eSectionTypeDWARFAppleNamespaces:
           case eSectionTypeDWARFAppleObjC:
+          case eSectionTypeDWARFGNUDebugAltLink:
             return eAddressClassDebug;
           case eSectionTypeEHFrame:
           case eSectionTypeARMexidx:

Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=331148&r1=331147&r2=331148&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-test/lldb-test.cpp (original)
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp Sun Apr 29 12:47:48 2018
@@ -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());
 




More information about the lldb-commits mailing list