<div dir="ltr">Would you mind adding a test for our debug directory entry?</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 2, 2017 at 4:20 PM Reid Kleckner via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Wed Aug  2 16:19:54 2017<br>
New Revision: 309900<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=309900&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=309900&view=rev</a><br>
Log:<br>
[PDB] Improve our PDB OMF debug directory entry<br>
<br>
In order to get dbghelp to load our pdb, we have to fill in the<br>
PointerToRawData field as well as the AddressOfRawData field. One is the<br>
file offset and the other is the RVA.<br>
<br>
Modified:<br>
    lld/trunk/COFF/Chunks.h<br>
    lld/trunk/COFF/Writer.cpp<br>
<br>
Modified: lld/trunk/COFF/Chunks.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.h?rev=309900&r1=309899&r2=309900&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.h?rev=309900&r1=309899&r2=309900&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/COFF/Chunks.h (original)<br>
+++ lld/trunk/COFF/Chunks.h Wed Aug  2 16:19:54 2017<br>
@@ -82,7 +82,7 @@ public:<br>
   // An output section has pointers to chunks in the section, and each<br>
   // chunk has a back pointer to an output section.<br>
   void setOutputSection(OutputSection *O) { Out = O; }<br>
-  OutputSection *getOutputSection() { return Out; }<br>
+  OutputSection *getOutputSection() const { return Out; }<br>
<br>
   // Windows-specific.<br>
   // Collect all locations that contain absolute addresses for base relocations.<br>
<br>
Modified: lld/trunk/COFF/Writer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=309900&r1=309899&r2=309900&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=309900&r1=309899&r2=309900&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/COFF/Writer.cpp (original)<br>
+++ lld/trunk/COFF/Writer.cpp Wed Aug  2 16:19:54 2017<br>
@@ -65,8 +65,9 @@ public:<br>
       D->Type = COFF::IMAGE_DEBUG_TYPE_CODEVIEW;<br>
       D->SizeOfData = Record->getSize();<br>
       D->AddressOfRawData = Record->getRVA();<br>
-      // TODO(compnerd) get the file offset<br>
-      D->PointerToRawData = 0;<br>
+      OutputSection *OS = Record->getOutputSection();<br>
+      uint64_t Offs = OS->getFileOff() + (Record->getRVA() - OS->getRVA());<br>
+      D->PointerToRawData = Offs;<br>
<br>
       ++D;<br>
     }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>