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

Two debuginfo tests fail with gdb 11.2 #94458

Closed
nertpinx opened this issue Feb 28, 2022 · 6 comments · Fixed by #95063
Closed

Two debuginfo tests fail with gdb 11.2 #94458

nertpinx opened this issue Feb 28, 2022 · 6 comments · Fixed by #95063
Labels
C-bug Category: This is a bug.

Comments

@nertpinx
Copy link

Building the compiler and running the tests on system with GDB 11.2 fails on current master (commit 97cde9f) with the following:

---- [debuginfo-gdb] debuginfo/borrowed-unique-basic.rs stdout ----
NOTE: compiletest thinks it is using GDB with native rust support
NOTE: compiletest thinks it is using GDB version 11002000

error: line not found in debugger output: $3 = 97
status: exit status: 0
command: "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/home/nert/dev/rust/build/x86_64-unknown-linux-gnu/test/debuginfo/borrowed-unique-basic.gdb/borrowed-unique-basic.debugger.script"
--- stdout -------------------------------
GNU gdb (Gentoo 11.2 vanilla) 11.2

... a little bit down we see ...

$2 = -1
$3 = 97 'a'
$4 = 68

and the same for src/test/debuginfo/borrowed-basic.rs.

The reason for that is pretty simple. GDB 11.2 added support for printing characters for Rust: https://sourceware.org/bugzilla/show_bug.cgi?id=28637 which is effective since the char type changed in debuginfo in #89887

@nertpinx nertpinx added the C-bug Category: This is a bug. label Feb 28, 2022
@nertpinx
Copy link
Author

I would also like to fix this as I found out about this while trying to go through https://rustc-dev-guide.rust-lang.org/ hoping to find a possibility for my first contribution.

My commit nertpinx@def7bb9 works for me, but is definitely not a great fix. I went on Zulip to ask about how to proceed and after some redirection I found out that someone asked for an issue to be filed, so hence this issue.

I can't think of much else about fixing this than the above commit with added ignore for gdb older than 11.2. What's the best way to continue? Create a draft PR? Or should I rather leave this alone so that I do not interfere since it is part of another change?

@matthiaskrgr
Copy link
Member

Getting this too.

running 268 tests
.iiiiiF....F..i..i.....i..i.ii.....i...i...............i...........iiiii....ii.......ii......i...... 100/268
.........ii..i.i.........i.......ii....i..i.....i........i..i.ii.....i...ii..i..i..ii.i............. 200/268
i.i.iii...ii.......ii......i...ii........i.....i..i......ii.i.......
failures:

---- [debuginfo-gdb] debuginfo/borrowed-basic.rs stdout ----
NOTE: compiletest thinks it is using GDB with native rust support
NOTE: compiletest thinks it is using GDB version 11002000

error: line not found in debugger output: $3 = 97
status: exit status: 0
command: "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/test/debuginfo/borrowed-basic.gdb/borrowed-basic.debugger.script"
--- stdout -------------------------------
GNU gdb (GDB) 11.2
Copyright (C) 2022 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-pc-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 0x1423: file /home/matthias/vcs/github/rust/src/test/debuginfo/borrowed-basic.rs, line 161.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Breakpoint 1, borrowed_basic::main () at /home/matthias/vcs/github/rust/src/test/debuginfo/borrowed-basic.rs:161
161	    zzz(); // #break
$1 = true
$2 = -1
$3 = 97 'a'
$4 = 68
$5 = -16
$6 = -32
$7 = -64
$8 = 1
$9 = 100
$10 = 16
$11 = 32
$12 = 64
$13 = 2.5
$14 = 3.5
A debugging session is active.

	Inferior 1 [process 109076] will be killed.

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


---- [debuginfo-gdb] debuginfo/borrowed-unique-basic.rs stdout ----
NOTE: compiletest thinks it is using GDB with native rust support
NOTE: compiletest thinks it is using GDB version 11002000

error: line not found in debugger output: $3 = 97
status: exit status: 0
command: "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/test/debuginfo/borrowed-unique-basic.gdb/borrowed-unique-basic.debugger.script"
--- stdout -------------------------------
GNU gdb (GDB) 11.2
Copyright (C) 2022 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-pc-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 0x37aa: file /home/matthias/vcs/github/rust/src/test/debuginfo/borrowed-unique-basic.rs, line 164.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Breakpoint 1, borrowed_unique_basic::main () at /home/matthias/vcs/github/rust/src/test/debuginfo/borrowed-unique-basic.rs:164
164	    zzz(); // #break
$1 = true
$2 = -1
$3 = 97 'a'
$4 = 68
$5 = -16
$6 = -32
$7 = -64
$8 = 1
$9 = 100
$10 = 16
$11 = 32
$12 = 64
$13 = 2.5
$14 = 3.5
A debugging session is active.

	Inferior 1 [process 109238] will be killed.

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



failures:
    [debuginfo-gdb] debuginfo/borrowed-basic.rs
    [debuginfo-gdb] debuginfo/borrowed-unique-basic.rs

test result: FAILED. 202 passed; 2 failed; 64 ignored; 0 measured; 0 filtered out; finished in 111.36s

@ratmice
Copy link
Contributor

ratmice commented Mar 2, 2022

How about just changing that to // gdb-command:print/d *char_ref, which should print the same on old gdb and new?

@ratmice
Copy link
Contributor

ratmice commented Mar 3, 2022

A more complicated but future looking fix could be adding [gdb-version, gdbr-version, gdbg-version]
PREFIXES to src/tools/compiletest/src/runtest.rs
I'm not sure if there is a better way of getting a parsable gdb version than something like:

gdb -ie 'interpreter-exec mi -gdb-version' --batch | head -n 1

This at least seems to avoid color styling output.
Edit: Seems like it would probably be a pain, as it'd probably need to actually be some form of version range

@nertpinx
Copy link
Author

nertpinx commented Mar 8, 2022

it's also possible to add

// gdbg-check: $3 = 97
// gdbr-check: $3 = 97 'a'

but I was not sure where to check what does it imply and where to find the definitions for these. I think that it is useful to check that gdb can actually display the character. Thanks @ratmice to pointing to the implementation of those. I'll try to look at that at some point, although it will probably take me quite some time O:-) so I do not want to promise anything.

@tromey
Copy link
Contributor

tromey commented Mar 18, 2022

I'm not sure if there is a better way of getting a parsable gdb version than something like:

FYI, just gdb --version works, the styling is disabled when output is not going to a tty.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Mar 19, 2022
…imulacrum

Fix debuginfo tests with GDB 11.2

GDB 11.2 added support for DW_ATE_UTF, which caused some test
failures.  This fixes these tests by changing the format that is used,
and adds a new test to verify that characters are emitted as something
that GDB can print in a char-like way.

Fixes rust-lang#94458
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 20, 2022
…ulacrum

Fix debuginfo tests with GDB 11.2

GDB 11.2 added support for DW_ATE_UTF, which caused some test
failures.  This fixes these tests by changing the format that is used,
and adds a new test to verify that characters are emitted as something
that GDB can print in a char-like way.

Fixes rust-lang#94458
@bors bors closed this as completed in 789eb08 Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants