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

debuginfo: Line-tables-only mode emits much more debuginfo than Clang #64405

Closed
michaelwoerister opened this issue Sep 12, 2019 · 3 comments · Fixed by #109808
Closed

debuginfo: Line-tables-only mode emits much more debuginfo than Clang #64405

michaelwoerister opened this issue Sep 12, 2019 · 3 comments · Fixed by #109808
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@michaelwoerister
Copy link
Member

We probably could emit less debuginfo when compiling with -Cdebuginfo=1 than we do at the moment. Clang 8.0 emits a lot less debuginfo when compiling with -gline-tables-only, with debuginfo not containing any DW_TAG_subprogram entries; while stepping through the code with gdb still works.

However, reducing the amount of debuginfo emitted should be done with care since external tools rely on the current behavior (see e.g. #60020).

@michaelwoerister michaelwoerister added C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Sep 12, 2019
@nagisa
Copy link
Member

nagisa commented Feb 14, 2021

How can we possibly reduce the amount of debug info in -Cdebuginfo=1 if external tools rely on it producing more without it being a breaking change?

@nagisa
Copy link
Member

nagisa commented Feb 14, 2021

The only route I see is adding more flags (-Cdebuginfo=0.5?).

@jyn514
Copy link
Member

jyn514 commented Mar 18, 2023

How can we possibly reduce the amount of debug info in -Cdebuginfo=1 if external tools rely on it producing more without it being a breaking change?

Changing the exact behavior of a codegen flag seems like a very liberal definition of "breaking" ... what if we added a new -C debuginfo=mixed flag that does what debuginfo=1 does today? and then reduced the amount we emit for =1? Firefox would have to change the flags they compile with, but that seems okay.

@bors bors closed this as completed in 700938c Apr 4, 2023
saethlin pushed a commit to saethlin/miri that referenced this issue Apr 10, 2023
Extend -Cdebuginfo with new options and named aliases

This is a rebase of rust-lang/rust#83947, along with my best guess at what the new options mean. I tried to follow the LLVM source code to get a better idea but ran into quite a lot of trouble (https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/go-to-definition.20in.20src.2Fllvm-project.3F). The description for the original PR follows below.

Note that the changes in this PR have already been through FCP: rust-lang/rust#83947 (comment)

Closes rust-lang/rust#109311. Helps with rust-lang/rust#104968.
r? `@michaelwoerister` cc `@cuviper`

---

The -Cdebuginfo=1 option was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for emitting line tables only was added. Additionally an option for emitting line info directives only was added, which is needed for some targets, i.e. nvptx. The debug info options should now behave similarly to clang's debug info options.

Fix rust-lang/rust#60020
Fix rust-lang/rust#64405
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.) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
3 participants