This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] implement putchar_filtered()
- To: Nicholas Duffek <nsd at redhat dot com>
- Subject: Re: [RFA] implement putchar_filtered()
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 12 Jan 2001 18:48:42 +0930
- Cc: gdb-patches at sources dot redhat dot com
- References: <200101032042.PAA14840@nog.bosbc.com>
Nicholas Duffek wrote:
>
> This patch adds putchar_filtered() to the collection of stdio-like
> _filtered and _unfiltered functions in utils.c.
>
> ChangeLog:
>
> * defs.h (putchar_filtered): Prototype.
> * utils.c (putchar_filtered): Define.
FYI,
As a general direction, *_filtered() and *_unfiltered() should go away.
See the TODO file where it talks about:
--
Re-do GDB's output pager.
GDB's output pager still relies on people correctly using *_filtered
for gdb_stdout and *_unfiltered for gdb_stdlog / gdb_stderr.
Hopefully, with all normal output going to gdb_stdout, the pager can
just look at the ui_file that the output is on and then use that to
decide what to do about paging. Sounds good in theory.
--
Things like the CLI should be fetching chunks of output and then sending
them down the gdb_stdout et.al. stream. It is up to the stream (and not
someones arbitrary choice of *_filtered) to determine if paging should
occure.
Andrew
> No regressions on i686-pc-linux-gnu. Okay to apply?
>
> Nicholas Duffek
> <nsd@redhat.com>
>
> [patch follows]
>
> Index: gdb/defs.h
> ===================================================================
> diff -up gdb/defs.h gdb/defs.h
> --- gdb/defs.h Tue Dec 19 11:13:25 2000
> +++ gdb/defs.h Tue Dec 19 11:13:09 2000
> @@ -446,6 +446,8 @@ extern int fputc_filtered (int c, struct
>
> extern int fputc_unfiltered (int c, struct ui_file *);
>
> +extern int putchar_filtered (int c);
> +
> extern int putchar_unfiltered (int c);
>
> extern void puts_filtered (const char *);
> Index: gdb/utils.c
> ===================================================================
> diff -up gdb/utils.c gdb/utils.c
> --- gdb/utils.c Tue Dec 19 11:13:48 2000
> +++ gdb/utils.c Tue Dec 19 11:13:09 2000
> @@ -1867,6 +1867,12 @@ putchar_unfiltered (int c)
> }
>
> int
> +putchar_filtered (int c)
> +{
> + return fputc_filtered (c, gdb_stdout);
> +}
> +
> +int
> fputc_unfiltered (int c, struct ui_file *stream)
> {
> char buf = c;