* Emacs doesn't show printf() output during debugging.
@ 2005-08-17 13:05 Lao JM
2005-08-17 18:18 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Lao JM @ 2005-08-17 13:05 UTC (permalink / raw)
When I debug my C program, I can't see the printf() output in any buffer.
However, I can provide input to scanf() in the GUD buffer. What should
I do to show the output? I am using Emacs 21.3.50.1 (CVS) on Windows2000.
Thanks.
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs doesn't show printf() output during debugging.
2005-08-17 13:05 Lao JM
@ 2005-08-17 18:18 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2005-08-17 18:18 UTC (permalink / raw)
> From: "Lao JM" <rolexletter@hotmail.com>
> Date: Wed, 17 Aug 2005 13:05:57 +0000
>
> When I debug my C program, I can't see the printf() output in any buffer.
> However, I can provide input to scanf() in the GUD buffer. What should
> I do to show the output? I am using Emacs 21.3.50.1 (CVS) on Windows2000.
What port of GDB is that?
Also, is it possible that your program doesn't fflush the standard
output after it calls printf? I think redirecting stdout to a pipe
changes its buffering, so without fflush the characters may stay
buffered longer than with the console.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs doesn't show printf() output during debugging.
@ 2005-08-17 21:29 Nick Roberts
2005-08-19 11:25 ` Rolex JM
0 siblings, 1 reply; 4+ messages in thread
From: Nick Roberts @ 2005-08-17 21:29 UTC (permalink / raw)
Cc: help-gnu-emacs
> When I debug my C program, I can't see the printf() output in any buffer.
> However, I can provide input to scanf() in the GUD buffer. What should
> I do to show the output? I am using Emacs 21.3.50.1 (CVS) on Windows2000.
I don't debug on Windows but I have been told that this works:
;; If you are using Emacs and GDB on Windows you will need to flush the buffer
;; explicitly in your program if you want timely display of I/O in Emacs.
;; Alternatively you can make the output stream unbuffered, for example, by
;; using a macro:
;;
;; #ifdef UNBUFFERED
;; setvbuf (stdout, (char *) NULL, _IONBF, 0);
;; #endif
;;
;; and compiling with -DUNBUFFERED while debugging.
I think that if the string to be printed is terminated with \n, this will
also display at the desired time (line buffering?).
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs doesn't show printf() output during debugging.
2005-08-17 21:29 Emacs doesn't show printf() output during debugging Nick Roberts
@ 2005-08-19 11:25 ` Rolex JM
0 siblings, 0 replies; 4+ messages in thread
From: Rolex JM @ 2005-08-19 11:25 UTC (permalink / raw)
I have tried
setvbuf (stdout, (char *) NULL, _IONBF, 0);
and
fflush(stdout);
respectively. They both worked. Thanks lot.
>From: Nick Roberts <nickrob@snap.net.nz>
>To: Lao JM <rolexletter@hotmail.com>
>CC: help-gnu-emacs@gnu.org
>Subject: Re: Emacs doesn't show printf() output during debugging.
>Date: Thu, 18 Aug 2005 09:29:57 +1200
>
>
> > When I debug my C program, I can't see the printf() output in any
buffer.
> > However, I can provide input to scanf() in the GUD buffer. What should
> > I do to show the output? I am using Emacs 21.3.50.1 (CVS) on
Windows2000.
>
>I don't debug on Windows but I have been told that this works:
>
>;; If you are using Emacs and GDB on Windows you will need to flush the
buffer
>;; explicitly in your program if you want timely display of I/O in Emacs.
>;; Alternatively you can make the output stream unbuffered, for example,
by
>;; using a macro:
>;;
>;; #ifdef UNBUFFERED
>;; setvbuf (stdout, (char *) NULL, _IONBF, 0);
>;; #endif
>;;
>;; and compiling with -DUNBUFFERED while debugging.
>
>I think that if the string to be printed is terminated with \n, this will
>also display at the desired time (line buffering?).
>
>Nick
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-08-19 11:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-17 21:29 Emacs doesn't show printf() output during debugging Nick Roberts
2005-08-19 11:25 ` Rolex JM
-- strict thread matches above, loose matches on Subject: below --
2005-08-17 13:05 Lao JM
2005-08-17 18:18 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).