<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 19, 2014, at 10:16 PM, Alexey Samsonov <<a href="mailto:vonosmas@gmail.com" class="">vonosmas@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Menlo-Regular; font-size: 11px; 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="">Nothing critical, just a few comments as I skimmed through the code.</div><div class=""><br class=""></div>Is it OK that new files (DWARFAcceleratorTable.(h|cpp)) are missing LLVM copyright headers?</div></div></blockquote><div><br class=""></div><div>I suppose it’s not! Thanks for the catch.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Menlo-Regular; font-size: 11px; 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">On Fri, Nov 14, 2014 at 8:15 AM, 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: Fri Nov 14 10:15:53 2014<br class="">New Revision: 222003<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=222003&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=222003&view=rev</a><br class="">Log:<br class="">Reapply "[dwarfdump] Add support for dumping accelerator tables."<br class=""><br class="">This reverts commit r221842 which was a revert of r221836 and of the<br class="">test parts of r221837.<br class=""><br class="">This new version fixes an UB bug pointed out by David (along with<br class="">addressing some other review comments), makes some dumping more<br class="">resilient to broken input data and forces the accelerator tables<br class="">to be dumped in the tests where we use them (this decision is<br class="">platform specific otherwise).<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/test/DebugInfo/cross-cu-inlining.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=222003&r1=222002&r2=222003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=222003&r1=222002&r2=222003&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)<br class="">+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Fri Nov 14 10:15:53 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=222003&r1=222002&r2=222003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CMakeLists.txt?rev=222003&r1=222002&r2=222003&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/CMakeLists.txt (original)<br class="">+++ llvm/trunk/lib/DebugInfo/CMakeLists.txt Fri Nov 14 10:15:53 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=222003&view=auto" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp?rev=222003&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp (added)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.cpp Fri Nov 14 10:15:53 2014<br class="">@@ -0,0 +1,116 @@<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="">+    uint16_t AtomType = AccelSection.getU16(&Offset);<br class="">+    DWARFFormValue AtomForm(AccelSection.getU16(&Offset));<br class="">+    HdrData.Atoms.push_back(std::make_pair(AtomType, AtomForm));<br class="">+  }<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="">+     << "Version = " << format("0x%04x", Hdr.Version) << '\n'<br class="">+     << "Hash function = " << format("0x%08x", Hdr.HashFunction) << '\n'<br class="">+     << "Bucket count = " << Hdr.NumBuckets << '\n'<br class="">+     << "Hashes count = " << Hdr.NumHashes << '\n'<br class="">+     << "HeaderData length = " << Hdr.HeaderDataLength << '\n'<br class="">+     << "DIE offset base = " << HdrData.DIEOffsetBase << '\n'<br class="">+     << "Number of atoms = " << HdrData.Atoms.size() << '\n';<br class="">+<br class="">+  unsigned i = 0;<br class="">+  for (const auto &Atom: HdrData.Atoms) {<br class="">+    OS << format("Atom[%d] Type: ", i++);<br class="">+    if (const char *TypeString = dwarf::AtomTypeString(Atom.first))<br class="">+      OS << TypeString;<br class="">+    else<br class="">+      OS << format("DW_ATOM_Unknown_0x%x", Atom.first);<br class="">+    OS << " Form: ";<br class="">+    if (const char *FormString = dwarf::FormEncodingString(Atom.second.getForm()))<br class="">+      OS << FormString;<br class="">+    else<br class="">+      OS << format("DW_FORM_Unknown_0x%x", Atom.second.getForm());<br class="">+    OS << '\n';<br class="">+  }<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 = AccelSection.getU32(&Offset);<br class="">+<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=222003&view=auto" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h?rev=222003&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h (added)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFAcceleratorTable.h Fri Nov 14 10:15:53 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=""></blockquote><div class="">^^</div><div class="">IMO it would be clearer if you make dump() method const,</div><div class="">and don't overwrite HdrData.Atoms there (that's somewhat weird, header data just<br class=""></div><div class="">specifies the forms of the atoms), so you need the instances of DWARFFormValue</div><div class="">that you would extract only in the dump() method, not as class members.</div></div></div></div></div></blockquote><div><br class=""></div><div>I did it to avoid creating the same DWARFFormValue objects over and over. I suppose that creating one of those is cheap enough that it doesn’t matter though...</div><div><br class=""></div><blockquote type="cite" class=""><div dir="ltr" style="font-family: Menlo-Regular; font-size: 11px; 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=""> <br class=""></div><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="">+}<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=222003&r1=222002&r2=222003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=222003&r1=222002&r2=222003&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Fri Nov 14 10:15:53 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=""></blockquote><div class=""><br class=""></div><div class="">I find it weird that you don't include leading dot (".") in the section name,</div><div class="">but we're doing the same for pubSections for some reason…</div></div></div></div></blockquote><div><br class=""></div><div>This is done for every section because leading ‘.’ and ‘_’ are removed some that they can be handled in a platform independent way (mach-o uses ‘_’).</div><br class=""><blockquote type="cite" class=""><div dir="ltr" style="font-family: Menlo-Regular; font-size: 11px; 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="">+  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=""></blockquote><div class="">^^</div><div class="">Just checking, is apple_namespac a legacy name of the section?</div><div class="">Googling it doesn't produce any results.</div></div></div></div></blockquote><div><br class=""></div><div>The short version is the one used on mach-o systems where the section names are limited in length. This makes me think that we must not be able to dump gnu_pub{types,names} on these systems, because the names are truncated also.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" style="font-family: Menlo-Regular; font-size: 11px; 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;">+            .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=222003&r1=222002&r2=222003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.h?rev=222003&r1=222002&r2=222003&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/DebugInfo/DWARFContext.h (original)<br class="">+++ llvm/trunk/lib/DebugInfo/DWARFContext.h Fri Nov 14 10:15:53 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=222003&r1=222002&r2=222003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/gmlt.ll?rev=222003&r1=222002&r2=222003&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/DebugInfo/Inputs/gmlt.ll (original)<br class="">+++ llvm/trunk/test/DebugInfo/Inputs/gmlt.ll Fri Nov 14 10:15:53 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="">Modified: llvm/trunk/test/DebugInfo/cross-cu-inlining.ll<br class="">URL:<span class="Apple-converted-space"> </span><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" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/cross-cu-inlining.ll?rev=222003&r1=222002&r2=222003&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/DebugInfo/cross-cu-inlining.ll (original)<br class="">+++ llvm/trunk/test/DebugInfo/cross-cu-inlining.ll Fri Nov 14 10:15:53 2014<br class="">@@ -1,6 +1,7 @@<br class=""> ; REQUIRES: object-emission<br class=""><br class=""> ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck -implicit-check-not=DW_TAG %s<br class="">+; RUN: %llc_dwarf -dwarf-accel-tables=Enable -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck --check-prefix=CHECK-ACCEL --check-prefix=CHECK %s<br class=""><br class=""> ; Build from source:<br class=""> ; $ clang++ a.cpp b.cpp -g -c -emit-llvm<br class="">@@ -52,6 +53,16 @@<br class=""> ; CHECK:     DW_AT_location<br class=""> ; CHECK:     DW_AT_abstract_origin {{.*}} {0x[[ABS_VAR]]} "x"<br class=""><br class="">+; Check that both the inline and the non out of line version of func are<br class="">+; correctly referenced in the accelerator table. Before r221837, the one<br class="">+; in the second compilation unit had a wrong offset<br class="">+; CHECK-ACCEL: .apple_names contents:<br class="">+; CHECK-ACCEL: Name{{.*}}"func"<br class="">+; CHECK-ACCEL-NOT: Name<br class="">+; CHECK-ACCEL: Atom[0]{{.*}}[[INLINED]]<br class="">+; CHECK-ACCEL-NOT: Name<br class="">+; CHECK-ACCEL: Atom[0]{{.*}}[[FUNC]]<br class="">+<br class=""> @i = external global i32<br class=""><br class=""> ; Function Attrs: uwtable<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=222003&view=auto" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-accel.test?rev=222003&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/DebugInfo/dwarfdump-accel.test (added)<br class="">+++ llvm/trunk/test/DebugInfo/dwarfdump-accel.test Fri Nov 14 10:15:53 2014<br class="">@@ -0,0 +1,63 @@<br class="">+RUN: llvm-dwarfdump %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s<br class="">+<br class="">+Gather some DIE indexes to verify the accelerator table contents.<br class="">+CHECK: .debug_info contents<br class="">+CHECK: [[TESTINTERFACE:0x[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+CHECK-NOT: DW_TAG<br class="">+CHECK:     DW_AT_name{{.*}}"TestInterface"<br class="">+CHECK: [[READONLY:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br class="">+CHECK-NOT: DW_TAG<br class="">+CHECK:     DW_AT_name{{.*}}"-[TestInterface ReadOnly]"<br class="">+CHECK: [[ASSIGN:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br class="">+CHECK-NOT: DW_TAG<br class="">+CHECK:     DW_AT_name{{.*}}"-[TestInterface Assign]"<br class="">+CHECK: [[SETASSIGN:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br class="">+CHECK-NOT: DW_TAG<br class="">+CHECK:     DW_AT_name{{.*}}"-[TestInterface setAssign:]"<br class="">+<br class="">+<br class="">+Check that the section header is printed correclty.<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="">+<br class="">+Check that empty buckets are handled correctly.<br class="">+CHECK: Bucket[2]<br class="">+CHECK:   EMPTY<br class="">+CHECK: Bucket[3]<br class="">+<br class="">+Check that the accelerators point to the right DIEs.<br class="">+CHECK:     Name:{{.*}}"-[TestInterface ReadOnly]"<br class="">+CHECK-NOT: Name<br class="">+CHECK:     {Atom[0]: [[READONLY]]}<br class="">+CHECK:     Name:{{.*}}"-[TestInterface setAssign:]"<br class="">+CHECK-NOT: Name<br class="">+CHECK:     {Atom[0]: [[SETASSIGN]]}<br class="">+CHECK:     Name:{{.*}}"-[TestInterface Assign]"<br class="">+CHECK-NOT: Name<br class="">+CHECK:     {Atom[0]: [[ASSIGN]]}<br class="">+<br class="">+Check that types are referenced correctly.<br class="">+CHECK: .apple_types contents:<br class="">+CHECK:     Name{{.*}}"TestInterface"<br class="">+CHECK-NOT: Name<br class="">+CHECK:     {Atom[0]: [[TESTINTERFACE]]}<br class="">+<br class="">+Check that an empty ecceleratorsection is handled correctly.<br class="">+CHECK: .apple_namespaces contents:<br class="">+CHECK-NOT: Magic<br class="">+<br class="">+Check ObjC specific accelerators.<br class="">+CHECK: .apple_objc contents:<br class="">+CHECK:     Name{{.*}}"TestInterface"<br class="">+CHECK-NOT Name<br class="">+CHECK:     {Atom[0]: [[READONLY]]}<br class="">+CHECK:     {Atom[0]: [[ASSIGN]]}<br class="">+CHECK:     {Atom[0]: [[SETASSIGN]]}<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=222003&r1=222002&r2=222003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=222003&r1=222002&r2=222003&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 Fri Nov 14 10:15:53 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><br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature"><div dir="ltr" class="">Alexey Samsonov<br class=""><a href="mailto:vonosmas@gmail.com" target="_blank" class="">vonosmas@gmail.com</a></div></div></div></div></blockquote></div><br class=""></body></html>