-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Wrong and missing information in PDB file #96475
Comments
I've take a shot fixing this issue and have a working fix. Note that have very little knowlege in that code area, so this is probably not ideal: The problem seems that Arg0 and CommandLineArgs of the MCTargetOptions cpp class are not set here:
My fix would now set thise member in the mentioned function. However, due to pointer lifetime requirements I had to add another function which saves the commandline args for the programs duration in the passwrapper. I have a draft here: This should now fix the missing path to the build tool, as well as missing commandline. I have no clue what to do about the 3rd point 'source file is wrong, e.g. it is "src\main.rs@\2j9iw9kw1zbigor6" where it should be "src\main.rs"'. As far as I understand there can only be a single file, which would be the cpp in C++. Due to n:m mapping of sourcfiles to cgus, the current value of root rs file + cgu name makes sense to me as it is. However, I found a "workaround": Using Dia2Dump one can find all .rs files for a given cgu in the *** FILES section. So while the information might not be as nice, the info must be present in the PDB so this should be good enough? |
You are correct, the compiland environment in the PDB only supports one file being specified as source file. By the way, how are these names of cgus generated? Is this a hash of the contents? Or just some unique identifier?
Yes, that should be enough. I can give your changes a try as soon as they land in a nightly build. |
The cgu name is a unique identifier. The exact format depends on if incremental mode is enabled or not and if the flag to use human readable cgu names is used or not. I'm not sure where the
If you |
Add CL and CMD into to pdb debug info Partial fix for rust-lang#96475 The Arg0 and CommandLineArgs of the MCTargetOptions cpp class are not set within https://github.com/rust-lang/rust/blob/bb548f964572f7fe652716f5897d9050a31c936e/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L378 This causes LLVM to not neither output any compiler path (cl) nor the arguments that were used when invoking it (cmd) in the PDB file. This fix adds the missing information to the target machine so LLVM can use it.
Add CL and CMD into to pdb debug info Partial fix for rust-lang/rust#96475 The Arg0 and CommandLineArgs of the MCTargetOptions cpp class are not set within https://github.com/rust-lang/rust/blob/bb548f964572f7fe652716f5897d9050a31c936e/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L378 This causes LLVM to not neither output any compiler path (cl) nor the arguments that were used when invoking it (cmd) in the PDB file. This fix adds the missing information to the target machine so LLVM can use it.
This comment was marked as outdated.
This comment was marked as outdated.
It is generally better to open a new issue rather than on an old closed one. |
Apologies for that. I've moved this to #128842. |
Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd Update the unit test for checking cl and cmd in LF_BUILDINFO. With llvm-pdbutil we can now more specifically check if the string appears at the right location instead of just checking whether the string exists at all. Context: rust-lang#96475
Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd Update the unit test for checking cl and cmd in LF_BUILDINFO. With llvm-pdbutil we can now more specifically check if the string appears at the right location instead of just checking whether the string exists at all. Context: rust-lang#96475
Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd Update the unit test for checking cl and cmd in LF_BUILDINFO. With llvm-pdbutil we can now more specifically check if the string appears at the right location instead of just checking whether the string exists at all. Context: rust-lang#96475
Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd Update the unit test for checking cl and cmd in LF_BUILDINFO. With llvm-pdbutil we can now more specifically check if the string appears at the right location instead of just checking whether the string exists at all. Context: rust-lang#96475
Rollup merge of rust-lang#130156 - nebulark:test_buildinfo, r=jieyouxu Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd Update the unit test for checking cl and cmd in LF_BUILDINFO. With llvm-pdbutil we can now more specifically check if the string appears at the right location instead of just checking whether the string exists at all. Context: rust-lang#96475
With both Rust 1.60 stable as well as the latest nightly (rustc 1.62.0-nightly (082e4ca 2022-04-26)), rustc currently does not emit correct S_OBJNAME records and LF_BUILDINFO records into the PDB on Windows.
Steps to reproduce:
S_OBJNAME:
The S_OBJNAME record is stored in the PDB for each module stream, and contains the full path to the compiled .o file. This is supported by LLVM at: https://github.com/llvm/llvm-project/blob/9592e88f59cfd399e9285cfec50a23675f43a43a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp#L783
At the moment, this record is empty for all .o files stored in a PDB.
LF_BUILDINFO:
Similarly, the LF_BUILDINFO record stores the following information for each module stream in the PDB:
This is supported by LLVM at: https://github.com/llvm/llvm-project/blob/9592e88f59cfd399e9285cfec50a23675f43a43a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp#L920
At the moment, with rustc there are the following defects in the LF_BUILDINFO record:
Tools like Live++ (https://liveplusplus.tech) need this information in order to be able to recompile individual .o files.
The relevant Zulip discussion can be found here: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Live.2B.2B.20for.20Rust
The text was updated successfully, but these errors were encountered: