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

Poor debug info in optimized code #53036

Closed
jsgf opened this issue Aug 3, 2018 · 5 comments
Closed

Poor debug info in optimized code #53036

jsgf opened this issue Aug 3, 2018 · 5 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jsgf
Copy link
Contributor

jsgf commented Aug 3, 2018

At the moment debugging optimized code is pretty tricky. Even with full debug info enabled, most/all of the locals and parameters are <optimized out>. (Linux + gdb)

I believe that DWARF can include info to regenerate the logical value of a variable that has been removed by optimization. Is this something llvm needs to support, or rustc, or both?

In general how can this be improved?

cc @tromey @Mark-Simulacrum

@cuviper
Copy link
Member

cuviper commented Aug 4, 2018

I expect that's totally up to LLVM.

GCC has had a few DW_OP_GNU_* extensions that are now in DWARF5, like DW_OP_entry_value and DW_OP_implicit_pointer, which are useful for recovering optimized values. I don't see anything creating those in LLVM -- just basic declarations in their Dwarf.def.

@cuviper cuviper added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 6, 2018
@tromey
Copy link
Contributor

tromey commented Aug 9, 2018

The way to check a specific case is to following the instructions here: https://rust-lang-nursery.github.io/rustc-guide/compiler-debugging.html#debugging-llvm. In particular what you want to do is compile a small test program, have it emit the LLVM IR (see the discussion of -C llvm-args=-print-after-all), and then search through the dumps to see when the debug information is lost.

@tromey
Copy link
Contributor

tromey commented Aug 9, 2018

Bug #46698 is a specific case to still be investigated, FWIW.

@nical
Copy link
Contributor

nical commented Sep 25, 2018

I expect that's totally up to LLVM.

For what it's worth, Gecko's code when compiled with LLVM contains both a lot of C++ and a lot of Rust at this point, and the debug information we are getting from Rust code in optimized builds are a lot worse than the C++ ones.
If there is any kind of massaging that can be done by rustc to make LLVM happier in that regard, it could potentially make a big difference for the productivity of Gecko developers. At the moment crash reports in Rust code are quite a bit harder to investigate.

@steveklabnik
Copy link
Member

Triage: while this bug does contain one specific case, it's also very general. We have a bunch of bugs open related to debuginfo not being sufficient. I'm going to make a judgement call and give this one a close. Please file follow-up issues for specific things that can be improved, if issues aren't open already. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants