Skip to content

Two debuginfo tests fail with gdb 11.2 #94458

Closed

Description

@nertpinx

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

Activity

  1. nertpinx commented on Feb 28, 2022

    @nertpinx
    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?

  2. matthiaskrgr commented on Mar 1, 2022

    @matthiaskrgr
    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
    
  3. ratmice commented on Mar 2, 2022

    @ratmice
    Contributor

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

  4. ratmice commented on Mar 3, 2022

    @ratmice
    Contributor

    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

  5. nertpinx commented on Mar 8, 2022

    @nertpinx
    Author

    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.

  6. tromey commented on Mar 18, 2022

    @tromey
    Contributor

    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.

  7. added 2 commits that reference this issue on Mar 19, 2022
    789eb08
    7ef2cfb
  8. added a commit that references this issue on Mar 20, 2022
    499d4a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions