-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Should debuggers treat ZSTs initializers as code to step through? #97083
Copy link
Copy link
Closed
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-needs-decisionIssue: In need of a decision.Issue: In need of a decision.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-needs-decisionIssue: In need of a decision.Issue: In need of a decision.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Spawned off of #33013 (comment)
If you look at the beginning of the example there:
the first two variables,
aandb, are both ZSTs.When you run this in a debugger and try to step though each statement, like so:
you can see that the gdb
nextcommand has "skipped" the initialization ofaandb.This is understandable to a Rust expert, because
aandbare both zero-sized types, and so no code is generated for initializing those local variables.But for a Rust beginner, it is confusing.
If we wanted to, we could make
-gmode deal with this. For example, we could generatenop's for such initializers, and then give thenop's corresponding debug info. But that is also pessimizing the code generation to accommodate beginners.This is something we need to make a decision on whether it is an actual bug we would like to fix or not.