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]

using '-x -' to read gdb script from stdin


J.T. Conklin writes:
 > I updated one of our year old GDB executables a week or so ago, and
 > was notified that one of the scripts used by SQA failed to work.  I
 > tracked it down to the following bit of code that was ifdef'd out 
 > earlier this year.
 > 
 > >From main.c:
 >               /* NOTE: I am commenting this out, because it is not clear 
 >                  where this feature is used. It is very old and
 >                  undocumented. ezannoni: 1999-05-04 */
 >     #if 0
 >               if (cmdarg[i][0] == '-' && cmdarg[i][1] == '\0') 
 >                 read_command_file (stdin);
 >               else
 >     #endif 
 > 
 > 
 > The script invoked gdb like this:
 >     echo list "*$addr" | $gdb -batch -x - $file | head -1 
 > 
 > [ I know, I should be using addr2line.  But this script was written 
 >   before addr2line existed. ]
 > 
 > Since all of our systems support /dev/stdin, I patched up our script
 > accordingly.  But I wonder whether support for - should be reenabled.
 > Is there any reason why not?
 > 
 >         --jtc
 > 

JT,

If I remember correctly, invoking gdb with '-x -'
would start the command_loop() via read_command_file(), instead of
via captured_command_loop(). In case of async (which is now the default), 
the traditional command_loop() is not called, because gdb_init() sets
command_loop_hook to cli_command_loop(). 

So we would have started the regular command loop, even though all the
necessary stuff for async was set up. Bad interactions would follow.

Since that option was not documented, it was decided to get rid of it
if nobody was going to be penalized.  It may be still possible to
clean things up but I just noticed that it is not just a matter of
eliminating the #if 0, unfortunatley, because more surrounding code
has also been deactivated.

Using the source command works because that is invoked after the main
command loop has already started.

I can put this on my to do list, but it will be a while before I can
get to it.  Feel free to give it a try if you want.

Elena

 > -- 
 > J.T. Conklin
 > RedBack Networks

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