This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]