<div dir="ltr"><div>Nothing critical, just a few comments as I skimmed through the code.</div><div><br></div>Is it OK that new files (DWARFAcceleratorTable.(h|cpp)) are missing LLVM copyright headers?<div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 14, 2014 at 8:15 AM, Frederic Riss <span dir="ltr"><<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: friss<br>
Date: Fri Nov 14 10:15:53 2014<br>
New Revision: 222003<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=222003&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=222003&view=rev</a><br>
Log:<br>
Reapply "[dwarfdump] Add support for dumping accelerator tables."<br>
<br>
This reverts commit r221842 which was a revert of r221836 and of the<br>
test parts of r221837.<br>
<br>
This new version fixes an UB bug pointed out by David (along with<br>
addressing some other review comments), makes some dumping more<br>
resilient to broken input data and forces the accelerator tables<br>
to be dumped in the tests where we use them (this decision is<br>
platform specific otherwise).<br>
<br>
Added:<br>
    llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp<br>
    llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h<br>
    llvm/trunk/test/DebugInfo/dwarfdump-accel.test<br>
Modified:<br>
    llvm/trunk/include/llvm/DebugInfo/DIContext.h<br>
    llvm/trunk/lib/DebugInfo/CMakeLists.txt<br>
    llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
    llvm/trunk/lib/DebugInfo/DWARFContext.h<br>
    llvm/trunk/test/DebugInfo/Inputs/gmlt.ll<br>
    llvm/trunk/test/DebugInfo/cross-cu-inlining.ll<br>
    llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=222003&r1=222002&r2=222003&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=222003&r1=222002&r2=222003&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)<br>
+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Fri Nov 14 10:15:53 2014<br>
@@ -107,7 +107,11 @@ enum DIDumpType {<br>
   DIDT_GnuPubtypes,<br>
   DIDT_Str,<br>
   DIDT_StrDwo,<br>
-  DIDT_StrOffsetsDwo<br>
+  DIDT_StrOffsetsDwo,<br>
+  DIDT_AppleNames,<br>
+  DIDT_AppleTypes,<br>
+  DIDT_AppleNamespaces,<br>
+  DIDT_AppleObjC<br>
 };<br>
<br>
 // In place of applying the relocations to the data we've read from disk we use<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CMakeLists.txt?rev=222003&r1=222002&r2=222003&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CMakeLists.txt?rev=222003&r1=222002&r2=222003&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/CMakeLists.txt (original)<br>
