[Bug rust/22574] New: support ptype/o in rust

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] New: support ptype/o in rust

macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

            Bug ID: 22574
           Summary: support ptype/o in rust
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: rust
          Assignee: unassigned at sourceware dot org
          Reporter: tromey at sourceware dot org
  Target Milestone: ---

Bug 16224 is adding pahole-like functionality via "ptype/o".
The rust type printer should support this as well.

I have started a patch for this, so contact me if you plan
to pick this up.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |16224


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=16224
[Bug 16224] add "pahole" functionality to ptype
--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574
Bug 22574 depends on bug 16224, which changed state.

Bug 16224 Summary: add "pahole" functionality to ptype
https://sourceware.org/bugzilla/show_bug.cgi?id=16224

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Given that the rust compiler reorders fields now, I wonder if
this is even worth doing.  Holes seem not to be actionable in rust.
I'm considering just closing this bug.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Maybe it is still interesting sometimes to see a "layout view" of
a type in the debugger.  That's the only case where I could think of
this being useful.  The idea here is that since rustc reorders fields
we'd also need to sort of by offset before printing the type.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #3 from Pedro Alves <palves at redhat dot com> ---
You can use repr attributes control layout though:

  https://doc.rust-lang.org/nomicon/other-reprs.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <[hidden email]>:

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

commit a33ccfc7afd9e32dd310f54d04719efeec8df342
Author: Tom Tromey <[hidden email]>
Date:   Fri Jun 8 13:18:25 2018 -0600

    Support ptype/o in Rust

    This adds support for ptype/o to the Rust language code.

    By default, the Rust compiler reorders fields to reduce padding.  So,
    the Rust language code sorts the fields by offset before printing.
    This may yield somewhat odd-looking results, but it is faithful to
    "what really happens", and might be useful when doing lower-level
    debugging.

    The reordering can be disabled using #[repr(c)]; ptype/o might be more
    useful in this case.

    gdb/ChangeLog
    2018-06-26  Tom Tromey  <[hidden email]>

        PR rust/22574:
        * typeprint.c (whatis_exp): Allow ptype/o for Rust.
        * rust-lang.c (rust_print_struct_def): Add podata parameter.
        Update.
        (rust_internal_print_type): Add podata parameter.
        (rust_print_type): Update.

    gdb/testsuite/ChangeLog
    2018-06-26  Tom Tromey  <[hidden email]>

        PR rust/22574:
        * gdb.rust/simple.exp (test_one_slice): Add ptype/o tests.
        * gdb.rust/simple.rs (struct SimpleLayout): New.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug rust/22574] support ptype/o in rust

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22574

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |8.2

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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