Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-10671] Windows, linker fails on specific code with CodeView debug info enabled #53070

Closed
lxbndr opened this issue May 11, 2019 · 4 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself debug info Area → compiler → IRGen: Debug information emission Windows Platform: Windows

Comments

@lxbndr
Copy link
Contributor

lxbndr commented May 11, 2019

Previous ID SR-10671
Radar None
Original Reporter @lxbndr
Type Bug
Status Closed
Resolution Cannot Reproduce

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DebugInfo, Windows
Assignee None
Priority Medium

md5: 799b439c40c0d5a7ef17a3864cefc0a6

relates to:

  • SR-13225 Linker fails with CodeView debug info enabled

Issue Description:

Swift version 5.0-dev (LLVM 082dec2e22, Swift c2ecf6d9fb)

I guess it is something wrong with generated debug info. Linker still manages to produce PDB file, but llvm-pdbutil crashes trying to process that output.

Sample code which reproduces the issue:

main.swift

func foo() {
  _ = { (a: Int) in 
    var b = a 
    b = b + 1 
  } 
}

Output:

C:\Development\pdb-error>swiftc -emit-executable -g -debug-info-format=codeview main.swift -o main.exe
   Creating library main.lib and object main.exp
LINK : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
main-b752f6.o : fatal error LNK1318: Unexpected PDB error; OK (0) ''
clang++: error: linker command failed with exit code 1318 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1318 (use -v to see invocation)

Also attaching

@belkadan
Copy link
Contributor

cc @compnerd, but I don't think we support PDB yet at all.

@lxbndr
Copy link
Contributor Author

lxbndr commented May 13, 2019

It is msvc linker tries to process codeview debug info from compiler output. As I unerstand, codeview support is there, but limited at the moment. I believe I saw Saleem's post regarding codeview on forums. Maybe this case will be valuable. In general, most of my code processed well. I was able to run source-level debugging under msvs visual debugger, very impressive.

@compnerd
Copy link
Collaborator

@belkadan - actually, we do 🙂. We can emit debug info in CodeView and generate PDBs in a number of cases. That enables single stepping through code with WinDBG (lldb is not particularly useful atm, so this is the best debugging option currently).

Yeah, this seems like we are generating some incorrect CodeView in the frontend unfortunately.

@lxbndr
Copy link
Contributor Author

lxbndr commented Jul 15, 2020

Closing as it is not reproducible anymore under specified conditions. New steps reported as SR-13225.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself debug info Area → compiler → IRGen: Debug information emission Windows Platform: Windows
Projects
None yet
Development

No branches or pull requests

3 participants