public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA 0/2] Support ptype/o in Rust
@ 2018-06-23 20:22 Tom Tromey
  2018-06-23 20:22 ` [RFA 1/2] Move ptype/o printing code to typeprint.c Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tom Tromey @ 2018-06-23 20:22 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-06-27  2:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-23 20:22 [RFA 0/2] Support ptype/o in Rust 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 20:22 ` [RFA 2/2] Support ptype/o in Rust Tom Tromey
2018-06-26 19:08   ` Simon Marchi
2018-06-26 20:55     ` Tom Tromey
2018-06-23 23:44 ` [RFA 0/2] " Sergio Durigan Junior
2018-06-27  2:59   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).