From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39418 invoked by alias); 17 Apr 2015 18:29:35 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 39391 invoked by uid 48); 17 Apr 2015 18:29:34 -0000 From: "malaperle at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug breakpoints/18275] New: dprintf (call style) could automatically flush the standard output Date: Fri, 17 Apr 2015 18:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: breakpoints X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: malaperle at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q2/txt/msg00063.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18275 Bug ID: 18275 Summary: dprintf (call style) could automatically flush the standard output Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: breakpoints Assignee: unassigned at sourceware dot org Reporter: malaperle at gmail dot com Created attachment 8251 --> https://sourceware.org/bugzilla/attachment.cgi?id=8251&action=edit Sample source file I am attaching to a program that appears to have output buffering on (setvbuf). If I use dprintf (call style) to add some debug print-outs, I do not see them until I call fflush. To improve the out-of-the-box experience, I think dprintf should flush the stdout. I am not sure whether or not there should be an option to control this but by default I think it should flush. Here's an example to illustrate the problem testDprintf.c: #include #include int main() { setvbuf(stdout, NULL, _IOFBF, BUFSIZ); while (1) { sleep(5); } return 0; } gdb ./testDprintf set dprintf-style call dprintf testDprintf.c:7, "hello printf\n" r Wait a few seconds. You won't see output (unless you wait for a really long time!). If you interrupt (Ctrl-C) then do a: call fflush(0) Then you see the printfs appear. -- You are receiving this mail because: You are on the CC list for the bug.