This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Buffering problems with "gdb < foo"



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?

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.

Does this work on Unix?  If so, it would make this a DJGPP-specific
problem.

If this is not DJGPP-specific, then I think _initialize_event_loop
should turn editing off if input_fd is not a tty.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]