This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/11345] New: printf "%%\n" does not print the '%' character
- From: "jonitis at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 3 Mar 2010 15:01:28 -0000
- Subject: [Bug gdb/11345] New: printf "%%\n" does not print the '%' character
- Reply-to: sourceware-bugzilla at sourceware dot org
printf command parses the format string and prints arguments one by one. If it
happens that you want to print just a "%%" and there are no arguments anymore
(or there were no any arguments) then the remainder of format string is printed
with puts_filtered (last_arg);
puts does not know anything about special escape sequence for "%%" and instead
of printing just one '%' it prints both of them.
The fix is trivial. Just replace:
puts_filtered (last_arg);
with:
printf_filtered (last_arg);
in gdb/printcmd.c printf_command()
Test like this:
printf "%% %d %%\n", 1
Should produce:
% 1 %
The same problem was in 6.8.
--
Summary: printf "%%\n" does not print the '%' character
Product: gdb
Version: 7.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
AssignedTo: unassigned at sourceware dot org
ReportedBy: jonitis at gmail dot com
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11345
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.