+++ llvm/trunk/lib/DebugInfo/CMakeLists.txt Fri Nov 14 10:15:53 2014<br>
@@ -1,6 +1,7 @@<br>
 add_llvm_library(LLVMDebugInfo<br>
   DIContext.cpp<br>
   DWARFAbbreviationDeclaration.cpp<br>
+  DWARFAcceleratorTable.cpp<br>
   DWARFCompileUnit.cpp<br>
   DWARFContext.cpp<br>
   DWARFDebugAbbrev.cpp<br>
<br>
Added: llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp?rev=222003&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp?rev=222003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp (added)<br>
+++ llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp Fri Nov 14 10:15:53 2014<br>
@@ -0,0 +1,116 @@<br>
+#include "DWARFAcceleratorTable.h"<br>
+<br>
+#include "llvm/Support/Dwarf.h"<br>
+#include "llvm/Support/Format.h"<br>
+#include "llvm/Support/raw_ostream.h"<br>
+<br>
+namespace llvm {<br>
+<br>
+bool DWARFAcceleratorTable::extract() {<br>
+  uint32_t Offset = 0;<br>
+<br>
+  // Check that we can at least read the header.<br>
+  if (!AccelSection.isValidOffset(offsetof(Header, HeaderDataLength)+4))<br>
+    return false;<br>
+<br>
+  Hdr.Magic = AccelSection.getU32(&Offset);<br>
+  Hdr.Version = AccelSection.getU16(&Offset);<br>
+  Hdr.HashFunction = AccelSection.getU16(&Offset);<br>
+  Hdr.NumBuckets = AccelSection.getU32(&Offset);<br>
+  Hdr.NumHashes = AccelSection.getU32(&Offset);<br>
+  Hdr.HeaderDataLength = AccelSection.getU32(&Offset);<br>
+<br>
+  // Check that we can read all the hashes and offsets from the<br>
+  // section (see SourceLevelDebugging.rst for the structure of the index).<br>
+  if (!AccelSection.isValidOffset(sizeof(Hdr) + Hdr.HeaderDataLength +<br>
+                                  Hdr.NumBuckets*4 + Hdr.NumHashes*8))<br>
+    return false;<br>
+<br>
+  HdrData.DIEOffsetBase = AccelSection.getU32(&Offset);<br>
+  uint32_t NumAtoms = AccelSection.getU32(&Offset);<br>
+<br>
+  for (unsigned i = 0; i < NumAtoms; ++i) {<br>
+    uint16_t AtomType = AccelSection.getU16(&Offset);<br>
+    DWARFFormValue AtomForm(AccelSection.getU16(&Offset));<br>
+    HdrData.Atoms.push_back(std::make_pair(AtomType, AtomForm));<br>
+  }<br>
+<br>
+  return true;<br>
+}<br>
+<br>
+void DWARFAcceleratorTable::dump(raw_ostream &OS) {<br>
+  // Dump the header.<br>
+  OS << "Magic = " << format("0x%08x", Hdr.Magic) << '\n'<br>
+     << "Version = " << format("0x%04x", Hdr.Version) << '\n'<br>
+     << "Hash function = " << format("0x%08x", Hdr.HashFunction) << '\n'<br>
+     << "Bucket count = " << Hdr.NumBuckets << '\n'<br>
+     << "Hashes count = " << Hdr.NumHashes << '\n'<br>
+     << "HeaderData length = " << Hdr.HeaderDataLength << '\n'<br>
+     << "DIE offset base = " << HdrData.DIEOffsetBase << '\n'<br>
+     << "Number of atoms = " << HdrData.Atoms.size() << '\n';<br>
+<br>
+  unsigned i = 0;<br>
+  for (const auto &Atom: HdrData.Atoms) {<br>
+    OS << format("Atom[%d] Type: ", i++);<br>
+    if (const char *TypeString = dwarf::AtomTypeString(Atom.first))<br>
+      OS << TypeString;<br>
+    else<br>
+      OS << format("DW_ATOM_Unknown_0x%x", Atom.first);<br>
+    OS << " Form: ";<br>
+    if (const char *FormString = dwarf::FormEncodingString(Atom.second.getForm()))<br>
+      OS << FormString;<br>
+    else<br>
+      OS << format("DW_FORM_Unknown_0x%x", Atom.second.getForm());<br>
+    OS << '\n';<br>
+  }<br>
+<br>
+  // Now go through the actual tables and dump them.<br>
+  uint32_t Offset = sizeof(Hdr) + Hdr.HeaderDataLength;<br>
+  unsigned HashesBase = Offset + Hdr.NumBuckets * 4;<br>
+  unsigned OffsetsBase = HashesBase + Hdr.NumHashes * 4;<br>
+<br>
+  for (unsigned Bucket = 0; Bucket < Hdr.NumBuckets; ++Bucket) {<br>
+    unsigned Index = AccelSection.getU32(&Offset);<br>
+<br>
+    OS << format("Bucket[%d]\n", Bucket);<br>
+    if (Index == UINT32_MAX) {<br>
+      OS << "  EMPTY\n";<br>
+      continue;<br>
+    }<br>
+<br>
+    for (unsigned HashIdx = Index; HashIdx < Hdr.NumHashes; ++HashIdx) {<br>
+      unsigned HashOffset = HashesBase + HashIdx*4;<br>
+      unsigned OffsetsOffset = OffsetsBase + HashIdx*4;<br>
+      uint32_t Hash = AccelSection.getU32(&HashOffset);<br>
+<br>
+      if (Hash % Hdr.NumBuckets != Bucket)<br>
+        break;<br>
+<br>
+      unsigned DataOffset = AccelSection.getU32(&OffsetsOffset);<br>
+      OS << format("  Hash = 0x%08x Offset = 0x%08x\n", Hash, DataOffset);<br>
+      if (!AccelSection.isValidOffset(DataOffset)) {<br>
+        OS << "    Invalid section offset\n";<br>
+        continue;<br>
+      }<br>
+      while (unsigned StringOffset = AccelSection.getU32(&DataOffset)) {<br>
+        OS << format("    Name: %08x \"%s\"\n", StringOffset,<br>
+                     StringSection.getCStr(&StringOffset));<br>
+        unsigned NumData = AccelSection.getU32(&DataOffset);<br>
+        for (unsigned Data = 0; Data < NumData; ++Data) {<br>
+          OS << format("    Data[%d] => ", Data);<br>
+          unsigned i = 0;<br>
+          for (auto &Atom : HdrData.Atoms) {<br>
+            OS << format("{Atom[%d]: ", i++);<br>
+            if (Atom.second.extractValue(AccelSection, &DataOffset, nullptr))<br>
+              Atom.second.dump(OS, nullptr);<br>
+            else<br>
+              OS << "Error extracting the value";<br>
+            OS << "} ";<br>
+          }<br>
+          OS << '\n';<br>
+        }<br>
+      }<br>
+    }<br>
+  }<br>
+}<br>
+}<br>
<br>
Added: llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h?rev=222003&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h?rev=222003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h (added)<br>
+++ llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h Fri Nov 14 10:15:53 2014<br>
@@ -0,0 +1,38 @@<br>
+<br>
+#include "llvm/ADT/SmallVector.h"<br>
+#include "llvm/DebugInfo/DWARFFormValue.h"<br>
+<br>
+#include <cstdint><br>
+<br>
+namespace llvm {<br>
+<br>
+class DWARFAcceleratorTable {<br>
+<br>
+  struct Header {<br>
+    uint32_t Magic;<br>
+    uint16_t Version;<br>
+    uint16_t HashFunction;<br>
+    uint32_t NumBuckets;<br>
+    uint32_t NumHashes;<br>
+    uint32_t HeaderDataLength;<br>
+  };<br>
+<br>
+  struct HeaderData {<br>
+    typedef uint16_t AtomType;<br>
+    uint32_t DIEOffsetBase;<br>
+    SmallVector<std::pair<AtomType, DWARFFormValue>, 1> Atoms;<br>
+  };<br>
+<br>
+  struct Header Hdr;<br>
+  struct HeaderData HdrData;<br>
+  DataExtractor AccelSection;<br>
+  DataExtractor StringSection;<br>
+public:<br>
+  DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection)<br>
+    : AccelSection(AccelSection), StringSection(StringSection) {}<br>
+<br>
+  bool extract();<br>
+  void dump(raw_ostream &OS);<br></blockquote><div>^^</div><div>IMO it would be clearer if you make dump() method const,</div><div>and don't overwrite HdrData.Atoms there (that's somewhat weird, header data just<br></div><div>specifies the forms of the atoms), so you need the instances of DWARFFormValue</div><div>that you would extract only in the dump() method, not as class members.</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+};<br>
+<br>
+}<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=222003&r1=222002&r2=222003&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=222003&r1=222002&r2=222003&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Fri Nov 14 10:15:53 2014<br>
@@ -9,6 +9,7 @@<br>
<br>
 #include "DWARFContext.h"<br>
 #include "DWARFDebugArangeSet.h"<br>
