This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug breakpoints/18275] New: dprintf (call style) could automatically flush the standard output
- From: "malaperle at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 17 Apr 2015 18:29:33 +0000
- Subject: [Bug breakpoints/18275] New: dprintf (call style) could automatically flush the standard output
- Auto-submitted: auto-generated
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 <unistd.h>
#include <stdio.h>
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.