This is the mail archive of the gdb-prs@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]

[Bug gdb/11345] New: printf "%%\n" does not print the '%' character


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.


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