[llvm] r282238 - Revert r282235 "[llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section."

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 23 03:12:57 PDT 2016


Author: grimar
Date: Fri Sep 23 05:12:56 2016
New Revision: 282238

URL: http://llvm.org/viewvc/llvm-project?rev=282238&view=rev
Log:
Revert r282235 "[llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section."

It broke BB:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15856

Removed:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
    llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
    llvm/trunk/test/DebugInfo/Inputs/dwarfdump-gdbindex-v7.elf-x86-64
    llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test
Modified:
    llvm/trunk/include/llvm/DebugInfo/DIContext.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
    llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt
    llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
    llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=282238&r1=282237&r2=282238&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Fri Sep 23 05:12:56 2016
@@ -124,7 +124,6 @@ enum DIDumpType {
   DIDT_AppleNamespaces,
   DIDT_AppleObjC,
   DIDT_CUIndex,
-  DIDT_GdbIndex,
   DIDT_TUIndex,
 };
 

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h?rev=282238&r1=282237&r2=282238&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Fri Sep 23 05:12:56 2016
@@ -20,7 +20,6 @@
 #include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
-#include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
 #include "llvm/DebugInfo/DWARF/DWARFSection.h"
 #include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
 
@@ -42,7 +41,6 @@ class DWARFContext : public DIContext {
   DWARFUnitSection<DWARFCompileUnit> CUs;
   std::deque<DWARFUnitSection<DWARFTypeUnit>> TUs;
   std::unique_ptr<DWARFUnitIndex> CUIndex;
-  std::unique_ptr<DWARFGdbIndex> GdbIndex;
   std::unique_ptr<DWARFUnitIndex> TUIndex;
   std::unique_ptr<DWARFDebugAbbrev> Abbrev;
   std::unique_ptr<DWARFDebugLoc> Loc;
@@ -151,7 +149,6 @@ public:
   }
 
   const DWARFUnitIndex &getCUIndex();
-  DWARFGdbIndex &getGdbIndex();
   const DWARFUnitIndex &getTUIndex();
 
   /// Get a pointer to the parsed DebugAbbrev object.
@@ -223,7 +220,6 @@ public:
   virtual const DWARFSection& getAppleNamespacesSection() = 0;
   virtual const DWARFSection& getAppleObjCSection() = 0;
   virtual StringRef getCUIndexSection() = 0;
-  virtual StringRef getGdbIndexSection() = 0;
   virtual StringRef getTUIndexSection() = 0;
 
   static bool isSupportedVersion(unsigned version) {
@@ -276,7 +272,6 @@ class DWARFContextInMemory : public DWAR
   DWARFSection AppleNamespacesSection;
   DWARFSection AppleObjCSection;
   StringRef CUIndexSection;
-  StringRef GdbIndexSection;
   StringRef TUIndexSection;
 
   SmallVector<SmallString<32>, 4> UncompressedSections;
@@ -323,7 +318,6 @@ public:
     return AddrSection;
   }
   StringRef getCUIndexSection() override { return CUIndexSection; }
-  StringRef getGdbIndexSection() override { return GdbIndexSection; }
   StringRef getTUIndexSection() override { return TUIndexSection; }
 };
 

Removed: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h?rev=282237&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h (removed)
@@ -1,68 +0,0 @@
-//===-- DWARFGdbIndex.h -----------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIB_DEBUGINFO_DWARFGDBINDEX_H
-#define LLVM_LIB_DEBUGINFO_DWARFGDBINDEX_H
-
-#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Error.h"
-#include "llvm/Support/raw_ostream.h"
-
-namespace llvm {
-class DWARFGdbIndex {
-  uint32_t Version;
-
-  uint32_t CuListOffset;
-  uint32_t AddressAreaOffset;
-  uint32_t SymbolTableOffset;
-  uint32_t ConstantPoolOffset;
-
-  struct CompUnitEntry {
-    uint64_t Offset; // Offset of a CU in the .debug_info section.
-    uint64_t Length; // Length of that CU.
-  };
-  SmallVector<CompUnitEntry, 0> CuList;
-
-  struct AddressEntry {
-    uint64_t LowAddress;  // The low address.
-    uint64_t HighAddress; // The high address.
-    uint32_t CuIndex;     // The CU index.
-  };
-  SmallVector<AddressEntry, 0> AddressArea;
-
-  struct SymTableEntry {
-    uint32_t NameOffset; // Offset of the symbol's name in the constant pool.
-    uint32_t VecOffset;  // Offset of the CU vector in the constant pool.
-  };
-  SmallVector<SymTableEntry, 0> SymbolTable;
-
-  // Each value is CU index + attributes.
-  SmallVector<std::pair<uint32_t, SmallVector<uint32_t, 0>>, 0>
-      ConstantPoolVectors;
-
-  StringRef ConstantPoolStrings;
-  uint32_t StringPoolOffset;
-
-  void dumpCUList(raw_ostream &OS) const;
-  void dumpAddressArea(raw_ostream &OS) const;
-  void dumpSymbolTable(raw_ostream &OS) const;
-  void dumpConstantPool(raw_ostream &OS) const;
-
-  bool parseImpl(DataExtractor Data);
-
-public:
-  void dump(raw_ostream &OS);
-  void parse(DataExtractor Data);
-
-  bool HasContent = false;
-  bool HasError = false;
-};
-}
-
-#endif // LLVM_LIB_DEBUGINFO_DWARFGDBINDEX_H

