This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix printing of negative space change
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 01 Apr 2011 11:20:14 -0600
- Subject: FYI: fix printing of negative space change
I'm checking this in.
A user noticed that the `maint space' code will improperly print two `-'
signs if gdb's space use happens to shrink.
The bug is that `%ld' will print one `-', but gdb explicitly prints
another.
Built and regtested on x86-64 (compile farm).
Tom
2011-04-01 Tom Tromey <tromey@redhat.com>
* utils.c (report_command_stats): Don't print `-' for negative
number.
diff --git a/gdb/utils.c b/gdb/utils.c
index e688d19..b1098f9 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -657,10 +657,10 @@ report_command_stats (void *arg)
long space_diff = space_now - start_stats->start_space;
printf_unfiltered (msg_type == 0
- ? _("Space used: %ld (%c%ld during startup)\n")
- : _("Space used: %ld (%c%ld for this command)\n"),
+ ? _("Space used: %ld (%s%ld during startup)\n")
+ : _("Space used: %ld (%s%ld for this command)\n"),
space_now,
- (space_diff >= 0 ? '+' : '-'),
+ (space_diff >= 0 ? "+" : ""),
space_diff);
#endif
}