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

rustc failed to pass debuginfo testsuite when using GDB 15 #122751

Open
liushuyu opened this issue Mar 19, 2024 · 2 comments
Open

rustc failed to pass debuginfo testsuite when using GDB 15 #122751

liushuyu opened this issue Mar 19, 2024 · 2 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-debugging Working group: Bad Rust debugging experiences

Comments

@liushuyu
Copy link
Contributor

Recently, I tried building rustc on my system with a pre-release GDB version (15.0-git, commit: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1ab9eefe3cea741aba17e11ff28ed48ac3a8293a) and I encountered a lot of debuginfo test failures.

Some examples:

Click to see example failures

NOTE: compiletest thinks it is using GDB version 15000050
executing PYTHONPATH="/<<PKGBUILDDIR>>/./src/etc" "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/embedded-visualizer.gdb/embedded-visualizer.debugger.script"
------stdout------------------------------
GNU gdb (Ubuntu 15.0.50.20240312-0ubuntu1) 15.0.50.20240312-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Breakpoint 1 at 0x1fcd: file tests/debuginfo/embedded-visualizer.rs, line 107.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, embedded_visualizer::main () at tests/debuginfo/embedded-visualizer.rs:107
107	    zzz(); // #break
Loaded  Script                                                                 
Yes     gdb_load_rust_pretty_printers.py                                       
	full name: /<<PKGBUILDDIR>>/src/etc/gdb_load_rust_pretty_printers.py
Yes     pretty-printer-embedded_visualizer-0                                   
Yes     pretty-printer-embedded_visualizer-1                                   
Yes     pretty-printer-embedded_visualizer-2                                   
$1 = (0, 0)
$2 = (5, 8)
$3 = ((0, 0), (5, 8))
$4 = alloc::string::String {vec: alloc::vec::Vec<u8, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {ptr: core::ptr::unique::Unique<u8> {pointer: core::ptr::non_null::NonNull<u8> {pointer: 0x55555555aba0}, _marker: core::marker::PhantomData<u8>}, cap: 8, alloc: alloc::alloc::Global}, len: 8}} is 10 years old.
A debugging session is active.

	Inferior 1 [process 176000] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]

------stderr------------------------------
Python Exception <class 'NameError'>: name '__file__' is not defined

------------------------------------------

error: check directive(s) from `/<<PKGBUILDDIR>>/tests/debuginfo/embedded-visualizer.rs` not found in debugger output. errors:
    (embedded-visualizer.rs:60) `$4 = "Person A" is 10 years old.`
the following subset of check directive(s) was found successfully:
    (embedded-visualizer.rs:51) `Yes     pretty-printer-embedded_visualizer-0                                   `
    (embedded-visualizer.rs:52) `Yes     pretty-printer-embedded_visualizer-1                                   `
    (embedded-visualizer.rs:54) `$1 = (0, 0)`
    (embedded-visualizer.rs:56) `$2 = (5, 8)`
    (embedded-visualizer.rs:58) `$3 = ((0, 0), (5, 8))`
status: exit status: 0
command: PYTHONPATH="/<<PKGBUILDDIR>>/./src/etc" "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/embedded-visualizer.gdb/embedded-visualizer.debugger.script"
--- stdout -------------------------------
GNU gdb (Ubuntu 15.0.50.20240312-0ubuntu1) 15.0.50.20240312-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Breakpoint 1 at 0x1fcd: file tests/debuginfo/embedded-visualizer.rs, line 107.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, embedded_visualizer::main () at tests/debuginfo/embedded-visualizer.rs:107
107	    zzz(); // #break
Loaded  Script                                                                 
Yes     gdb_load_rust_pretty_printers.py                                       
	full name: /<<PKGBUILDDIR>>/src/etc/gdb_load_rust_pretty_printers.py
Yes     pretty-printer-embedded_visualizer-0                                   
Yes     pretty-printer-embedded_visualizer-1                                   
Yes     pretty-printer-embedded_visualizer-2                                   
$1 = (0, 0)
$2 = (5, 8)
$3 = ((0, 0), (5, 8))
$4 = alloc::string::String {vec: alloc::vec::Vec<u8, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {ptr: core::ptr::unique::Unique<u8> {pointer: core::ptr::non_null::NonNull<u8> {pointer: 0x55555555aba0}, _marker: core::marker::PhantomData<u8>}, cap: 8, alloc: alloc::alloc::Global}, len: 8}} is 10 years old.
A debugging session is active.

	Inferior 1 [process 176000] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
------------------------------------------
--- stderr -------------------------------
Python Exception <class 'NameError'>: name '__file__' is not defined
------------------------------------------


---- [debuginfo-gdb] tests/debuginfo/include_string.rs stdout ----