+#include "DWARFAcceleratorTable.h"<br>
<br>
 #include "llvm/ADT/SmallString.h"<br>
 #include "llvm/ADT/StringSwitch.h"<br>
@@ -59,6 +60,17 @@ static void dumpPubSection(raw_ostream &<br>
   }<br>
 }<br>
<br>
+static void dumpAccelSection(raw_ostream &OS, StringRef Name, StringRef Data,<br>
+                             StringRef StringSection, bool LittleEndian) {<br>
+  DataExtractor AccelSection(Data, LittleEndian, 0);<br>
+  DataExtractor StrData(StringSection, LittleEndian, 0);<br>
+  OS << "\n." << Name << " contents:\n";<br>
+  DWARFAcceleratorTable Accel(AccelSection, StrData);<br>
+  if (!Accel.extract())<br>
+    return;<br>
+  Accel.dump(OS);<br>
+}<br>
+<br>
 void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {<br>
   if (DumpType == DIDT_All || DumpType == DIDT_Abbrev) {<br>
     OS << ".debug_abbrev contents:\n";<br>
@@ -218,6 +230,22 @@ void DWARFContext::dump(raw_ostream &OS,<br>
       OS << format("%8.8x\n", strOffsetExt.getU32(&offset));<br>
     }<br>
   }<br>
+<br>
+  if (DumpType == DIDT_All || DumpType == DIDT_AppleNames)<br>
+    dumpAccelSection(OS, "apple_names", getAppleNamesSection(),<br>
+                     getStringSection(), isLittleEndian());<br></blockquote><div><br></div><div>I find it weird that you don't include leading dot (".") in the section name,</div><div>but we're doing the same for pubSections for some reason...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+  if (DumpType == DIDT_All || DumpType == DIDT_AppleTypes)<br>
+    dumpAccelSection(OS, "apple_types", getAppleTypesSection(),<br>
+                     getStringSection(), isLittleEndian());<br>
+<br>
+  if (DumpType == DIDT_All || DumpType == DIDT_AppleNamespaces)<br>
+    dumpAccelSection(OS, "apple_namespaces", getAppleNamespacesSection(),<br>
+                     getStringSection(), isLittleEndian());<br>
+<br>
+  if (DumpType == DIDT_All || DumpType == DIDT_AppleObjC)<br>
+    dumpAccelSection(OS, "apple_objc", getAppleObjCSection(),<br>
+                     getStringSection(), isLittleEndian());<br>
 }<br>
