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]

Re: Buffering problems with "gdb < foo"


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

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