-
Notifications
You must be signed in to change notification settings - Fork 13k
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
1.48 beta test failures, debuginfo-gdb 9.2 -> 10.1 #79009
Comments
Can you verify that gdb 9.2 still passes with 1.48 beta? (Not sure how easy that is for you) Regardless, it seems like this is probably too difficult for us to land a fix for in the next few days in time for 1.48, and it does not seem like a release blocker to me. |
@Mark-Simulacrum It's not easy for me to run the whole build - sadly Debian deletes old versions from the main archive when they get updated. However I still have gdb 9.2 locally and I can confirm running a random sample of these tests by hand against rustc 1.48 & gdb 9.2 does appear to produce the correct expected output. The differences appear minor except that in generator-objects the output is 9.2/expected:non-null vs 10:null which is slightly concerning, so someone with more in-depth knowledge about gdb & rust should look into this further. |
Assigning |
Same errors here:
failures:
[debuginfo-gdb] debuginfo/extern-c-fn.rs
[debuginfo-gdb] debuginfo/generator-objects.rs
[debuginfo-gdb] debuginfo/issue-57822.rs
[debuginfo-gdb] debuginfo/pretty-huge-vec.rs
test result: FAILED. 85 passed; 4 failed; 27 ignored; 0 measured; 0 filtered out; finished in 7.56s I have also confirmed these errors are not happening using v9. To reproduce: gdb --version # GNU gdb (GDB) Fedora 10.1-2.fc33
./x.py test # those 4 tests failed
sudo dnf downgrade -y gdb
gdb --version # GNU gdb (GDB) Fedora 9.2-7.fc33
./x.py test # all tests ok |
I can reproduce also on GNU Guix, even in 1.49 when using GDB 10. The debuginfo tests pass when using GDB 8.2. |
I'm also getting this on Fedora 33 with the same versions of everything as @jesusprubio. I have tried both with and without the package |
@rustbot claim I encountered this issue on Arch Linux using GDB 10.1. Then I built the latest GDB from source and the problem remains the same. So I spent some time to investigate why the problem occurs. As said by @infinity0, there are actually two separate problems. The first one is minor. It simply means that with respect to the Rust language, GDB won't try to interpret pointers as strings anymore. We can see the offending commit here ( Another problem seems to be very strange and slightly concerning. The test cases revealed that GDB would interpret generators as First, generators are treated as special enums when generating debug-info. rust/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs Lines 675 to 683 in 8212de8
In the original test cases, generators are parsed as structs instead of enums. It indeed shows that something must be wrong. rust/src/test/debuginfo/generator-objects.rs Lines 9 to 10 in 8212de8
GDB 10 "fixes" this problem. I'm not sure whether or not the behavior is intended, either. But anyway, generators are parsed as enums in newer GDB. The corresponding commit is here. Unfortunately, rustc does not produce the correct debug-info. At least, GDB fails to understand it correctly. Normally, an enum has an external discriminant and some internal structures or tuples that share the same memory space. The discriminant is used to pick one specific structure or tuple, and it is marked as artificial. When printing an enum, GDB will always choose the first non-artificial field (i.e. the specific structure or tuple). We can see the code here and here. Besides the discriminant, generators can have other external fields. They are used to track variable that are defined outside the closure but used inside the closure. The key problem is that rustc forgets to mark them as artificial. Therefore, GDB selects one external field to print. In our test case, the external field is actually rust/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs Lines 2174 to 2188 in 8212de8
I have tried to fix the problem and now we can get something like:
I think it looks good. I'll open PRs for the issue after some code cleanup. |
As mentioned in rust-lang#79009, there are four failed debuginfo test cases when using GDB 10. This commit fixes two of them, which fail because GDB 10 won't print pointers as string anymore. We can use `printf` as a workaround. It should work regardless of the version of GDB. Refer this [comment] for more details. [comment]: rust-lang#79009 (comment)
…crum Fix failed tests related to pointer printing when using GDB 10 As mentioned in rust-lang#79009, there are four failed debuginfo test cases when using GDB 10. This PR fixes two of them, which fail because GDB 10 won't print pointers as string anymore. We can use `printf` as a workaround. It should work regardless of the version of GDB. Refer this [comment] for more details. [comment]: rust-lang#79009 (comment)
- Literally, variants are not artificial. We have `yield` statements, upvars and inner variables in the source code. - Functionally, we don't want debuggers to suppress the variants. It contains the state of the generator, which is useful when debugging. So they shouldn't be marked artificial. - Debuggers may use artificial flags to find the active variant. In this case, marking variants artificial will make debuggers not work properly. Fixes rust-lang#79009.
Fix debuginfo for generators First, all fields except the discriminant (including `outer_fields`) should be put into structures inside the variant part, which gives an equivalent layout but offers us much better integration with debuggers. Second, artificial flags in generator variants should be removed. - Literally, variants are not artificial. We have `yield` statements, upvars and inner variables in the source code. - Functionally, we don't want debuggers to suppress the variants. It contains the state of the generator, which is useful when debugging. So they shouldn't be marked artificial. - Debuggers may use artificial flags to find the active variant. In this case, marking variants artificial will make debuggers not work properly. Fixes rust-lang#79009. And refer https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Debuginfo.20for.20generators.
Fix debuginfo for generators First, all fields except the discriminant (including `outer_fields`) should be put into structures inside the variant part, which gives an equivalent layout but offers us much better integration with debuggers. Second, artificial flags in generator variants should be removed. - Literally, variants are not artificial. We have `yield` statements, upvars and inner variables in the source code. - Functionally, we don't want debuggers to suppress the variants. It contains the state of the generator, which is useful when debugging. So they shouldn't be marked artificial. - Debuggers may use artificial flags to find the active variant. In this case, marking variants artificial will make debuggers not work properly. Fixes rust-lang#62572. Fixes rust-lang#79009. And refer https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Debuginfo.20for.20generators.
Fix debuginfo for generators First, all fields except the discriminant (including `outer_fields`) should be put into structures inside the variant part, which gives an equivalent layout but offers us much better integration with debuggers. Second, artificial flags in generator variants should be removed. - Literally, variants are not artificial. We have `yield` statements, upvars and inner variables in the source code. - Functionally, we don't want debuggers to suppress the variants. It contains the state of the generator, which is useful when debugging. So they shouldn't be marked artificial. - Debuggers may use artificial flags to find the active variant. In this case, marking variants artificial will make debuggers not work properly. Fixes rust-lang#62572. Fixes rust-lang#79009. And refer https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Debuginfo.20for.20generators.
This is with 1.48.0-beta.8, and previously these all passed in 1.47.0. On Debian I see these failures on all architectures. The main difference is we are using gdb 10 now, gdb 9.2 previously. The other debuginfo tests pass fine.
test [debuginfo-gdb] debuginfo/extern-c-fn.rs ... FAILED
test [debuginfo-gdb] debuginfo/generator-objects.rs ... FAILED
test [debuginfo-gdb] debuginfo/issue-57822.rs ... FAILED
test [debuginfo-gdb] debuginfo/pretty-huge-vec.rs ... FAILED
The text was updated successfully, but these errors were encountered: