<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:rennieallen@gmail.com" title="Keith Moon <rennieallen@gmail.com>"> <span class="fn">Keith Moon</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - clang on linux produces .pdb for windows target, but windbg won't load it"
   href="https://bugs.llvm.org/show_bug.cgi?id=34303">bug 34303</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>FIXED
           </td>
           <td>---
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - clang on linux produces .pdb for windows target, but windbg won't load it"
   href="https://bugs.llvm.org/show_bug.cgi?id=34303#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - clang on linux produces .pdb for windows target, but windbg won't load it"
   href="https://bugs.llvm.org/show_bug.cgi?id=34303">bug 34303</a>
              from <span class="vcard"><a class="email" href="mailto:rennieallen@gmail.com" title="Keith Moon <rennieallen@gmail.com>"> <span class="fn">Keith Moon</span></a>
</span></b>
        <pre>(In reply to Reid Kleckner from <a href="show_bug.cgi?id=34303#c1">comment #1</a>)
<span class="quote">> This was fixed in r306304. We forgot to fill in one of the fields of the
> debug directory:
> -      // TODO(compnerd) get the file offset
> -      D->PointerToRawData = 0;

> The dbghelp error message is actually quite helpful, because "MZ" is
> actually the magic for a DOS executable header. Our file offset was zero, so
> it tried to parse from there, and it printed the unrecognized magic.</span >

I pulled 306304 and I am still seeing the same issue:

$ clang -v -g2 -gcodeview -target x86_64-pc-windows-msvc18.0.0 -isystem
/home/rallen/clang/5.0/build/windows/include -isystem
/home/rallen/clang/5.0/build/windows/kits/10.0.10586/noarch/include -L
/home/rallen/clang/5.0/build/windows/amd64 -L
/home/rallen/clang/5.0/build/windows/kits/10.0.10586/win32-x86_64/lib
-fuse-ld=lld -Wno-msvc-not-found -o foo.exe foo.c
clang version 5.0.0 (trunk 306304)
Target: x86_64-pc-windows-msvc18.0.0
Thread model: posix
InstalledDir: /usr/local/bin
 "/usr/local/bin/clang-5.0" -cc1 -triple x86_64-pc-windows-msvc18.0.0 -emit-obj
-mrelax-all -mincremental-linker-compatible -disable-free -main-file-name foo.c
-mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-momit-leaf-frame-pointer -v -gcodeview -dwarf-column-info
-debug-info-kind=limited -debugger-tuning=gdb -resource-dir
/usr/local/lib/clang/5.0.0 -isystem
/home/rallen/clang/5.0/build/windows/include -isystem
/home/rallen/clang/5.0/build/windows/kits/10.0.10586/noarch/include
-internal-isystem /usr/local/lib/clang/5.0.0/include -Wno-msvc-not-found
-fdebug-compilation-dir /home/rallen/clang/5.0/build -ferror-limit 19
-fmessage-length 237 -fms-extensions -fms-compatibility
-fms-compatibility-version=18.0.0 -fno-threadsafe-statics
-fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/foo-31fd66.o -x c foo.c
clang -cc1 version 5.0.0 based upon LLVM 5.0.0svn-r306304 default target
x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /home/rallen/clang/5.0/build/windows/include
 /home/rallen/clang/5.0/build/windows/kits/10.0.10586/noarch/include
 /usr/local/lib/clang/5.0.0/include
End of search list.
 "/usr/local/bin/lld-link" -out:foo.exe -defaultlib:libcmt -libpath:lib/amd64
-libpath:/home/rallen/clang/5.0/build/windows/amd64
-libpath:/home/rallen/clang/5.0/build/windows/kits/10.0.10586/win32-x86_64/lib
-nologo -debug /tmp/foo-31fd66.o
rallen@RALLEN4-W7:~/clang/5.0/build$ !cp
cp foo.pdb foo.exe foo.c /mnt/c/temp

The results with WinDbg are identical.

CommandLine: C:\temp\foo.exe
Starting directory: c:\temp
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       cache*c:\temp
Deferred                                      
srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
Symbol search path is:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
Executable search path is: 
ModLoad: 00007ff6`1e390000 00007ff6`1e3b4400   foo.exe 
ModLoad: 00007ff8`09680000 00007ff8`0985b000   ntdll.dll
ModLoad: 00007ff8`078c0000 00007ff8`0796e000   C:\WINDOWS\System32\KERNEL32.DLL
ModLoad: 00007ff8`06090000 00007ff8`062d9000  
C:\WINDOWS\System32\KERNELBASE.dll
ModLoad: 00007ff8`06c60000 00007ff8`06d01000   C:\WINDOWS\System32\ADVAPI32.dll
ModLoad: 00007ff8`06bc0000 00007ff8`06c5d000   C:\WINDOWS\System32\msvcrt.dll
ModLoad: 00007ff8`07fd0000 00007ff8`08029000   C:\WINDOWS\System32\sechost.dll
ModLoad: 00007ff8`07b70000 00007ff8`07c95000   C:\WINDOWS\System32\RPCRT4.dll
ModLoad: 00007ff8`05580000 00007ff8`0558b000  
C:\WINDOWS\SYSTEM32\CRYPTBASE.DLL
ModLoad: 00007ff8`06b50000 00007ff8`06bba000  
C:\WINDOWS\System32\bcryptPrimitives.dll
(f14.21d0): Break instruction exception - code 80000003 (first chance)
SYMSRV:  BYINDEX: 0x1C
         c:\temp
         ntdll.pdb
         41D57AE3B178CDF490C0B78265127E9B1
SYMSRV:  PATH: c:\temp\ntdll.pdb\41D57AE3B178CDF490C0B78265127E9B1\ntdll.pdb
DBGHELP: c:\temp\ntdll.pdb\41D57AE3B178CDF490C0B78265127E9B1\ntdll.pdb already
cached
DBGHELP: c:\temp\ntdll.pdb\41D57AE3B178CDF490C0B78265127E9B1\ntdll.pdb already
cached

DBGHELP: ntdll - public symbols  
        c:\temp\ntdll.pdb\41D57AE3B178CDF490C0B78265127E9B1\ntdll.pdb
ntdll!LdrpDoDebuggerBreak+0x30:
00007ff8`097571b8 cc              int     3
0:000> .sympath
Symbol search path is:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
Expanded Symbol search path is:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       cache*c:\temp
Deferred                                      
srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
0:000> ld foo
DBGHELP: unrecognized OMF sig: 5a4d MZ*** WARNING: Unable to verify timestamp
for foo.exe
*** ERROR: Module load completed but symbols could not be loaded for foo.exe
DBGHELP: foo - no symbols loaded
Symbols loaded for foo


I'm sure you've fixed it somewhere, but it doesn/t seem to be in r306304.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>