Modified: llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt?rev=282238&r1=282237&r2=282238&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/CMakeLists.txt Fri Sep 23 05:12:56 2016
@@ -13,7 +13,6 @@ add_llvm_library(LLVMDebugInfoDWARF
   DWARFDebugMacro.cpp
   DWARFDebugRangeList.cpp
   DWARFFormValue.cpp
-  DWARFGdbIndex.cpp
   DWARFTypeUnit.cpp
   DWARFUnitIndex.cpp
   DWARFUnit.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=282238&r1=282237&r2=282238&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Fri Sep 23 05:12:56 2016
@@ -256,12 +256,6 @@ void DWARFContext::dump(raw_ostream &OS,
     }
   }
 
-  if ((DumpType == DIDT_All || DumpType == DIDT_GdbIndex) &&
-      !getGdbIndexSection().empty()) {
-    OS << "\n.gnu_index contents:\n";
-    getGdbIndex().dump(OS);
-  }
-
   if (DumpType == DIDT_All || DumpType == DIDT_AppleNames)
     dumpAccelSection(OS, "apple_names", getAppleNamesSection(),
                      getStringSection(), isLittleEndian());
@@ -301,16 +295,6 @@ const DWARFUnitIndex &DWARFContext::getT
   return *TUIndex;
 }
 
