Skip to content

Copy .pdb files to target directory#5179

Merged
bors merged 2 commits intorust-lang:masterfrom
matklad:uplink-pdb
Mar 14, 2018
Merged

Copy .pdb files to target directory#5179
bors merged 2 commits intorust-lang:masterfrom
matklad:uplink-pdb

Conversation

@matklad
Copy link
Contributor

@matklad matklad commented Mar 14, 2018

.pdb files are for windows debug info (unlike on linux, debug info is
in a separate file). Windows executable actually hard-code paths to
.pdb files, so debugging mvsc rust programs works even without this
patch. However, if you want to distribute the executable to other
machines, you'd better distribute both foo.exe and foo.pdb, because
absolute paths won't work on another machine. Having same-named .pdb
file alongside the binary would work though.

closes #4960

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is exactly what we want.

If you crate is a

[lib]
crate-type = [ "cdylib" ]

you might actually be interested in debuginfo as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True yeah, but I think it's fine to always fix that in a follow up (or when it arises)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may also want a target_env filter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! Updated!

`.pdb` files are for windows debug info (unlike on linux, debug info is
in a separate file). Windows executable actually hard-code paths to
`.pdb` files, so debugging mvsc rust programs works even without this
patch. However, if you want to distribute the executable to other
machines, you'd better distribute both `foo.exe` and `foo.pdb`, because
absolute paths won't work on another machine. Having same-named .pdb
file alongside the binary would work though.

closes rust-lang#4960
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 14, 2018

📌 Commit 9c0d3f2 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 14, 2018

⌛ Testing commit 9c0d3f2 with merge 4b8872f9d70bba93df69fa9ef4da7e520a172838...

@bors
Copy link
Contributor

bors commented Mar 14, 2018

💔 Test failed - status-appveyor

Depending on the OS, there might be an additional artifacts for
debuginfo (dSYM folder for macs, .pbd file for windows). Given that we
can't disable `.pdb` for windows[1], let's just ignore all filenames!

[1]: rust-lang/rust#28505)
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 14, 2018

📌 Commit f930609 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 14, 2018

⌛ Testing commit f930609 with merge 83a3084...

bors added a commit that referenced this pull request Mar 14, 2018
Copy `.pdb` files to `target` directory

`.pdb` files are for windows debug info (unlike on linux, debug info is
in a separate file). Windows executable actually hard-code paths to
`.pdb` files, so debugging mvsc rust programs works even without this
patch. However, if you want to distribute the executable to other
machines, you'd better distribute both `foo.exe` and `foo.pdb`, because
absolute paths won't work on another machine. Having same-named .pdb
file alongside the binary would work though.

closes #4960
@bors
Copy link
Contributor

bors commented Mar 14, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 83a3084 to master...

@bors bors merged commit f930609 into rust-lang:master Mar 14, 2018
@matklad matklad deleted the uplink-pdb branch March 17, 2018 08:39
@ehuss ehuss added this to the 1.26.0 milestone Feb 6, 2022
lf- added a commit to lf-/cargo that referenced this pull request Sep 19, 2023
EFI also uses the PE format with .pdb files, and rustc generates them,
but Cargo does not copy them out of target/*/deps. This is an oversight,
so this PR fixes it.

Related: rust-osdev/uefi-rs#289
Related: rust-lang#5179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cargo does not reliably copy pdb to target folder on x64_64-pc-windows-msvc

5 participants