[llvm-bugs] [Bug 34303] New: clang on linux produces .pdb for windows target, but windbg won't load it

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 23 15:09:43 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34303

            Bug ID: 34303
           Summary: clang on linux produces .pdb for windows target, but
                    windbg won't load it
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rennieallen at gmail.com
                CC: llvm-bugs at lists.llvm.org

Build a hello world executable like so:

$ clang -v -g -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 -o foo.exe foo.c

Result:

foo.exe and foo.pdb produced.

Run llvm-pdbutil on foo.pdb:

$ llvm-pdbutil dump -summary foo.pdb


                          Summary
============================================================
  Block Size: 4096
  Number of blocks: 1016
  Number of streams: 204
  Signature: 1503524810
  Age: 1
  GUID: {6149EB78-991F-EFD5-2DBE-E79C367E29D5}
  Features: 0x1
  Has Debug Info: true
  Has Types: true
  Has IDs: true
  Has Globals: false
  Has Publics: true
  Is incrementally linked: false
  Has conflicting types: false
  Is stripped: false

So far, nothing looks amiss. 

Copy foo.exe+foo.pdb to a windows volume (/mnt/c/temp) then use WinDbg to load
foo.exe.

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

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       cache*c:\temp
Deferred                                      
srv*https://msdl.microsoft.com/download/symbols
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*https://msdl.microsoft.com/download/symbols
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*https://msdl.microsoft.com/download/symbols
Symbol search path is:
cache*c:\temp;srv*https://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00007ff7`35240000 00007ff7`35264400   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

Check the sympath:

0:000> .sympath
Symbol search path is:
cache*c:\temp;srv*https://msdl.microsoft.com/download/symbols
Expanded Symbol search path is:
cache*c:\temp;srv*https://msdl.microsoft.com/download/symbols

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       cache*c:\temp
Deferred                                      
srv*https://msdl.microsoft.com/download/symbols

Module list:

:000> lm
start             end                 module name
00007ff7`35240000 00007ff7`35264400   foo      T (no symbols)           
00007ff8`05580000 00007ff8`0558b000   CRYPTBASE   (deferred)             
00007ff8`06090000 00007ff8`062d9000   KERNELBASE   (deferred)             
00007ff8`06b50000 00007ff8`06bba000   bcryptPrimitives   (deferred)             
00007ff8`06bc0000 00007ff8`06c5d000   msvcrt     (deferred)             
00007ff8`06c60000 00007ff8`06d01000   ADVAPI32   (deferred)             
00007ff8`078c0000 00007ff8`0796e000   KERNEL32   (deferred)             
00007ff8`07b70000 00007ff8`07c95000   RPCRT4     (deferred)             
00007ff8`07fd0000 00007ff8`08029000   sechost    (deferred)             
00007ff8`09680000 00007ff8`0985b000   ntdll      (pdb symbols)         
c:\temp\ntdll.pdb\41D57AE3B178CDF490C0B78265127E9B1\ntdll.pdb

Now attempt to load symbols for foo:

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

The issue appears to be the unrecognized OMF sig.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170823/bc07771e/attachment-0001.html>


More information about the llvm-bugs mailing list