[Bug testsuite/25048] FAIL: gdb.rust/simple.exp: print k

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Wed Oct 9 21:57:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=25048

--- Comment #10 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a50faaf6207b7556f691369097cd5bf903298794

commit a50faaf6207b7556f691369097cd5bf903298794
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Oct 9 23:57:11 2019 +0200

    [gdb/testsuite] Add XFAILs in gdb.rust/simple.exp for incorrect DWARF

    On openSUSE Leap 15.1 using rustc version 1.36.0 (using llvm 7), I get:
    ...
    (gdb) PASS: gdb.rust/simple.exp: print e2.0
    print k^M
    $54 = simple::SpaceSaver::Thebox(40, 0x0)^M
    (gdb) FAIL: gdb.rust/simple.exp: print k
    ...
    while we're expecting:
    ...
    gdb_test "print k" " = simple::SpaceSaver::Nothing"
    ...

    When using a relatively recent version of Rust with a somewhat older
version
    of LLVM, the Rust compiler will emit a legacy encoding of enums (see also
    quirk_rust_enum in dwarf2read.c).

    So, the variable k:
    ...
     <17><3d58>: Abbrev Number: 15 (DW_TAG_variable)
        <3d59>   DW_AT_location    : 3 byte block: 91 b8 4  (DW_OP_fbreg: 568)
        <3d5d>   DW_AT_name        : (indirect string, offset: 0xf9a): k
        <3d61>   DW_AT_alignment   : 1
        <3d62>   DW_AT_decl_file   : 1
        <3d63>   DW_AT_decl_line   : 129
        <3d64>   DW_AT_type        : <0x4232>
    ...
    has type:
    ...
     <2><4232>: Abbrev Number: 11 (DW_TAG_union_type)
        <4233>   DW_AT_name        : (indirect string, offset: 0x3037):
SpaceSaver
        <4237>   DW_AT_byte_size   : 16
        <4238>   DW_AT_alignment   : 8
     <3><4239>: Abbrev Number: 9 (DW_TAG_member)
        <423a>   DW_AT_name        : (indirect string, offset: 0x29f5):
RUST$ENCODED$ENUM$0$Nothing
        <423e>   DW_AT_type        : <0x4245>
        <4242>   DW_AT_alignment   : 8
        <4243>   DW_AT_data_member_location: 0
    ...

    The "RUST$ENCODED$ENUM$0$Nothing" means that field 0 is both a pointer and
a
    discriminant, and if the value is 0, then the enum is just a data-less
variant
    named "Nothing".

    However, the corresponding type has two fields, where not field 0 but field
1
    is a pointer, and field 0 is a byte:
    ...
     <2><4245>: Abbrev Number: 8 (DW_TAG_structure_type)
        <4246>   DW_AT_name        : (indirect string, offset: 0x2a11): Thebox
        <424a>   DW_AT_byte_size   : 16
        <424b>   DW_AT_alignment   : 8
     <3><424c>: Abbrev Number: 9 (DW_TAG_member)
        <424d>   DW_AT_name        : (indirect string, offset: 0x670): __0
        <4251>   DW_AT_type        : <0x436b>
        <4255>   DW_AT_alignment   : 1
        <4256>   DW_AT_data_member_location: 8
     <3><4257>: Abbrev Number: 9 (DW_TAG_member)
        <4258>   DW_AT_name        : (indirect string, offset: 0x1662): __1
        <425c>   DW_AT_type        : <0x45da>
        <4260>   DW_AT_alignment   : 8
        <4261>   DW_AT_data_member_location: 0
    ...

    Mark this as xfail.

    gdb/testsuite/ChangeLog:

    2019-10-09  Tom de Vries  <tdevries@suse.de>

        PR testsuite/25048
        * gdb.rust/simple.exp: Add xfails for incorrect DWARF.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list