Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [RFA 0/2] Support ptype/o in Rust
Date: Sat, 23 Jun 2018 20:22:00 -0000	[thread overview]
Message-ID: <20180623202227.17259-1-tom@tromey.com> (raw)

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

The first patch slightly refactors the existing ptype/o code.  The
utility functions are now public methods on struct print_offset_data.

The second patch changes the Rust language code.  I would self-approve
this one but it required a change outside of Rust.  Perhaps this check
ought to have been a flag on the language_defn.

I noticed that ptype/o generates somewhat funny output:

    /* offset    |  size */  type = union simple::Union {
    /*                 1 */    f1: i8,
    /*                 1 */    f2: u8,

			       /* total size (bytes):    1 */
			     }

Here, I think it might be cleaner to put the "total size" information
on the same line as the trailing "}" (and of course not indent it),
like:

    /* offset    |  size */  type = union simple::Union {
    /*                 1 */    f1: i8,
    /*                 1 */    f2: u8,
    /* total size      1 */  }

If you agree I can at least file a bug or maybe implement it.

Additionally I noticed that in C, in most cases fields are indented 4
spaces, but with ptype/o the outermost fields are only indented 2
spaces (relative to the "type =" text).  I think this is probably
unintended as well, but I thought I'd ask... ?

Regression tested on x86-64 Fedora 26.

Tom


             reply	other threads:[~2018-06-23 20:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-23 20:22 Tom Tromey [this message]
2018-06-23 20:22 ` [RFA 2/2] " Tom Tromey
2018-06-26 19:08   ` Simon Marchi
2018-06-26 20:55     ` Tom Tromey
2018-06-23 20:22 ` [RFA 1/2] Move ptype/o printing code to typeprint.c Tom Tromey
2018-06-23 23:51   ` Sergio Durigan Junior
2018-06-26 20:54     ` Tom Tromey
2018-06-23 23:44 ` [RFA 0/2] Support ptype/o in Rust Sergio Durigan Junior
2018-06-27  2:59   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180623202227.17259-1-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox