[RFA 0/2] Support ptype/o in Rust
Tom Tromey
tom@tromey.com
Sat Jun 23 20:22:00 GMT 2018
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
More information about the Gdb-patches
mailing list