This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Re: Buffering problems with "gdb < foo"
- To: Eli Zaretskii <eliz at delorie dot com>
- Subject: Re: Buffering problems with "gdb < foo"
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Mon, 6 Mar 2000 12:56:06 -0500 (EST)
- Cc: gdb at sourceware dot cygnus dot com, ezannoni at cygnus dot com
- References: <200003050850.DAA10185@indy.delorie.com>
Eli Zaretskii writes:
>
> A comment in event-top.c (inside the change_line_handler function)
> says this:
>
> /* NOTE: this operates on input_fd, not instream. If we are reading
> commands from a file, instream will point to the file. However in
> async mode, we always read commands from a file with editing
> off. This means that the 'set editing on/off' will have effect
> only on the interactive session. */
>
> However, running "gdb < foo" seems to contradict this: I put a
> breakpoint in gdb_readline2, and it is never hit. Am I missing
> something?
>
Yeah, I tried to think hard about all the possible cases, but
obvioulsy I missed this one.
> The problem with this is that if the file `foo' includes a command
> which needs a confirmation, the call to fgetc in query will eatup lots
> of characters which will never again be seen by the event loop. In my
> case, fgetc read all the file (it was small), so GDB hit EOF and
> exited. I can prevent this from happening by putting "set editing off"
> in the input file. Invoking GDB with --noasync also solves the
> problem.
>
Yep.
> Does this work on Unix? If so, it would make this a DJGPP-specific
> problem.
I haven't tried, but probably it won't. Can you send me your command file?
>
> If this is not DJGPP-specific, then I think _initialize_event_loop
> should turn editing off if input_fd is not a tty.
I think so, can you submit a patch to do this?
Thanks.
Elena