diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-03-21 12:25:47 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-03-26 18:23:49 +0000 |
commit | 18c77628b1e97e412561029ec20195c1ffa61b2d (patch) | |
tree | 6c79f1c4d04742d7a5380a3821de691f35647b6a /gdb/cp-valprint.c | |
parent | 53c973f200e39c4122e0db06a94e3a0079e6de80 (diff) | |
download | gdb-18c77628b1e97e412561029ec20195c1ffa61b2d.zip gdb-18c77628b1e97e412561029ec20195c1ffa61b2d.tar.gz gdb-18c77628b1e97e412561029ec20195c1ffa61b2d.tar.bz2 |
gdb: Avoid trailing whitespace when pretty printing
While writing a new test for 'set print pretty on' I spotted that GDB
will sometimes add a trailing whitespace character when pretty
printing. This commit removes the trailing whitespace and updates the
expected results in one tests where this was an issue.
I've added an extra test for 'set print pretty on' as it doesn't seem
to have much testing.
gdb/ChangeLog:
* cp-valprint.c (cp_print_value_fields): Don't print trailing
whitespace when pretty printing is on.
gdb/testsuite/ChangeLog:
* gdb.base/finish-pretty.exp: Update expected results.
* gdb.base/pretty-print.c: New file.
* gdb.base/pretty-print.exp: New file.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r-- | gdb/cp-valprint.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 7124da4..443c3b0 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -235,7 +235,11 @@ cp_print_value_fields (struct type *type, struct type *real_type, continue; if (fields_seen) - fprintf_filtered (stream, ", "); + { + fputs_filtered (",", stream); + if (!options->prettyformat) + fputs_filtered (" ", stream); + } else if (n_baseclasses > 0) { if (options->prettyformat) @@ -244,7 +248,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, print_spaces_filtered (2 + 2 * recurse, stream); fputs_filtered ("members of ", stream); fputs_filtered (TYPE_NAME (type), stream); - fputs_filtered (": ", stream); + fputs_filtered (":", stream); } } fields_seen = 1; |