-DWARFGdbIndex &DWARFContext::getGdbIndex() {
-  if (GdbIndex)
-    return *GdbIndex;
-
-  DataExtractor GdbIndexData(getGdbIndexSection(), true /*LE*/, 0);
-  GdbIndex = llvm::make_unique<DWARFGdbIndex>();
-  GdbIndex->parse(GdbIndexData);
-  return *GdbIndex;
-}
-
 const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() {
   if (Abbrev)
     return Abbrev.get();
@@ -734,7 +718,6 @@ DWARFContextInMemory::DWARFContextInMemo
             .Case("apple_objc", &AppleObjCSection.Data)
             .Case("debug_cu_index", &CUIndexSection)
             .Case("debug_tu_index", &TUIndexSection)
-            .Case("gdb_index", &GdbIndexSection)
             // Any more debug info sections go here.
             .Default(nullptr);
     if (SectionData) {

Removed: llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp?rev=282237&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp (removed)
@@ -1,175 +0,0 @@
-//===-- DWARFGdbIndex.cpp -------------------------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
-#include "llvm/ADT/Twine.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/Format.h"
-
-using namespace llvm;
-
-// .gdb_index section format reference:
-// https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html
-
-void DWARFGdbIndex::dumpCUList(raw_ostream &OS) const {
-  OS << format("\n  CU list offset = 0x%x, has %zu entries:", CuListOffset,
-               CuList.size())
-     << '\n';
-  uint32_t I = 0;
-  for (const CompUnitEntry &CU : CuList)
-    OS << format("    %d: Offset = 0x%llx, Length = 0x%llx\n", I++, CU.Offset,
-                 CU.Length);
-}
-
-void DWARFGdbIndex::dumpAddressArea(raw_ostream &OS) const {
-  OS << format("\n  Address area offset = 0x%x, has %zu entries:",
-               AddressAreaOffset, AddressArea.size())
-     << '\n';
-  for (const AddressEntry &Addr : AddressArea)
-    OS << format(
-        "    Low address = 0x%llx, High address = 0x%llx, CU index = %d\n",
-        Addr.LowAddress, Addr.HighAddress, Addr.CuIndex);
-}
-
-void DWARFGdbIndex::dumpSymbolTable(raw_ostream &OS) const {
-  OS << format("\n  Symbol table offset = 0x%x, size = %zu, filled slots:",
-               SymbolTableOffset, SymbolTable.size())
-     << '\n';
-  uint32_t I = -1;
-  for (const SymTableEntry &E : SymbolTable) {
-    ++I;
-    if (!E.NameOffset && !E.VecOffset)
-      continue;
-
-    OS << format("    %d: Name offset = 0x%x, CU vector offset = 0x%x\n", I,
-                 E.NameOffset, E.VecOffset);
-
-    StringRef Name = ConstantPoolStrings.substr(
-        ConstantPoolOffset - StringPoolOffset + E.NameOffset);
-
-    auto CuVector = std::find_if(
-        ConstantPoolVectors.begin(), ConstantPoolVectors.end(),
-        [&](const std::pair<uint32_t, SmallVector<uint32_t, 0>> &V) {
-          return V.first == E.VecOffset;
-        });
-    assert(CuVector != ConstantPoolVectors.end() && "Invalid symbol table");
-    uint32_t CuVectorId = CuVector - ConstantPoolVectors.begin();
-    OS << format("      String name: %s, CU vector index: %d\n", Name.data(),
-                 CuVectorId);
-  }
-}
-
-void DWARFGdbIndex::dumpConstantPool(raw_ostream &OS) const {
-  OS << format("\n  Constant pool offset = 0x%x, has %zu CU vectors:",
-               ConstantPoolOffset, ConstantPoolVectors.size());
-  uint32_t I = 0;
-  for (const auto &V : ConstantPoolVectors) {
-    OS << format("\n    %d(0x%x): ", I++, V.first);
-    for (uint32_t Val : V.second)
-      OS << format("0x%x ", Val);
-  }
-  OS << '\n';
-}
-
-void DWARFGdbIndex::dump(raw_ostream &OS) {
-  if (HasError) {
-    OS << "\n<error parsing>\n";
-    return;
-  }
-
-  if (HasContent) {
-    OS << "  Version = " << Version << '\n';
-    dumpCUList(OS);
-    dumpAddressArea(OS);
-    dumpSymbolTable(OS);
-    dumpConstantPool(OS);
-  }
-}
-
-bool DWARFGdbIndex::parseImpl(DataExtractor Data) {
-  uint32_t Offset = 0;
-
-  // Only version 7 is supported at this moment.
-  Version = Data.getU32(&Offset);
-  if (Version != 7)
-    return false;
-
-  CuListOffset = Data.getU32(&Offset);
-  uint32_t CuTypesOffset = Data.getU32(&Offset);
-  AddressAreaOffset = Data.getU32(&Offset);
-  SymbolTableOffset = Data.getU32(&Offset);
-  ConstantPoolOffset = Data.getU32(&Offset);
-
-  if (Offset != CuListOffset)
-    return false;
-
-  uint32_t CuListSize = (CuTypesOffset - CuListOffset) / 16;
-  CuList.reserve(CuListSize);
-  for (uint32_t i = 0; i < CuListSize; ++i) {
-    uint64_t CuOffset = Data.getU64(&Offset);
-    uint64_t CuLength = Data.getU64(&Offset);
-    CuList.push_back({CuOffset, CuLength});
-  }
-
-  // CU Types are no longer needed as DWARF skeleton type units never made it
-  // into the standard.
-  uint32_t CuTypesListSize = (AddressAreaOffset - CuTypesOffset) / 24;
-  if (CuTypesListSize != 0)
-    return false;
-
-  uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20;
-  AddressArea.reserve(AddressAreaSize);
-  for (uint32_t i = 0; i < AddressAreaSize; ++i) {
-    uint64_t LowAddress = Data.getU64(&Offset);
-    uint64_t HighAddress = Data.getU64(&Offset);
-    uint32_t CuIndex = Data.getU32(&Offset);
-    AddressArea.push_back({LowAddress, HighAddress, CuIndex});
-  }
-
-  // The symbol table. This is an open addressed hash table. The size of the
-  // hash table is always a power of 2.
-  // Each slot in the hash table consists of a pair of offset_type values. The
-  // first value is the offset of the symbol's name in the constant pool. The
-  // second value is the offset of the CU vector in the constant pool.
-  // If both values are 0, then this slot in the hash table is empty. This is ok
-  // because while 0 is a valid constant pool index, it cannot be a valid index
-  // for both a string and a CU vector.
-  uint32_t SymTableSize = (ConstantPoolOffset - SymbolTableOffset) / 8;
-  SymbolTable.reserve(SymTableSize);
-  uint32_t CuVectorsTotal = 0;
-  for (uint32_t i = 0; i < SymTableSize; ++i) {
-    uint32_t NameOffset = Data.getU32(&Offset);
-    uint32_t CuVecOffset = Data.getU32(&Offset);
-    SymbolTable.push_back({NameOffset, CuVecOffset});
-    if (NameOffset || CuVecOffset)
-      ++CuVectorsTotal;
-  }
-
-  // The constant pool. CU vectors are stored first, followed by strings.
-  // The first value is the number of CU indices in the vector. Each subsequent
-  // value is the index and symbol attributes of a CU in the CU list.
-  for (uint32_t i = 0; i < CuVectorsTotal; ++i) {
-    ConstantPoolVectors.emplace_back(0, SmallVector<uint32_t, 0>());
-    auto &Vec = ConstantPoolVectors.back();
-    Vec.first = Offset - ConstantPoolOffset;
-
-    uint32_t Num = Data.getU32(&Offset);
-    for (uint32_t j = 0; j < Num; ++j)
-      Vec.second.push_back(Data.getU32(&Offset));
-  }
-
-  ConstantPoolStrings = Data.getData().drop_front(Offset);
-  StringPoolOffset = Offset;
-  return true;
-}
-
-void DWARFGdbIndex::parse(DataExtractor Data) {
-  HasContent = !Data.getData().empty();
-  HasError = HasContent && !parseImpl(Data);
-}

Removed: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-gdbindex-v7.elf-x86-64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-gdbindex-v7.elf-x86-64?rev=282237&view=auto
==============================================================================
Binary file - no diff available.

Removed: llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test?rev=282237&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test (removed)
@@ -1,35 +0,0 @@
-RUN: llvm-dwarfdump -debug-dump=gdb_index %p/Inputs/dwarfdump-gdbindex-v7.elf-x86-64 | FileCheck %s
-
-; test.cpp:
-; int main() { return 0; }
-; test2.cpp:
-; int main2() { return 0; }
-; Compiled with:
-; gcc -gsplit-dwarf -c test.cpp test2.cpp
-; gold --gdb-index test.o test2.o -o dwarfdump-gdbindex-v7.elf-x86-64
-; gcc version 5.3.1 20160413, GNU gold (GNU Binutils for Ubuntu 2.26) 1.11
-; Info about gdb-index: https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html
-
-; CHECK-LABEL: .gnu_index contents:
-; CHECK: Version = 7
-
-; CHECK:      CU list offset = 0x18, has 2 entries:
-; CHECK-NEXT:   0: Offset = 0x0, Length = 0x34
-; CHECK-NEXT:   1: Offset = 0x34, Length = 0x34
-
-; CHECK:      Address area offset = 0x38, has 2 entries:
-; CHECK-NEXT:   Low address = 0x4000e8, High address = 0x4000f3, CU index = 0
-; CHECK-NEXT:   Low address = 0x4000f3, High address = 0x4000fe, CU index = 1
-
-; CHECK:      Symbol table offset = 0x60, size = 1024, filled slots:
-; CHECK-NEXT:   489: Name offset = 0x1d, CU vector offset = 0x0
-; CHECK-NEXT:     String name: main, CU vector index: 0
-; CHECK-NEXT:   754: Name offset = 0x22, CU vector offset = 0x8
-; CHECK-NEXT:     String name: int, CU vector index: 1
-; CHECK-NEXT:   956: Name offset = 0x26, CU vector offset = 0x14
-; CHECK-NEXT:     String name: main2, CU vector index: 2
-
-; CHECK:      Constant pool offset = 0x2060, has 3 CU vectors:
-; CHECK-NEXT:   0(0x0): 0x30000000 
-; CHECK-NEXT:   1(0x8): 0x90000000 0x90000001
-; CHECK-NEXT:   2(0x14): 0x30000001

Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=282238&r1=282237&r2=282238&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Fri Sep 23 05:12:56 2016
@@ -71,7 +71,6 @@ static cl::opt<DIDumpType> DumpType(
         clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo",
                    ".debug_str_offsets.dwo"),
         clEnumValN(DIDT_CUIndex, "cu_index", ".debug_cu_index"),
-        clEnumValN(DIDT_GdbIndex, "gdb_index", ".gdb_index"),
         clEnumValN(DIDT_TUIndex, "tu_index", ".debug_tu_index"), clEnumValEnd));
 
 static void error(StringRef Filename, std::error_code EC) {




More information about the llvm-commits mailing list