<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">For the record, I reverted the feature for now as it failed some tests (for one I foolishly thought that we emitted accelerators on all platforms as the spec makes provision for section names on not Darwin…). I’ll address your review comments in my next try.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 12, 2014, at 4:22 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I'll leave it up to someone with more Objective-C knowledge to some of this review (Eric - since he implemented the accelerator tables in the first place)<br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Nov 12, 2014 at 3:48 PM, Frederic Riss<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:friss@apple.com" target="_blank" class="">friss@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: friss<br class="">Date: Wed Nov 12 17:48:10 2014<br class="">New Revision: 221836<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=221836&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=221836&view=rev</a><br class="">Log:<br class="">[dwarfdump] Add support for dumping accelerator tables.<br class=""><br class="">The class used for the dump only allows to dump for the moment, but<br class="">it can (and will) be easily extended to support search also.<br class=""><br class="">Added:<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/DebugInfo/dwarfdump-accel.test<br class="">Modified:<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/include/llvm/DebugInfo/DIContext.h<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/lib/DebugInfo/CMakeLists.txt<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/lib/DebugInfo/DWARFContext.h<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/DebugInfo/Inputs/gmlt.ll<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br class=""><br class="">Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=221836&r1=221835&r2=221836&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=221836&r1=221835&r2=221836&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)<br class="">+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Wed Nov 12 17:48:10 2014<br class="">@@ -107,7 +107,11 @@ enum DIDumpType {<br class="">   DIDT_GnuPubtypes,<br class="">   DIDT_Str,<br class="">   DIDT_StrDwo,<br class="">-  DIDT_StrOffsetsDwo<br class="">+  DIDT_StrOffsetsDwo,<br class="">+  DIDT_AppleNames,<br class="">+  DIDT_AppleTypes,<br class="">+  DIDT_AppleNamespaces,<br class="">+  DIDT_AppleObjC<br class=""> };<br class=""><br class=""> // In place of applying the relocations to the data we've read from disk we use<br class=""><br class="">Modified: llvm/trunk/lib/DebugInfo/CMakeLists.txt<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CMakeLists.txt?rev=221836&r1=221835&r2=221836&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CMakeLists.txt?rev=221836&r1=221835&r2=221836&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/CMakeLists.txt (original)<br class="">+++ llvm/trunk/lib/DebugInfo/CMakeLists.txt Wed Nov 12 17:48:10 2014<br class="">@@ -1,6 +1,7 @@<br class=""> add_llvm_library(LLVMDebugInfo<br class="">   DIContext.cpp<br class="">   DWARFAbbreviationDeclaration.cpp<br class="">+  DWARFAcceleratorTable.cpp<br class="">   DWARFCompileUnit.cpp<br class="">   DWARFContext.cpp<br class="">   DWARFDebugAbbrev.cpp<br class=""><br class="">Added: llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp?rev=221836&view=auto" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp?rev=221836&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp (added)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp Wed Nov 12 17:48:10 2014<br class="">@@ -0,0 +1,110 @@<br class="">+#include "DWARFAcceleratorTable.h"<br class="">+<br class="">+#include "llvm/Support/Dwarf.h"<br class="">+#include "llvm/Support/Format.h"<br class="">+#include "llvm/Support/raw_ostream.h"<br class="">+<br class="">+namespace llvm {<br class="">+<br class="">+bool DWARFAcceleratorTable::extract() {<br class="">+  uint32_t Offset = 0;<br class="">+<br class="">+  // Check that we can at least read the header.<br class="">+  if (!AccelSection.isValidOffset(offsetof(Header, HeaderDataLength)+4))<br class="">+    return false;<br class="">+<br class="">+  Hdr.Magic = AccelSection.getU32(&Offset);<br class="">+  Hdr.Version = AccelSection.getU16(&Offset);<br class="">+  Hdr.HashFunction = AccelSection.getU16(&Offset);<br class="">+  Hdr.NumBuckets = AccelSection.getU32(&Offset);<br class="">+  Hdr.NumHashes = AccelSection.getU32(&Offset);<br class="">+  Hdr.HeaderDataLength = AccelSection.getU32(&Offset);<br class="">+<br class="">+  // Check that we can read all the hashes and offsets from the<br class="">+  // section (see SourceLevelDebugging.rst for the structure of the index).<br class="">+  if (!AccelSection.isValidOffset(sizeof(Hdr) + Hdr.HeaderDataLength +<br class="">+                                  Hdr.NumBuckets*4 + Hdr.NumHashes*8))<br class="">+    return false;<br class="">+<br class="">+  HdrData.DIEOffsetBase = AccelSection.getU32(&Offset);<br class="">+  uint32_t NumAtoms = AccelSection.getU32(&Offset);<br class="">+<br class="">+  for (unsigned i = 0; i < NumAtoms; ++i) {<br class="">+    auto Atom = std::make_pair(AccelSection.getU16(&Offset),<br class="">+                               DWARFFormValue(AccelSection.getU16(&Offset)));<br class=""></blockquote><div class=""><br class=""></div><div class="">This might not be portable ^ due to unspecified order of evaluation of function arguments, this might read the fields in the wrong order (dwarfdump built with GCC versus dwarfdump built with Clang would behave differently)</div></div></div></div></div></blockquote><div><br class=""></div><div>Good catch! That might actually be one of the failures I’m seeing.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+    HdrData.Atoms.push_back(Atom);<br class=""></blockquote><div class=""><br class="">If not for the point above, I'd probably suggest rolling the make_pair into the push_back, but never mind.<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>I’ll do that once I get the getU16 calls on separate lines.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Is it worth doing HdrData.reserve(NumAtoms) before this loop?<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>As the size is known, it wouldn't cost anything to do it, but the number of Atom definitions is 1 or 3, I doubt it matters.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+  }<br class="">+<br class="">+  return true;<br class="">+}<br class="">+<br class="">+void DWARFAcceleratorTable::dump(raw_ostream &OS) {<br class="">+  // Dump the header.<br class="">+  OS << "Magic = " << format("0x%08x", Hdr.Magic) << '\n';<br class="">+  OS << "Version = " << format("0x%04x", Hdr.Version) << '\n';<br class="">+  OS << "Hash function = " << format("0x%08x", Hdr.HashFunction) << '\n';<br class="">+  OS << "Bucket count = " << Hdr.NumBuckets << '\n';<br class="">+  OS << "Hashes count = " << Hdr.NumHashes << '\n';<br class="">+  OS << "HeaderData length = " << Hdr.HeaderDataLength << '\n';<br class="">+  OS << "DIE offset base = " << HdrData.DIEOffsetBase << '\n';<br class="">+  OS << "Number of atoms = " << HdrData.Atoms.size() << '\n';<br class=""></blockquote><div class=""><br class="">Looks like dwarfdump is inconsistent in this regard, but you can just do it:<br class=""><br class="">OS << ...<br class="">      << ...<br class="">      << ...;<br class=""><br class="">rather than separate OS/; on each line.<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Will do</div><div><br class=""></div><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+<br class="">+  unsigned i = 0;<br class="">+  for (const auto &Atom: HdrData.Atoms) {<br class="">+    OS << format("Atom[%d] ", i++);<br class="">+    OS << " Type: " << dwarf::AtomTypeString(Atom.first);<br class="">+    OS << " Form: " << dwarf::FormEncodingString(Atom.second.getForm());<br class="">+    OS << "\n";<br class=""></blockquote><div class=""><br class=""></div><div class="">Which would make code like this ^ just a single statement and you could omit the {} if you want (some people prefer to only omit the braces on single /line/ blocks rather than single statement blocks - up to you)<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Will do</div><br class=""><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+  }<br class="">+<br class="">+  // Now go through the actual tables and dump them.<br class="">+  uint32_t Offset = sizeof(Hdr) + Hdr.HeaderDataLength;<br class="">+  unsigned HashesBase = Offset + Hdr.NumBuckets * 4;<br class="">+  unsigned OffsetsBase = HashesBase + Hdr.NumHashes * 4;<br class="">+<br class="">+  for (unsigned Bucket = 0; Bucket < Hdr.NumBuckets; ++Bucket) {<br class="">+    unsigned Index;<br class="">+    Index = AccelSection.getU32(&Offset);<br class=""></blockquote><div class=""><br class="">Make this into a single line/initialization? ^<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Sure</div><br class=""><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+<br class="">+    OS << format("Bucket[%d]\n", Bucket);<br class="">+    if (Index == UINT32_MAX) {<br class="">+      OS << "  EMPTY\n";<br class="">+      continue;<br class="">+    }<br class="">+<br class="">+    for (unsigned HashIdx = Index; HashIdx < Hdr.NumHashes; ++HashIdx) {<br class="">+      unsigned HashOffset = HashesBase + HashIdx*4;<br class="">+      unsigned OffsetsOffset = OffsetsBase + HashIdx*4;<br class="">+      uint32_t Hash = AccelSection.getU32(&HashOffset);<br class="">+<br class="">+      if (Hash % Hdr.NumBuckets != Bucket)<br class="">+        break;<br class="">+<br class="">+      unsigned DataOffset = AccelSection.getU32(&OffsetsOffset);<br class="">+      OS << format("  Hash = 0x%08x Offset = 0x%08x\n", Hash, DataOffset);<br class="">+      if (!AccelSection.isValidOffset(DataOffset)) {<br class="">+        OS << "    Invalid section offset\n";<br class="">+        continue;<br class="">+      }<br class="">+      while (unsigned StringOffset = AccelSection.getU32(&DataOffset)) {<br class="">+        OS << format("    Name: %08x \"%s\"\n", StringOffset,<br class="">+                     StringSection.getCStr(&StringOffset));<br class="">+        unsigned NumData = AccelSection.getU32(&DataOffset);<br class="">+        for (unsigned Data = 0; Data < NumData; ++Data) {<br class="">+          OS << format("    Data[%d] => ", Data);<br class="">+          unsigned i = 0;<br class="">+          for (auto &Atom : HdrData.Atoms) {<br class="">+            OS << format("{Atom[%d]: ", i++);<br class="">+            if (Atom.second.extractValue(AccelSection, &DataOffset, nullptr))<br class="">+              Atom.second.dump(OS, nullptr);<br class="">+            else<br class="">+              OS << "Error extracting the value";<br class="">+            OS << "} ";<br class="">+          }<br class="">+          OS << '\n';<br class="">+        }<br class="">+      }<br class="">+    }<br class="">+  }<br class="">+}<br class="">+}<br class=""><br class="">Added: llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h?rev=221836&view=auto" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h?rev=221836&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h (added)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h Wed Nov 12 17:48:10 2014<br class="">@@ -0,0 +1,38 @@<br class="">+<br class="">+#include "llvm/ADT/SmallVector.h"<br class="">+#include "llvm/DebugInfo/DWARFFormValue.h"<br class="">+<br class="">+#include <cstdint><br class="">+<br class="">+namespace llvm {<br class="">+<br class="">+class DWARFAcceleratorTable {<br class="">+<br class="">+  struct Header {<br class="">+    uint32_t Magic;<br class="">+    uint16_t Version;<br class="">+    uint16_t HashFunction;<br class="">+    uint32_t NumBuckets;<br class="">+    uint32_t NumHashes;<br class="">+    uint32_t HeaderDataLength;<br class="">+  };<br class="">+<br class="">+  struct HeaderData {<br class="">+    typedef uint16_t AtomType;<br class="">+    uint32_t DIEOffsetBase;<br class="">+    SmallVector<std::pair<AtomType, DWARFFormValue>, 1> Atoms;<br class="">+  };<br class="">+<br class="">+  struct Header Hdr;<br class="">+  struct HeaderData HdrData;<br class="">+  DataExtractor AccelSection;<br class="">+  DataExtractor StringSection;<br class="">+public:<br class="">+  DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection)<br class="">+    : AccelSection(AccelSection), StringSection(StringSection) {}<br class="">+<br class="">+  bool extract();<br class="">+  void dump(raw_ostream &OS);<br class="">+};<br class="">+<br class="">+}<br class=""><br class="">Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=221836&r1=221835&r2=221836&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=221836&r1=221835&r2=221836&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Wed Nov 12 17:48:10 2014<br class="">@@ -9,6 +9,7 @@<br class=""><br class=""> #include "DWARFContext.h"<br class=""> #include "DWARFDebugArangeSet.h"<br class="">+#include "DWARFAcceleratorTable.h"<br class=""><br class=""> #include "llvm/ADT/SmallString.h"<br class=""> #include "llvm/ADT/StringSwitch.h"<br class="">@@ -59,6 +60,17 @@ static void dumpPubSection(raw_ostream &<br class="">   }<br class=""> }<br class=""><br class="">+static void dumpAccelSection(raw_ostream &OS, StringRef Name, StringRef Data,<br class="">+                             StringRef StringSection, bool LittleEndian) {<br class="">+  DataExtractor AccelSection(Data, LittleEndian, 0);<br class="">+  DataExtractor StrData(StringSection, LittleEndian, 0);<br class="">+  OS << "\n." << Name << " contents:\n";<br class="">+  DWARFAcceleratorTable Accel(AccelSection, StrData);<br class="">+  if (!Accel.extract())<br class="">+    return;<br class="">+  Accel.dump(OS);<br class="">+}<br class="">+<br class=""> void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {<br class="">   if (DumpType == DIDT_All || DumpType == DIDT_Abbrev) {<br class="">     OS << ".debug_abbrev contents:\n";<br class="">@@ -218,6 +230,22 @@ void DWARFContext::dump(raw_ostream &OS,<br class="">       OS << format("%8.8x\n", strOffsetExt.getU32(&offset));<br class="">     }<br class="">   }<br class="">+<br class="">+  if (DumpType == DIDT_All || DumpType == DIDT_AppleNames)<br class="">+    dumpAccelSection(OS, "apple_names", getAppleNamesSection(),<br class="">+                     getStringSection(), isLittleEndian());<br class="">+<br class="">+  if (DumpType == DIDT_All || DumpType == DIDT_AppleTypes)<br class="">+    dumpAccelSection(OS, "apple_types", getAppleTypesSection(),<br class="">+                     getStringSection(), isLittleEndian());<br class="">+<br class="">+  if (DumpType == DIDT_All || DumpType == DIDT_AppleNamespaces)<br class="">+    dumpAccelSection(OS, "apple_namespaces", getAppleNamespacesSection(),<br class="">+                     getStringSection(), isLittleEndian());<br class="">+<br class="">+  if (DumpType == DIDT_All || DumpType == DIDT_AppleObjC)<br class="">+    dumpAccelSection(OS, "apple_objc", getAppleObjCSection(),<br class="">+                     getStringSection(), isLittleEndian());<br class=""> }<br class=""><br class=""> const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() {<br class="">@@ -565,6 +593,11 @@ DWARFContextInMemory::DWARFContextInMemo<br class="">             .Case("debug_str.dwo", &StringDWOSection)<br class="">             .Case("debug_str_offsets.dwo", &StringOffsetDWOSection)<br class="">             .Case("debug_addr", &AddrSection)<br class="">+            .Case("apple_names", &AppleNamesSection)<br class="">+            .Case("apple_types", &AppleTypesSection)<br class="">+            .Case("apple_namespaces", &AppleNamespacesSection)<br class="">+            .Case("apple_namespac", &AppleNamespacesSection)<br class="">+            .Case("apple_objc", &AppleObjCSection)<br class="">             // Any more debug info sections go here.<br class="">             .Default(nullptr);<br class="">     if (SectionData) {<br class=""><br class="">Modified: llvm/trunk/lib/DebugInfo/DWARFContext.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.h?rev=221836&r1=221835&r2=221836&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.h?rev=221836&r1=221835&r2=221836&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFContext.h (original)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFContext.h Wed Nov 12 17:48:10 2014<br class="">@@ -192,6 +192,10 @@ public:<br class="">   virtual StringRef getStringOffsetDWOSection() = 0;<br class="">   virtual StringRef getRangeDWOSection() = 0;<br class="">   virtual StringRef getAddrSection() = 0;<br class="">+  virtual StringRef getAppleNamesSection() = 0;<br class="">+  virtual StringRef getAppleTypesSection() = 0;<br class="">+  virtual StringRef getAppleNamespacesSection() = 0;<br class="">+  virtual StringRef getAppleObjCSection() = 0;<br class=""><br class="">   static bool isSupportedVersion(unsigned version) {<br class="">     return version == 2 || version == 3 || version == 4;<br class="">@@ -236,6 +240,10 @@ class DWARFContextInMemory : public DWAR<br class="">   StringRef StringOffsetDWOSection;<br class="">   StringRef RangeDWOSection;<br class="">   StringRef AddrSection;<br class="">+  StringRef AppleNamesSection;<br class="">+  StringRef AppleTypesSection;<br class="">+  StringRef AppleNamespacesSection;<br class="">+  StringRef AppleObjCSection;<br class=""><br class="">   SmallVector<SmallString<32>, 4> UncompressedSections;<br class=""><br class="">@@ -256,6 +264,10 @@ public:<br class="">   StringRef getPubTypesSection() override { return PubTypesSection; }<br class="">   StringRef getGnuPubNamesSection() override { return GnuPubNamesSection; }<br class="">   StringRef getGnuPubTypesSection() override { return GnuPubTypesSection; }<br class="">+  StringRef getAppleNamesSection() override { return AppleNamesSection; }<br class="">+  StringRef getAppleTypesSection() override { return AppleTypesSection; }<br class="">+  StringRef getAppleNamespacesSection() override { return AppleNamespacesSection; }<br class="">+  StringRef getAppleObjCSection() override { return AppleObjCSection; }<br class=""><br class="">   // Sections for DWARF5 split dwarf proposal.<br class="">   const DWARFSection &getInfoDWOSection() override { return InfoDWOSection; }<br class=""><br class="">Modified: llvm/trunk/test/DebugInfo/Inputs/gmlt.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/gmlt.ll?rev=221836&r1=221835&r2=221836&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/gmlt.ll?rev=221836&r1=221835&r2=221836&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/DebugInfo/Inputs/gmlt.ll (original)<br class="">+++ llvm/trunk/test/DebugInfo/Inputs/gmlt.ll Wed Nov 12 17:48:10 2014<br class="">@@ -95,6 +95,8 @@<br class=""> ; CHECK: .debug_pubtypes contents:<br class=""> ; CHECK-NOT: Offset<br class=""><br class="">+; CHECK: .apple{{.*}} contents:<br class="">+<br class=""> ; Function Attrs: nounwind uwtable<br class=""> define void @_Z2f1v() #0 {<br class=""> entry:<br class=""><br class="">Added: llvm/trunk/test/DebugInfo/dwarfdump-accel.test<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-accel.test?rev=221836&view=auto" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-accel.test?rev=221836&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/DebugInfo/dwarfdump-accel.test (added)<br class="">+++ llvm/trunk/test/DebugInfo/dwarfdump-accel.test Wed Nov 12 17:48:10 2014<br class="">@@ -0,0 +1,154 @@<br class="">+RUN: llvm-dwarfdump %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s<br class=""></blockquote><div class=""><br class=""></div><div class="">Does the example need to be this long? Could it involve fewer elements? What particular codepaths is it testing that require this length?</div></div></div></div></blockquote><div><br class=""></div><div>The binary used is nice because it contains 3 full accelerator tables and one empty section. Wrt what to test in the full ones, at first I wanted to write a test that matches the DIE tree with some of the accelerator entries, but I just couldn’t figure out what would make most sense to test. I then decided to take the full dump that I verified by hand and to check it in. I could prune the hash table entries by testing only the beginning and the end for example, I don’t think testing coverage would be impacted. Is the test size really an issue?</div><div><br class=""></div><div>Fred</div><div><br class=""></div><blockquote type="cite" class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+<br class="">+CHECK: .apple_names contents:<br class="">+CHECK: Magic = 0x48415348<br class="">+CHECK: Version = 0x0001<br class="">+CHECK: Hash function = 0x00000000<br class="">+CHECK: Bucket count = 11<br class="">+CHECK: Hashes count = 22<br class="">+CHECK: HeaderData length = 12<br class="">+CHECK: DIE offset base = 0<br class="">+CHECK: Number of atoms = 1<br class="">+CHECK: Atom[0]  Type: DW_ATOM_die_offset Form: DW_FORM_data4<br class="">+CHECK: Bucket[0]<br class="">+CHECK:   Hash = 0x248050fe Offset = 0x000000fc<br class="">+CHECK:     Name: 00000165 "-[TestInterface Retain]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x0000024f}<br class="">+CHECK: Bucket[1]<br class="">+CHECK:   Hash = 0x926d42cc Offset = 0x0000010c<br class="">+CHECK:     Name: 00000057 "ReadWrite"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x000001cb}<br class="">+CHECK: Bucket[2]<br class="">+CHECK:   EMPTY<br class="">+CHECK: Bucket[3]<br class="">+CHECK:   Hash = 0x99254268 Offset = 0x0000011c<br class="">+CHECK:     Name: 0000013f "-[TestInterface setReadWrite:]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000209}<br class="">+CHECK:   Hash = 0x946f52b9 Offset = 0x0000012c<br class="">+CHECK:     Name: 000000c6 "-[TestInterface ReadOnly]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000109}<br class="">+CHECK: Bucket[4]<br class="">+CHECK:   EMPTY<br class="">+CHECK: Bucket[5]<br class="">+CHECK:   EMPTY<br class="">+CHECK: Bucket[6]<br class="">+CHECK:   Hash = 0x6e8e91a3 Offset = 0x0000013c<br class="">+CHECK:     Name: 000001e0 "-[TestInterface NonAtomic]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000357}<br class="">+CHECK:   Hash = 0x7d1a5012 Offset = 0x0000014c<br class="">+CHECK:     Name: 0000014d "setReadWrite:"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000209}<br class="">+CHECK:   Hash = 0xb65f49d3 Offset = 0x0000015c<br class="">+CHECK:     Name: 0000020d "setNonAtomic:"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000395}<br class="">+CHECK:   Hash = 0x354997e2 Offset = 0x0000016c<br class="">+CHECK:     Name: 00000120 "-[TestInterface ReadWrite]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x000001cb}<br class="">+CHECK: Bucket[7]<br class="">+CHECK:   Hash = 0xce8af9c8 Offset = 0x0000017c<br class="">+CHECK:     Name: 0000005e "Retain"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x0000024f}<br class="">+CHECK:   Hash = 0xa7e0338a Offset = 0x0000018c<br class="">+CHECK:     Name: 0000004d "Assign"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000147}<br class="">+CHECK:   Hash = 0xa9812410 Offset = 0x0000019c<br class="">+CHECK:     Name: 00000105 "setAssign:"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000185}<br class="">+CHECK:   Hash = 0x218d07f6 Offset = 0x000001ac<br class="">+CHECK:     Name: 000001a2 "-[TestInterface Copy]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x000002d3}<br class="">+CHECK:   Hash = 0x0456817c Offset = 0x000001bc<br class="">+CHECK:     Name: 000001bc "-[TestInterface setCopy:]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000311}<br class="">+CHECK:   Hash = 0x7c83b400 Offset = 0x000001cc<br class="">+CHECK:     Name: 0000006c "Copy"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x000002d3}<br class="">+CHECK: Bucket[8]<br class="">+CHECK:   Hash = 0x0f918046 Offset = 0x000001dc<br class="">+CHECK:     Name: 000001c5 "setCopy:"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000311}<br class="">+CHECK:   Hash = 0xfb097449 Offset = 0x000001ec<br class="">+CHECK:     Name: 000001ff "-[TestInterface setNonAtomic:]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000395}<br class="">+CHECK:   Hash = 0x71069de3 Offset = 0x000001fc<br class="">+CHECK:     Name: 00000042 "ReadOnly"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000109}<br class="">+CHECK: Bucket[9]<br class="">+CHECK:   Hash = 0xd55908c6 Offset = 0x0000020c<br class="">+CHECK:     Name: 000000fa "-[TestInterface setAssign:]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000185}<br class="">+CHECK:   Hash = 0xa584b20e Offset = 0x0000021c<br class="">+CHECK:     Name: 0000018c "setRetain:"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x0000028d}<br class="">+CHECK:   Hash = 0x9429886d Offset = 0x0000022c<br class="">+CHECK:     Name: 00000076 "NonAtomic"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000357}<br class="">+CHECK:   Hash = 0x287cc300 Offset = 0x0000023c<br class="">+CHECK:     Name: 000000de "-[TestInterface Assign]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000147}<br class="">+CHECK:   Hash = 0x51ce5684 Offset = 0x0000024c<br class="">+CHECK:     Name: 00000181 "-[TestInterface setRetain:]"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x0000028d}<br class="">+CHECK: Bucket[10]<br class="">+CHECK:   EMPTY<br class="">+<br class="">+<br class="">+CHECK: .apple_types contents:<br class="">+CHECK: Magic = 0x48415348<br class="">+CHECK: Version = 0x0001<br class="">+CHECK: Hash function = 0x00000000<br class="">+CHECK: Bucket count = 4<br class="">+CHECK: Hashes count = 4<br class="">+CHECK: HeaderData length = 20<br class="">+CHECK: DIE offset base = 0<br class="">+CHECK: Number of atoms = 3<br class="">+CHECK: Atom[0]  Type: DW_ATOM_die_offset Form: DW_FORM_data4<br class="">+CHECK: Atom[1]  Type: DW_ATOM_die_tag Form: DW_FORM_data2<br class="">+CHECK: Atom[2]  Type: DW_ATOM_type_flags Form: DW_FORM_data1<br class="">+CHECK: Bucket[0]<br class="">+CHECK:   Hash = 0x0b888030 Offset = 0x00000058<br class="">+CHECK:     Name: 00000046 "int"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x000000f4} {Atom[1]: 0x0024} {Atom[2]: 0x00}<br class="">+CHECK: Bucket[1]<br class="">+CHECK:   Hash = 0x0b881d29 Offset = 0x0000006b<br class="">+CHECK:     Name: 0000021b "SEL"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x000003e0} {Atom[1]: 0x0016} {Atom[2]: 0x00}<br class="">+CHECK:   Hash = 0x2c549f3d Offset = 0x0000007e<br class="">+CHECK:     Name: 00000067 "NSObject"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000100} {Atom[1]: 0x0013} {Atom[2]: 0x00}<br class="">+CHECK: Bucket[2]<br class="">+CHECK:   Hash = 0x16a83cb6 Offset = 0x00000091<br class="">+CHECK:     Name: 00000039 "TestInterface"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x0000002f} {Atom[1]: 0x0013} {Atom[2]: 0x00}<br class="">+CHECK: Bucket[3]<br class="">+CHECK:   EMPTY<br class="">+<br class="">+<br class="">+CHECK: .apple_namespaces contents:<br class="">+CHECK-NOT: Magic<br class="">+<br class="">+<br class="">+CHECK: .apple_objc contents:<br class="">+CHECK: Magic = 0x48415348<br class="">+CHECK: Version = 0x0001<br class="">+CHECK: Hash function = 0x00000000<br class="">+CHECK: Bucket count = 1<br class="">+CHECK: Hashes count = 1<br class="">+CHECK: HeaderData length = 12<br class="">+CHECK: DIE offset base = 0<br class="">+CHECK: Number of atoms = 1<br class="">+CHECK: Atom[0]  Type: DW_ATOM_die_offset Form: DW_FORM_data4<br class="">+CHECK: Bucket[0]<br class="">+CHECK:   Hash = 0x16a83cb6 Offset = 0x0000002c<br class="">+CHECK:     Name: 00000039 "TestInterface"<br class="">+CHECK:     Data[0] => {Atom[0]: 0x00000109}<br class="">+CHECK:     Data[1] => {Atom[0]: 0x00000147}<br class="">+CHECK:     Data[2] => {Atom[0]: 0x00000185}<br class="">+CHECK:     Data[3] => {Atom[0]: 0x000001cb}<br class="">+CHECK:     Data[4] => {Atom[0]: 0x00000209}<br class="">+CHECK:     Data[5] => {Atom[0]: 0x0000024f}<br class="">+CHECK:     Data[6] => {Atom[0]: 0x0000028d}<br class="">+CHECK:     Data[7] => {Atom[0]: 0x000002d3}<br class="">+CHECK:     Data[8] => {Atom[0]: 0x00000311}<br class="">+CHECK:     Data[9] => {Atom[0]: 0x00000357}<br class="">+CHECK:     Data[10] => {Atom[0]: 0x00000395}<br class="">\ No newline at end of file<br class=""><br class="">Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=221836&r1=221835&r2=221836&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=221836&r1=221835&r2=221836&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)<br class="">+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Wed Nov 12 17:48:10 2014<br class="">@@ -45,6 +45,10 @@ DumpType("debug-dump", cl::init(DIDT_All<br class="">         clEnumValN(DIDT_All, "all", "Dump all debug sections"),<br class="">         clEnumValN(DIDT_Abbrev, "abbrev", ".debug_abbrev"),<br class="">         clEnumValN(DIDT_AbbrevDwo, "abbrev.dwo", ".debug_abbrev.dwo"),<br class="">+        clEnumValN(DIDT_AppleNames, "apple_names", ".apple_names"),<br class="">+        clEnumValN(DIDT_AppleTypes, "apple_types", ".apple_types"),<br class="">+        clEnumValN(DIDT_AppleNamespaces, "apple_namespaces", ".apple_namespaces"),<br class="">+        clEnumValN(DIDT_AppleObjC, "apple_objc", ".apple_objc"),<br class="">         clEnumValN(DIDT_Aranges, "aranges", ".debug_aranges"),<br class="">         clEnumValN(DIDT_Info, "info", ".debug_info"),<br class="">         clEnumValN(DIDT_InfoDwo, "info.dwo", ".debug_info.dwo"),<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></div></div></blockquote></div><br class=""></div></body></html>