<br>
 const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() {<br>
@@ -565,6 +593,11 @@ DWARFContextInMemory::DWARFContextInMemo<br>
             .Case("debug_str.dwo", &StringDWOSection)<br>
             .Case("debug_str_offsets.dwo", &StringOffsetDWOSection)<br>
             .Case("debug_addr", &AddrSection)<br>
+            .Case("apple_names", &AppleNamesSection)<br>
+            .Case("apple_types", &AppleTypesSection)<br>
+            .Case("apple_namespaces", &AppleNamespacesSection)<br>
+            .Case("apple_namespac", &AppleNamespacesSection)<br></blockquote><div>^^</div><div>Just checking, is apple_namespac a legacy name of the section?</div><div>Googling it doesn't produce any results.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+            .Case("apple_objc", &AppleObjCSection)<br>
             // Any more debug info sections go here.<br>
             .Default(nullptr);<br>
     if (SectionData) {<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/DWARFContext.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.h?rev=222003&r1=222002&r2=222003&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.h?rev=222003&r1=222002&r2=222003&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARFContext.h (original)<br>
+++ llvm/trunk/lib/DebugInfo/DWARFContext.h Fri Nov 14 10:15:53 2014<br>
@@ -192,6 +192,10 @@ public:<br>
   virtual StringRef getStringOffsetDWOSection() = 0;<br>
   virtual StringRef getRangeDWOSection() = 0;<br>
   virtual StringRef getAddrSection() = 0;<br>
+  virtual StringRef getAppleNamesSection() = 0;<br>
+  virtual StringRef getAppleTypesSection() = 0;<br>
+  virtual StringRef getAppleNamespacesSection() = 0;<br>
+  virtual StringRef getAppleObjCSection() = 0;<br>
<br>
   static bool isSupportedVersion(unsigned version) {<br>
     return version == 2 || version == 3 || version == 4;<br>
@@ -236,6 +240,10 @@ class DWARFContextInMemory : public DWAR<br>
   StringRef StringOffsetDWOSection;<br>
   StringRef RangeDWOSection;<br>
   StringRef AddrSection;<br>
+  StringRef AppleNamesSection;<br>
+  StringRef AppleTypesSection;<br>
+  StringRef AppleNamespacesSection;<br>
+  StringRef AppleObjCSection;<br>
<br>
   SmallVector<SmallString<32>, 4> UncompressedSections;<br>
<br>
@@ -256,6 +264,10 @@ public:<br>
   StringRef getPubTypesSection() override { return PubTypesSection; }<br>
   StringRef getGnuPubNamesSection() override { return GnuPubNamesSection; }<br>
   StringRef getGnuPubTypesSection() override { return GnuPubTypesSection; }<br>
+  StringRef getAppleNamesSection() override { return AppleNamesSection; }<br>
+  StringRef getAppleTypesSection() override { return AppleTypesSection; }<br>
+  StringRef getAppleNamespacesSection() override { return AppleNamespacesSection; }<br>
+  StringRef getAppleObjCSection() override { return AppleObjCSection; }<br>
<br>
   // Sections for DWARF5 split dwarf proposal.<br>
   const DWARFSection &getInfoDWOSection() override { return InfoDWOSection; }<br>
<br>
Modified: llvm/trunk/test/DebugInfo/Inputs/gmlt.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/gmlt.ll?rev=222003&r1=222002&r2=222003&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/gmlt.ll?rev=222003&r1=222002&r2=222003&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/Inputs/gmlt.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/Inputs/gmlt.ll Fri Nov 14 10:15:53 2014<br>
@@ -95,6 +95,8 @@<br>
 ; CHECK: .debug_pubtypes contents:<br>
 ; CHECK-NOT: Offset<br>
<br>
+; CHECK: .apple{{.*}} contents:<br>
+<br>
 ; Function Attrs: nounwind uwtable<br>
 define void @_Z2f1v() #0 {<br>
 entry:<br>
<br>
Modified: llvm/trunk/test/DebugInfo/cross-cu-inlining.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/cross-cu-inlining.ll?rev=222003&r1=222002&r2=222003&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/cross-cu-inlining.ll?rev=222003&r1=222002&r2=222003&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/cross-cu-inlining.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/cross-cu-inlining.ll Fri Nov 14 10:15:53 2014<br>
@@ -1,6 +1,7 @@<br>
 ; REQUIRES: object-emission<br>
<br>
 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck -implicit-check-not=DW_TAG %s<br>
+; RUN: %llc_dwarf -dwarf-accel-tables=Enable -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck --check-prefix=CHECK-ACCEL --check-prefix=CHECK %s<br>
<br>
 ; Build from source:<br>
 ; $ clang++ a.cpp b.cpp -g -c -emit-llvm<br>
@@ -52,6 +53,16 @@<br>
 ; CHECK:     DW_AT_location<br>
 ; CHECK:     DW_AT_abstract_origin {{.*}} {0x[[ABS_VAR]]} "x"<br>
<br>
+; Check that both the inline and the non out of line version of func are<br>
+; correctly referenced in the accelerator table. Before r221837, the one<br>
+; in the second compilation unit had a wrong offset<br>
+; CHECK-ACCEL: .apple_names contents:<br>
+; CHECK-ACCEL: Name{{.*}}"func"<br>
+; CHECK-ACCEL-NOT: Name<br>
+; CHECK-ACCEL: Atom[0]{{.*}}[[INLINED]]<br>
+; CHECK-ACCEL-NOT: Name<br>
+; CHECK-ACCEL: Atom[0]{{.*}}[[FUNC]]<br>
+<br>
 @i = external global i32<br>
<br>
 ; Function Attrs: uwtable<br>
<br>
Added: llvm/trunk/test/DebugInfo/dwarfdump-accel.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-accel.test?rev=222003&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-accel.test?rev=222003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/dwarfdump-accel.test (added)<br>
+++ llvm/trunk/test/DebugInfo/dwarfdump-accel.test Fri Nov 14 10:15:53 2014<br>
@@ -0,0 +1,63 @@<br>
+RUN: llvm-dwarfdump %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s<br>
+<br>
+Gather some DIE indexes to verify the accelerator table contents.<br>
+CHECK: .debug_info contents<br>
+CHECK: [[TESTINTERFACE:0x[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br>
+CHECK-NOT: DW_TAG<br>
+CHECK:     DW_AT_name{{.*}}"TestInterface"<br>
+CHECK: [[READONLY:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br>
+CHECK-NOT: DW_TAG<br>
+CHECK:     DW_AT_name{{.*}}"-[TestInterface ReadOnly]"<br>
+CHECK: [[ASSIGN:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br>
+CHECK-NOT: DW_TAG<br>
+CHECK:     DW_AT_name{{.*}}"-[TestInterface Assign]"<br>
+CHECK: [[SETASSIGN:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br>
+CHECK-NOT: DW_TAG<br>
+CHECK:     DW_AT_name{{.*}}"-[TestInterface setAssign:]"<br>
+<br>
+<br>
+Check that the section header is printed correclty.<br>
+CHECK: .apple_names contents:<br>
+CHECK: Magic = 0x48415348<br>
+CHECK: Version = 0x0001<br>
+CHECK: Hash function = 0x00000000<br>
+CHECK: Bucket count = 11<br>
+CHECK: Hashes count = 22<br>
+CHECK: HeaderData length = 12<br>
+CHECK: DIE offset base = 0<br>
+CHECK: Number of atoms = 1<br>
+CHECK: Atom[0]  Type: DW_ATOM_die_offset Form: DW_FORM_data4<br>
+<br>
+Check that empty buckets are handled correctly.<br>
+CHECK: Bucket[2]<br>
+CHECK:   EMPTY<br>
+CHECK: Bucket[3]<br>
+<br>
+Check that the accelerators point to the right DIEs.<br>
+CHECK:     Name:{{.*}}"-[TestInterface ReadOnly]"<br>
+CHECK-NOT: Name<br>
+CHECK:     {Atom[0]: [[READONLY]]}<br>
+CHECK:     Name:{{.*}}"-[TestInterface setAssign:]"<br>
+CHECK-NOT: Name<br>
+CHECK:     {Atom[0]: [[SETASSIGN]]}<br>
+CHECK:     Name:{{.*}}"-[TestInterface Assign]"<br>
+CHECK-NOT: Name<br>
+CHECK:     {Atom[0]: [[ASSIGN]]}<br>
+<br>
+Check that types are referenced correctly.<br>
+CHECK: .apple_types contents:<br>
+CHECK:     Name{{.*}}"TestInterface"<br>
+CHECK-NOT: Name<br>
+CHECK:     {Atom[0]: [[TESTINTERFACE]]}<br>
+<br>
+Check that an empty ecceleratorsection is handled correctly.<br>
+CHECK: .apple_namespaces contents:<br>
+CHECK-NOT: Magic<br>
+<br>
+Check ObjC specific accelerators.<br>
+CHECK: .apple_objc contents:<br>
+CHECK:     Name{{.*}}"TestInterface"<br>
+CHECK-NOT Name<br>
+CHECK:     {Atom[0]: [[READONLY]]}<br>
+CHECK:     {Atom[0]: [[ASSIGN]]}<br>
+CHECK:     {Atom[0]: [[SETASSIGN]]}<br>
<br>
Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=222003&r1=222002&r2=222003&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=222003&r1=222002&r2=222003&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)<br>
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Fri Nov 14 10:15:53 2014<br>
@@ -45,6 +45,10 @@ DumpType("debug-dump", cl::init(DIDT_All<br>
         clEnumValN(DIDT_All, "all", "Dump all debug sections"),<br>
         clEnumValN(DIDT_Abbrev, "abbrev", ".debug_abbrev"),<br>
         clEnumValN(DIDT_AbbrevDwo, "abbrev.dwo", ".debug_abbrev.dwo"),<br>
+        clEnumValN(DIDT_AppleNames, "apple_names", ".apple_names"),<br>
+        clEnumValN(DIDT_AppleTypes, "apple_types", ".apple_types"),<br>
+        clEnumValN(DIDT_AppleNamespaces, "apple_namespaces", ".apple_namespaces"),<br>
+        clEnumValN(DIDT_AppleObjC, "apple_objc", ".apple_objc"),<br>
         clEnumValN(DIDT_Aranges, "aranges", ".debug_aranges"),<br>
         clEnumValN(DIDT_Info, "info", ".debug_info"),<br>
         clEnumValN(DIDT_InfoDwo, "info.dwo", ".debug_info.dwo"),<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>