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]

[PATCH] Out of order display in gdb


GDB o/p goes out of order with printf , when a '/n' is not present in
the o/p. Problem since a wrap_here("") in
event-top.c:command_line_handler causes the o/p to be buffered and
this problem doesn't show up when a \n is part of the output. GDB
bugzilla id 7900 tracks this issue.  ( more details in
http://sourceware.org/bugzilla/show_bug.cgi?id=7900 ).

Test case to reproduce this issue :

(gdb) printf "%x",(int *)main
40055a(gdb) printf "%x",(int *)main
(gdb) printf "%x",(int *)main
40055a(gdb) printf "%d", 9
40055a(gdb) printf "%d", 9
9(gdb)

Fix is remove this wrap_here and avoid buffering as we are in a
command handler.  With this :

(gdb) printf "%x",(int *)main
40055a(gdb) printf "%x",(int *)main
40055a(gdb) printf "%x",(int *)main
40055a(gdb) printf "%d", 9
9(gdb) printf "%d", 9
9(gdb)

Change log :

event-top.c ( command_line_handler ) : Remove wrap_here in
command_line_handler to disable wrap buffering.

Patch :

*** event-top.c.6.8     2009-01-09 12:24:45.000000000 -0500
--- event-top.c 2009-01-09 04:02:55.000000000 -0500
*************** command_line_handler (char *rl)
*** 658,664 ****

    /* Make sure that all output has been output.  Some machines may let
       you get away with leaving out some of the gdb_flush, but not all.  */
-   wrap_here ("");
    gdb_flush (gdb_stdout);
    gdb_flush (gdb_stderr);

--- 658,663 ----


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