aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-03-03 18:05:05 +0000
committerTom Tromey <tromey@redhat.com>2010-03-03 18:05:05 +0000
commita0e0ef55c6339931e689918519a756b6a5bcdacb (patch)
tree324acf4bb55cc1cf8c6bbe5eec86501c9ccebaea
parent501abfe0387ec3525a997fbf233717f2d5d9d74a (diff)
downloadgdb-a0e0ef55c6339931e689918519a756b6a5bcdacb.zip
gdb-a0e0ef55c6339931e689918519a756b6a5bcdacb.tar.gz
gdb-a0e0ef55c6339931e689918519a756b6a5bcdacb.tar.bz2
gdb
2010-03-03 Dainis Jonitis <jonitis@gmail.com> PR gdb/11345: * printcmd.c (printf_command): Print end of format string using printf_filtered. gdb/testsuite 2010-03-03 Tom Tromey <tromey@redhat.com> PR gdb/11345: * gdb.base/printcmds.exp (test_printf): Add test.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/printcmd.c7
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/printcmds.exp4
4 files changed, 20 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92a7254..6c347b5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-03 Dainis Jonitis <jonitis@gmail.com>
+
+ PR gdb/11345:
+ * printcmd.c (printf_command): Print end of format string using
+ printf_filtered.
+
2010-03-02 Tom Tromey <tromey@redhat.com>
* mi/mi-cmd-break.c (mi_read_next_line): Add missing 'void'.
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index c8cb35c..5e5ef8e 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2642,8 +2642,11 @@ printf_command (char *arg, int from_tty)
/* Skip to the next substring. */
current_substring += strlen (current_substring) + 1;
}
- /* Print the portion of the format string after the last argument. */
- puts_filtered (last_arg);
+ /* Print the portion of the format string after the last argument.
+ Note that this will not include any ordinary %-specs, but it
+ might include "%%". That is why we use printf_filtered and not
+ puts_filtered here. */
+ printf_filtered (last_arg);
}
do_cleanups (old_cleanups);
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7bcc512..7a55564 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-03 Tom Tromey <tromey@redhat.com>
+
+ PR gdb/11345:
+ * gdb.base/printcmds.exp (test_printf): Add test.
+
2010-03-02 H.J. Lu <hongjiu.lu@intel.com>
* gdb.arch/amd64-byte.exp: New.
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 5598bde..9c2cd6b 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -686,6 +686,10 @@ proc test_printf {} {
# Regression test for C lexer bug.
gdb_test "printf \"%c\\n\", \"x\"\[1,0\]" "x"
+
+ # Regression test for "%% at end of format string.
+ # See http://sourceware.org/bugzilla/show_bug.cgi?id=11345
+ gdb_test "printf \"%%%d%%\\n\", 5" "%5%"
}
#Test printing DFP values with printf