Fix ptype/o comment formatting

I noticed that ptype/o will print:

    /*    3: 3   |     1 */    signed char a4 : 2;
    /* XXX  3-bit hole  */

That is, "*/" at the end of the "hole" message does not line up with
the other comment ends.  I thought it would be a bit nicer if this did
line up, so I fixed it.  Then, to my surprise, I found that I could
not make ptype-offsets.exp fail.

I still am not sure why it doesn't fail, but changing the tests to use
string_to_regexp and changing the quoting helped.  This in turn showed
that some of the existing test cases were wrong, so I've also updated
them here.

gdb/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

	* typeprint.c (print_offset_data::maybe_print_hole): Add extra
	padding at end of comment.

gdb/testsuite/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

	* gdb.base/ptype-offsets.exp: Use string_to_regexp.  Fix test
	cases.
	* gdb.base/ptype-offsets.cc (struct abc) <my_int_type>: Now
	"short".
This commit is contained in:
Tom Tromey 2019-04-29 12:11:52 -06:00
parent 988915ee7b
commit 844333e249
5 changed files with 266 additions and 253 deletions

View file

@ -94,11 +94,11 @@ print_offset_data::maybe_print_hole (struct ui_file *stream,
unsigned int hole_bit = hole % TARGET_CHAR_BIT;
if (hole_bit > 0)
fprintf_filtered (stream, "/* XXX %2u-bit %s */\n", hole_bit,
fprintf_filtered (stream, "/* XXX %2u-bit %s */\n", hole_bit,
for_what);
if (hole_byte > 0)
fprintf_filtered (stream, "/* XXX %2u-byte %s */\n", hole_byte,
fprintf_filtered (stream, "/* XXX %2u-byte %s */\n", hole_byte,
for_what);
}
}