[Bug gdb/25190] New: annotations generated incorrectly unless "set pagination off"

atotic at chromium dot org sourceware-bugzilla@sourceware.org
Tue Nov 12 23:04:00 GMT 2019


            Bug ID: 25190
           Summary: annotations generated incorrectly unless "set
                    pagination off"
           Product: gdb
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: atotic at chromium dot org
  Target Milestone: ---

The symptom of the bug was that annotations were being printed incorrectly. For
example, launching

gdb -nw --annotate=2

generated the following output:

.gdbinit Ready




Notice the "prompt��post-" line, which should be ��post-prompt

I compiled gdb, and traced the problem to following lines:


  annotation_suffix = "prompt";
  if (from_tty && annotation_level > 1)
1)    printf_unfiltered (("\n\032\032post-"));
2)    puts_unfiltered (annotation_suffix);
3)    printf_unfiltered (("\n"));

printf_unfiltered and puts_unfiltered print lines out of order, unless 
"set pagination off" flag is set. That is how "prompt" got printed before

The root cause is that printf_unfiltered ends up calling
utils.c:fputs_maybe_filtered, which is quite complex, but I think does some
buffering. fputs_unfiltered goes straight to file->puts.

I worked around the issue in cgdb by passing in "set pagination off" flag. But
it should be fixed, printf/puts out of order is surprising.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the Gdb-prs mailing list