`rustc` failed to pass `debuginfo` testsuite when using GDB 15
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing tests named in tests/debuginfo/embedded-visualizer.rs and tests/debuginfo/include_string.rs, then inspect src/etc/gdb_load_rust_pretty_printers.py. Run the debuginfo tests with GDB 15 and compare the debugger output and errors to determine whether rustc, the in-repository pretty printer, or GDB is responsible; done means the affected tests pass or the ownership of the incompatibility is established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100