[lld] r309900 - [PDB] Improve our PDB OMF debug directory entry

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 16:29:43 PDT 2017


Would you mind adding a test for our debug directory entry?

On Wed, Aug 2, 2017 at 4:20 PM Reid Kleckner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rnk
> Date: Wed Aug  2 16:19:54 2017
> New Revision: 309900
>
> URL: http://llvm.org/viewvc/llvm-project?rev=309900&view=rev
> Log:
> [PDB] Improve our PDB OMF debug directory entry
>
> In order to get dbghelp to load our pdb, we have to fill in the
> PointerToRawData field as well as the AddressOfRawData field. One is the
> file offset and the other is the RVA.
>
> Modified:
>     lld/trunk/COFF/Chunks.h
>     lld/trunk/COFF/Writer.cpp
>
> Modified: lld/trunk/COFF/Chunks.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.h?rev=309900&r1=309899&r2=309900&view=diff
>
> ==============================================================================
> --- lld/trunk/COFF/Chunks.h (original)
> +++ lld/trunk/COFF/Chunks.h Wed Aug  2 16:19:54 2017
> @@ -82,7 +82,7 @@ public:
>    // An output section has pointers to chunks in the section, and each
>    // chunk has a back pointer to an output section.
>    void setOutputSection(OutputSection *O) { Out = O; }
> -  OutputSection *getOutputSection() { return Out; }
> +  OutputSection *getOutputSection() const { return Out; }
>
>    // Windows-specific.
>    // Collect all locations that contain absolute addresses for base
> relocations.
>
> Modified: lld/trunk/COFF/Writer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=309900&r1=309899&r2=309900&view=diff
>
> ==============================================================================
> --- lld/trunk/COFF/Writer.cpp (original)
> +++ lld/trunk/COFF/Writer.cpp Wed Aug  2 16:19:54 2017
> @@ -65,8 +65,9 @@ public:
>        D->Type = COFF::IMAGE_DEBUG_TYPE_CODEVIEW;
>        D->SizeOfData = Record->getSize();
>        D->AddressOfRawData = Record->getRVA();
> -      // TODO(compnerd) get the file offset
> -      D->PointerToRawData = 0;
> +      OutputSection *OS = Record->getOutputSection();
> +      uint64_t Offs = OS->getFileOff() + (Record->getRVA() -
> OS->getRVA());
> +      D->PointerToRawData = Offs;
>
>        ++D;
>      }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/49f7bf87/attachment.html>


More information about the llvm-commits mailing list