NOTE: compiletest thinks it is using GDB with native rust support
executing RUSTC_ICE="0" "/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/<<PKGBUILDDIR>>/tests/debuginfo/include_string.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/<<PKGBUILDDIR>>/debian/cargo" "--sysroot" "/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/include_string.gdb/a" "-A" "internal_features" "-Crpath" "-Lnative=/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Clinker=x86_64-linux-gnu-gcc" "-L" "/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/include_string.gdb/auxiliary" "-g"
------stdout------------------------------

------stderr------------------------------

------------------------------------------
NOTE: compiletest thinks it is using GDB version 15000050
executing PYTHONPATH="/<<PKGBUILDDIR>>/./src/etc" "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/include_string.gdb/include_string.debugger.script"
------stdout------------------------------
GNU gdb (Ubuntu 15.0.50.20240312-0ubuntu1) 15.0.50.20240312-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Breakpoint 1 at 0x12b3: file tests/debuginfo/include_string.rs, line 42.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, include_string::main () at tests/debuginfo/include_string.rs:42
42	    zzz(); // #break

------stderr------------------------------
/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/include_string.gdb/include_string.debugger.script:11: Error in sourced command file:
Attempt to extract a component of a value that is not a structure.

------------------------------------------

error: gdb failed to execute
status: exit status: 1
command: PYTHONPATH="/<<PKGBUILDDIR>>/./src/etc" "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/include_string.gdb/include_string.debugger.script"
--- stdout -------------------------------
GNU gdb (Ubuntu 15.0.50.20240312-0ubuntu1) 15.0.50.20240312-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Breakpoint 1 at 0x12b3: file tests/debuginfo/include_string.rs, line 42.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, include_string::main () at tests/debuginfo/include_string.rs:42
42	    zzz(); // #break
------------------------------------------
--- stderr -------------------------------
/<<PKGBUILDDIR>>/build/x86_64-unknown-linux-gnu/test/debuginfo/include_string.gdb/include_string.debugger.script:11: Error in sourced command file:
Attempt to extract a component of a value that is not a structure.
------------------------------------------

I am unsure if this is a rustc problem, a GDB pretty printer problem or a GDB problem. This is likely due to a GDB behaviour change, and I tried bisecting the changes for GDB. Then I discovered this commit: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b0dd661fa16a424f059b1e1d80e779508b1a9a12.

I don't know if this issue should be resolved from rustc, in-repository GDB pretty-printer or GDB itself. Can anyone give me some pointers?

Meta

rustc --version --verbose:

rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-unknown-linux-gnu
release: 1.76.0
LLVM version: 17.0.6

Backtrace

N/A

@liushuyu liushuyu added the C-bug Category: This is a bug. label Mar 19, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 19, 2024
@jieyouxu jieyouxu added A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2024
@workingjubilee workingjubilee added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) WG-debugging Working group: Bad Rust debugging experiences labels Mar 20, 2024
@liushuyu
Copy link
Contributor Author

I have requested a Bugzilla account on the GDB upstream and opened a bug report there: https://sourceware.org/bugzilla/show_bug.cgi?id=31517

@tromey
Copy link
Contributor

tromey commented Mar 21, 2024

This is due to the rewrite of unsized type handling in gdb. Details in the gdb bug.

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 21, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 16, 2024
Disable two debuginfo tests failing under the future GDB 15 release

As seen in rust-lang#123960, it seems two of our debuginfo tests started failing on gdb 15, which is also already in use in the `x86_64-gnu-llvm-18` builder: CI will randomly start to fail whenever this cached docker image expires.

This PR disables the following two tests under gdb 15+, to prevent future CI failures.

- `tests/debuginfo/include_string.rs`
- `tests/debuginfo/vec-slices.rs`

This seems very much related to https://sourceware.org/bugzilla/show_bug.cgi?id=30330 and https://sourceware.org/bugzilla/show_bug.cgi?id=31517 -- and I just now saw rust-lang#122751 as well, where one of these bugzilla issues and one of the two test failures here was previously mentioned.

I don't know whether these are unexpected gdb changes, or if we need to change our tests as it seems some of the gdb changes are definitely intentional, so I'll just cc `@rust-lang/wg-debugging` and `@tromey.`

(In the same area, `tests/debuginfo/unsized.rs` was previously disabled due to https://sourceware.org/bugzilla/show_bug.cgi?id=30330. This issue has been fixed but I don't believe our test passes, so it's in the same boat as the 2 above regarding whether this test is expected to work or needs changes as well)

r? wg-debugging

I've confirmed this is enough to have CI pass on gdb 15 with the llvm 18 builder.
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-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-debugging Working group: Bad Rust debugging experiences
Projects
None yet
Development

No branches or pull requests

5 participants