import gdb-1999-11-08 snapshot
[external/binutils.git] / gdb / main.c
1 /* Top level stuff for GDB, the GNU debugger.
2    Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 1999
3    Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21
22 #include "defs.h"
23 #include "top.h"
24 #include "target.h"
25 #include "inferior.h"
26 #include "call-cmds.h"
27
28 #include "getopt.h"
29
30 #include <sys/types.h>
31 #include "gdb_stat.h"
32 #include <ctype.h>
33
34 #include "gdb_string.h"
35 #include "event-loop.h"
36
37 /* If nonzero, display time usage both at startup and for each command.  */
38
39 int display_time;
40
41 /* If nonzero, display space usage both at startup and for each command.  */
42
43 int display_space;
44
45 /* Whether this is the async version or not.  The async version is
46    invoked on the command line with the -nw --async options.  In this
47    version, the usual command_loop is substituted by and event loop which
48    processes UI events asynchronously. */
49 int event_loop_p = 1;
50
51 /* Whether this is the command line version or not */
52 int tui_version = 0;
53
54 /* Whether xdb commands will be handled */
55 int xdb_commands = 0;
56
57 /* Whether dbx commands will be handled */
58 int dbx_commands = 0;
59
60 GDB_FILE *gdb_stdout;
61 GDB_FILE *gdb_stderr;
62 GDB_FILE *gdb_stdlog;
63 GDB_FILE *gdb_stdtarg;
64
65 /* Used to initialize error() - defined in utils.c */
66
67 extern void error_init (void);
68
69 /* Whether to enable writing into executable and core files */
70 extern int write_files;
71
72 static void print_gdb_help PARAMS ((GDB_FILE *));
73
74 /* These two are used to set the external editor commands when gdb is farming
75    out files to be edited by another program. */
76
77 extern int enable_external_editor;
78 extern char *external_editor_command;
79
80 #ifdef __CYGWIN__
81 #include <windows.h>            /* for MAX_PATH */
82 #include <sys/cygwin.h>         /* for cygwin32_conv_to_posix_path */
83 #endif
84
85 /* Call command_loop.  If it happens to return, pass that through as a
86    non-zero return status. */
87
88 static int
89 captured_command_loop (void *data)
90 {
91   if (command_loop_hook == NULL)
92     command_loop ();
93   else
94     command_loop_hook ();
95   /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton
96      would clean things up (restoring the cleanup chain) to the state
97      they were just prior to the call.  Technically, this means that
98      the do_cleanups() below is redundant.  Unfortunatly, many FUNC's
99      are not that well behaved.  do_cleanups should either be replaced
100      with a do_cleanups call (to cover the problem) or an assertion
101      check to detect bad FUNCs code. */
102   do_cleanups (ALL_CLEANUPS);
103   /* If the command_loop returned, normally (rather than threw an
104      error) we try to quit. If the quit is aborted, catch_errors()
105      which called this catch the signal and restart the command
106      loop. */
107   quit_command (NULL, instream == stdin);
108   return 1;
109 }
110
111 struct captured_main_args
112   {
113     int argc;
114     char **argv;
115   };
116
117 static int
118 captured_main (void *data)
119 {
120   struct captured_main_args *context = data;
121   int argc = context->argc;
122   char **argv = context->argv;
123   int count;
124   static int quiet = 0;
125   static int batch = 0;
126
127   /* Pointers to various arguments from command line.  */
128   char *symarg = NULL;
129   char *execarg = NULL;
130   char *corearg = NULL;
131   char *cdarg = NULL;
132   char *ttyarg = NULL;
133
134   /* These are static so that we can take their address in an initializer.  */
135   static int print_help;
136   static int print_version;
137
138   /* Pointers to all arguments of --command option.  */
139   char **cmdarg;
140   /* Allocated size of cmdarg.  */
141   int cmdsize;
142   /* Number of elements of cmdarg used.  */
143   int ncmd;
144
145   /* Indices of all arguments of --directory option.  */
146   char **dirarg;
147   /* Allocated size.  */
148   int dirsize;
149   /* Number of elements used.  */
150   int ndir;
151
152   struct stat homebuf, cwdbuf;
153   char *homedir, *homeinit;
154
155   register int i;
156
157   long time_at_startup = get_run_time ();
158
159   START_PROGRESS (argv[0], 0);
160
161 #ifdef MPW
162   /* Do all Mac-specific setup. */
163   mac_init ();
164 #endif /* MPW */
165
166   /* This needs to happen before the first use of malloc.  */
167   init_malloc ((PTR) NULL);
168
169 #if defined (ALIGN_STACK_ON_STARTUP)
170   i = (int) &count & 0x3;
171   if (i != 0)
172     alloca (4 - i);
173 #endif
174
175   cmdsize = 1;
176   cmdarg = (char **) xmalloc (cmdsize * sizeof (*cmdarg));
177   ncmd = 0;
178   dirsize = 1;
179   dirarg = (char **) xmalloc (dirsize * sizeof (*dirarg));
180   ndir = 0;
181
182   quit_flag = 0;
183   line = (char *) xmalloc (linesize);
184   line[0] = '\0';               /* Terminate saved (now empty) cmd line */
185   instream = stdin;
186
187   getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
188   current_directory = gdb_dirbuf;
189
190 #if 0
191   /* not yet */
192   gdb_stdout = stdio_fileopen (stdout);
193   gdb_stderr = stdio_fileopen (stderr);
194   gdb_stdlog = gdb_stderr;      /* for moment */
195   gdb_stdtarg = gdb_stderr;     /* for moment */
196 #else
197   gdb_stdout = tui_fileopen (stdout);
198   gdb_stderr = tui_fileopen (stderr);
199   gdb_stdlog = gdb_stdout;      /* for moment */
200   gdb_stdtarg = gdb_stderr;     /* for moment */
201 #endif
202
203   /* initialize error() */
204   error_init ();
205
206   /* Parse arguments and options.  */
207   {
208     int c;
209     /* When var field is 0, use flag field to record the equivalent
210        short option (or arbitrary numbers starting at 10 for those
211        with no equivalent).  */
212     static struct option long_options[] =
213     {
214       {"async", no_argument, &event_loop_p, 1},
215       {"noasync", no_argument, &event_loop_p, 0},
216 #if defined(TUI)
217       {"tui", no_argument, &tui_version, 1},
218 #endif
219       {"xdb", no_argument, &xdb_commands, 1},
220       {"dbx", no_argument, &dbx_commands, 1},
221       {"readnow", no_argument, &readnow_symbol_files, 1},
222       {"r", no_argument, &readnow_symbol_files, 1},
223       {"mapped", no_argument, &mapped_symbol_files, 1},
224       {"m", no_argument, &mapped_symbol_files, 1},
225       {"quiet", no_argument, &quiet, 1},
226       {"q", no_argument, &quiet, 1},
227       {"silent", no_argument, &quiet, 1},
228       {"nx", no_argument, &inhibit_gdbinit, 1},
229       {"n", no_argument, &inhibit_gdbinit, 1},
230       {"batch", no_argument, &batch, 1},
231       {"epoch", no_argument, &epoch_interface, 1},
232
233     /* This is a synonym for "--annotate=1".  --annotate is now preferred,
234        but keep this here for a long time because people will be running
235        emacses which use --fullname.  */
236       {"fullname", no_argument, 0, 'f'},
237       {"f", no_argument, 0, 'f'},
238
239       {"annotate", required_argument, 0, 12},
240       {"help", no_argument, &print_help, 1},
241       {"se", required_argument, 0, 10},
242       {"symbols", required_argument, 0, 's'},
243       {"s", required_argument, 0, 's'},
244       {"exec", required_argument, 0, 'e'},
245       {"e", required_argument, 0, 'e'},
246       {"core", required_argument, 0, 'c'},
247       {"c", required_argument, 0, 'c'},
248       {"command", required_argument, 0, 'x'},
249       {"version", no_argument, &print_version, 1},
250       {"x", required_argument, 0, 'x'},
251       {"directory", required_argument, 0, 'd'},
252       {"cd", required_argument, 0, 11},
253       {"tty", required_argument, 0, 't'},
254       {"baud", required_argument, 0, 'b'},
255       {"b", required_argument, 0, 'b'},
256       {"nw", no_argument, &use_windows, 0},
257       {"nowindows", no_argument, &use_windows, 0},
258       {"w", no_argument, &use_windows, 1},
259       {"windows", no_argument, &use_windows, 1},
260       {"statistics", no_argument, 0, 13},
261       {"write", no_argument, &write_files, 1},
262 /* Allow machine descriptions to add more options... */
263 #ifdef ADDITIONAL_OPTIONS
264       ADDITIONAL_OPTIONS
265 #endif
266       {0, no_argument, 0, 0}
267     };
268
269     while (1)
270       {
271         int option_index;
272
273         c = getopt_long_only (argc, argv, "",
274                               long_options, &option_index);
275         if (c == EOF)
276           break;
277
278         /* Long option that takes an argument.  */
279         if (c == 0 && long_options[option_index].flag == 0)
280           c = long_options[option_index].val;
281
282         switch (c)
283           {
284           case 0:
285             /* Long option that just sets a flag.  */
286             break;
287           case 10:
288             symarg = optarg;
289             execarg = optarg;
290             break;
291           case 11:
292             cdarg = optarg;
293             break;
294           case 12:
295             /* FIXME: what if the syntax is wrong (e.g. not digits)?  */
296             annotation_level = atoi (optarg);
297             break;
298           case 13:
299             /* Enable the display of both time and space usage.  */
300             display_time = 1;
301             display_space = 1;
302             break;
303           case 'f':
304             annotation_level = 1;
305 /* We have probably been invoked from emacs.  Disable window interface.  */
306             use_windows = 0;
307             break;
308           case 's':
309             symarg = optarg;
310             break;
311           case 'e':
312             execarg = optarg;
313             break;
314           case 'c':
315             corearg = optarg;
316             break;
317           case 'x':
318             cmdarg[ncmd++] = optarg;
319             if (ncmd >= cmdsize)
320               {
321                 cmdsize *= 2;
322                 cmdarg = (char **) xrealloc ((char *) cmdarg,
323                                              cmdsize * sizeof (*cmdarg));
324               }
325             break;
326           case 'd':
327             dirarg[ndir++] = optarg;
328             if (ndir >= dirsize)
329               {
330                 dirsize *= 2;
331                 dirarg = (char **) xrealloc ((char *) dirarg,
332                                              dirsize * sizeof (*dirarg));
333               }
334             break;
335           case 't':
336             ttyarg = optarg;
337             break;
338           case 'q':
339             quiet = 1;
340             break;
341           case 'b':
342             {
343               int i;
344               char *p;
345
346               i = strtol (optarg, &p, 0);
347               if (i == 0 && p == optarg)
348
349                 /* Don't use *_filtered or warning() (which relies on
350                    current_target) until after initialize_all_files(). */
351
352                 fprintf_unfiltered
353                   (gdb_stderr,
354                    "warning: could not set baud rate to `%s'.\n", optarg);
355               else
356                 baud_rate = i;
357             }
358           case 'l':
359             {
360               int i;
361               char *p;
362
363               i = strtol (optarg, &p, 0);
364               if (i == 0 && p == optarg)
365
366                 /* Don't use *_filtered or warning() (which relies on
367                    current_target) until after initialize_all_files(). */
368
369                 fprintf_unfiltered
370                   (gdb_stderr,
371                  "warning: could not set timeout limit to `%s'.\n", optarg);
372               else
373                 remote_timeout = i;
374             }
375             break;
376
377 #ifdef ADDITIONAL_OPTION_CASES
378             ADDITIONAL_OPTION_CASES
379 #endif
380           case '?':
381             fprintf_unfiltered (gdb_stderr,
382                         "Use `%s --help' for a complete list of options.\n",
383                                 argv[0]);
384             exit (1);
385           }
386       }
387
388     /* If --help or --version, disable window interface.  */
389     if (print_help || print_version)
390       {
391         use_windows = 0;
392 #ifdef TUI
393         /* Disable the TUI as well.  */
394         tui_version = 0;
395 #endif
396       }
397
398 #ifdef TUI
399     /* An explicit --tui flag overrides the default UI, which is the
400        window system.  */
401     if (tui_version)
402       use_windows = 0;
403 #endif
404
405     /* OK, that's all the options.  The other arguments are filenames.  */
406     count = 0;
407     for (; optind < argc; optind++)
408       switch (++count)
409         {
410         case 1:
411           symarg = argv[optind];
412           execarg = argv[optind];
413           break;
414         case 2:
415           corearg = argv[optind];
416           break;
417         case 3:
418           fprintf_unfiltered (gdb_stderr,
419                           "Excess command line arguments ignored. (%s%s)\n",
420                           argv[optind], (optind == argc - 1) ? "" : " ...");
421           break;
422         }
423     if (batch)
424       quiet = 1;
425   }
426
427 #if defined(TUI)
428   /* Should this be moved to tui-top.c:_initialize_tui()? */
429   if (tui_version)
430     init_ui_hook = tuiInit;
431 #endif
432
433   /* Initialize all files.  Give the interpreter a chance to take
434      control of the console via the init_ui_hook()) */
435   gdb_init (argv[0]);
436
437   /* Do these (and anything which might call wrap_here or *_filtered)
438      after initialize_all_files.  */
439   if (print_version)
440     {
441       print_gdb_version (gdb_stdout);
442       wrap_here ("");
443       printf_filtered ("\n");
444       exit (0);
445     }
446
447   if (print_help)
448     {
449       print_gdb_help (gdb_stdout);
450       fputs_unfiltered ("\n", gdb_stdout);
451       exit (0);
452     }
453
454   if (!quiet)
455     {
456       /* Print all the junk at the top, with trailing "..." if we are about
457          to read a symbol file (possibly slowly).  */
458       print_gdb_version (gdb_stdout);
459       if (symarg)
460         printf_filtered ("..");
461       wrap_here ("");
462       gdb_flush (gdb_stdout);   /* Force to screen during slow operations */
463     }
464
465   error_pre_print = "\n\n";
466   quit_pre_print = error_pre_print;
467
468   /* We may get more than one warning, don't double space all of them... */
469   warning_pre_print = "\nwarning: ";
470
471   /* Read and execute $HOME/.gdbinit file, if it exists.  This is done
472      *before* all the command line arguments are processed; it sets
473      global parameters, which are independent of what file you are
474      debugging or what directory you are in.  */
475 #ifdef __CYGWIN32__
476   {
477     char *tmp = getenv ("HOME");
478
479     if (tmp != NULL)
480       {
481         homedir = (char *) alloca (MAX_PATH + 1);
482         cygwin32_conv_to_posix_path (tmp, homedir);
483       }
484     else
485       homedir = NULL;
486   }
487 #else
488   homedir = getenv ("HOME");
489 #endif
490   if (homedir)
491     {
492       homeinit = (char *) alloca (strlen (homedir) +
493                                   strlen (gdbinit) + 10);
494       strcpy (homeinit, homedir);
495       strcat (homeinit, "/");
496       strcat (homeinit, gdbinit);
497
498       if (!inhibit_gdbinit)
499         {
500           catch_command_errors (source_command, homeinit, 0, RETURN_MASK_ALL);
501         }
502
503       /* Do stats; no need to do them elsewhere since we'll only
504          need them if homedir is set.  Make sure that they are
505          zero in case one of them fails (this guarantees that they
506          won't match if either exists).  */
507
508       memset (&homebuf, 0, sizeof (struct stat));
509       memset (&cwdbuf, 0, sizeof (struct stat));
510
511       stat (homeinit, &homebuf);
512       stat (gdbinit, &cwdbuf);  /* We'll only need this if
513                                    homedir was set.  */
514     }
515
516   /* Now perform all the actions indicated by the arguments.  */
517   if (cdarg != NULL)
518     {
519       catch_command_errors (cd_command, cdarg, 0, RETURN_MASK_ALL);
520     }
521
522   for (i = 0; i < ndir; i++)
523     catch_command_errors (directory_command, dirarg[i], 0, RETURN_MASK_ALL);
524   free ((PTR) dirarg);
525
526   if (execarg != NULL
527       && symarg != NULL
528       && STREQ (execarg, symarg))
529     {
530       /* The exec file and the symbol-file are the same.  If we can't
531          open it, better only print one error message.
532          catch_command_errors returns non-zero on success! */
533       if (catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL))
534         catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
535     }
536   else
537     {
538       if (execarg != NULL)
539         catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL);
540       if (symarg != NULL)
541         catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
542     }
543
544   /* After the symbol file has been read, print a newline to get us
545      beyond the copyright line...  But errors should still set off
546      the error message with a (single) blank line.  */
547   if (!quiet)
548     printf_filtered ("\n");
549   error_pre_print = "\n";
550   quit_pre_print = error_pre_print;
551   warning_pre_print = "\nwarning: ";
552
553   if (corearg != NULL)
554     {
555       if (catch_command_errors (core_file_command, corearg, !batch, RETURN_MASK_ALL) == 0)
556         {
557           /* See if the core file is really a PID. */
558           if (isdigit (corearg[0]))
559             catch_command_errors (attach_command, corearg, !batch, RETURN_MASK_ALL);
560         }
561     }
562
563   if (ttyarg != NULL)
564     catch_command_errors (tty_command, ttyarg, !batch, RETURN_MASK_ALL);
565
566 #ifdef ADDITIONAL_OPTION_HANDLER
567   ADDITIONAL_OPTION_HANDLER;
568 #endif
569
570   /* Error messages should no longer be distinguished with extra output. */
571   error_pre_print = NULL;
572   quit_pre_print = NULL;
573   warning_pre_print = "warning: ";
574
575   /* Read the .gdbinit file in the current directory, *if* it isn't
576      the same as the $HOME/.gdbinit file (it should exist, also).  */
577
578   if (!homedir
579       || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
580     if (!inhibit_gdbinit)
581       {
582         catch_command_errors (source_command, gdbinit, 0, RETURN_MASK_ALL);
583       }
584
585   for (i = 0; i < ncmd; i++)
586     {
587 #if 0
588       /* NOTE: cagney/1999-11-03: SET_TOP_LEVEL() was a macro that
589          expanded into a call to setjmp().  */
590       if (!SET_TOP_LEVEL ()) /* NB: This is #if 0'd out */
591         {
592           /* NOTE: I am commenting this out, because it is not clear
593              where this feature is used. It is very old and
594              undocumented. ezannoni: 1999-05-04 */
595 #if 0
596           if (cmdarg[i][0] == '-' && cmdarg[i][1] == '\0')
597             read_command_file (stdin);
598           else
599 #endif
600             source_command (cmdarg[i], !batch);
601           do_cleanups (ALL_CLEANUPS);
602         }
603 #endif
604       catch_command_errors (source_command, cmdarg[i], !batch, RETURN_MASK_ALL);
605     }
606   free ((PTR) cmdarg);
607
608   /* Read in the old history after all the command files have been read. */
609   init_history ();
610
611   if (batch)
612     {
613       /* We have hit the end of the batch file.  */
614       exit (0);
615     }
616
617   /* Do any host- or target-specific hacks.  This is used for i960 targets
618      to force the user to set a nindy target and spec its parameters.  */
619
620 #ifdef BEFORE_MAIN_LOOP_HOOK
621   BEFORE_MAIN_LOOP_HOOK;
622 #endif
623
624   END_PROGRESS (argv[0]);
625
626   /* Show time and/or space usage.  */
627
628   if (display_time)
629     {
630       long init_time = get_run_time () - time_at_startup;
631
632       printf_unfiltered ("Startup time: %ld.%06ld\n",
633                          init_time / 1000000, init_time % 1000000);
634     }
635
636   if (display_space)
637     {
638 #ifdef HAVE_SBRK
639       extern char **environ;
640       char *lim = (char *) sbrk (0);
641
642       printf_unfiltered ("Startup size: data size %ld\n",
643                          (long) (lim - (char *) &environ));
644 #endif
645     }
646
647   /* The default command loop. 
648      The WIN32 Gui calls this main to set up gdb's state, and 
649      has its own command loop. */
650 #if !defined _WIN32 || defined __GNUC__
651   /* GUIs generally have their own command loop, mainloop, or
652      whatever.  This is a good place to gain control because many
653      error conditions will end up here via longjmp(). */
654 #if 0
655   /* FIXME: cagney/1999-11-06: The original main loop was like: */
656   while (1)
657     {
658       if (!SET_TOP_LEVEL ())
659         {
660           do_cleanups (ALL_CLEANUPS);   /* Do complete cleanup */
661           /* GUIs generally have their own command loop, mainloop, or whatever.
662              This is a good place to gain control because many error
663              conditions will end up here via longjmp(). */
664           if (command_loop_hook)
665             command_loop_hook ();
666           else
667             command_loop ();
668           quit_command ((char *) 0, instream == stdin);
669         }
670     }
671   /* NOTE: If the command_loop() returned normally, the loop would
672      attempt to exit by calling the function quit_command().  That
673      function would either call exit() or throw an error returning
674      control to SET_TOP_LEVEL. */
675   /* NOTE: The function do_cleanups() was called once each time round
676      the loop.  The usefulness of the call isn't clear.  If an error
677      was thrown, everything would have already been cleaned up.  If
678      command_loop() returned normally and quit_command() was called,
679      either exit() or error() (again cleaning up) would be called. */
680 #endif
681   /* NOTE: cagney/1999-11-07: There is probably no reason for not
682      moving this loop and the code found in captured_command_loop()
683      into the command_loop() proper.  The main thing holding back that
684      change - SET_TOP_LEVEL() - has been eliminated. */
685   while (1)
686     {
687       catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL);
688     }
689 #endif
690   /* No exit -- exit is through quit_command.  */
691 }
692
693 int
694 main (int argc, char **argv)
695 {
696   int top_level_val;
697   struct captured_main_args args;
698   args.argc = argc;
699   args.argv = argv;
700   catch_errors (captured_main, &args, "", RETURN_MASK_ALL);
701   return 0;
702 }
703
704
705 /* Don't use *_filtered for printing help.  We don't want to prompt
706    for continue no matter how small the screen or how much we're going
707    to print.  */
708
709 static void
710 print_gdb_help (stream)
711      GDB_FILE *stream;
712 {
713   fputs_unfiltered ("\
714 This is the GNU debugger.  Usage:\n\n\
715     gdb [options] [executable-file [core-file or process-id]]\n\n\
716 Options:\n\n\
717 ", stream);
718   fputs_unfiltered ("\
719   --[no]async        Enable (disable) asynchronous version of CLI\n\
720 ", stream);
721   fputs_unfiltered ("\
722   -b BAUDRATE        Set serial port baud rate used for remote debugging.\n\
723   --batch            Exit after processing options.\n\
724   --cd=DIR           Change current directory to DIR.\n\
725   --command=FILE     Execute GDB commands from FILE.\n\
726   --core=COREFILE    Analyze the core dump COREFILE.\n\
727 ", stream);
728   fputs_unfiltered ("\
729   --dbx              DBX compatibility mode.\n\
730   --directory=DIR    Search for source files in DIR.\n\
731   --epoch            Output information used by epoch emacs-GDB interface.\n\
732   --exec=EXECFILE    Use EXECFILE as the executable.\n\
733   --fullname         Output information used by emacs-GDB interface.\n\
734   --help             Print this message.\n\
735 ", stream);
736   fputs_unfiltered ("\
737   --mapped           Use mapped symbol files if supported on this system.\n\
738   --nw               Do not use a window interface.\n\
739   --nx               Do not read ", stream);
740   fputs_unfiltered (gdbinit, stream);
741   fputs_unfiltered (" file.\n\
742   --quiet            Do not print version number on startup.\n\
743   --readnow          Fully read symbol files on first access.\n\
744 ", stream);
745   fputs_unfiltered ("\
746   --se=FILE          Use FILE as symbol file and executable file.\n\
747   --symbols=SYMFILE  Read symbols from SYMFILE.\n\
748   --tty=TTY          Use TTY for input/output by the program being debugged.\n\
749 ", stream);
750 #if defined(TUI)
751   fputs_unfiltered ("\
752   --tui              Use a terminal user interface.\n\
753 ", stream);
754 #endif
755   fputs_unfiltered ("\
756   --version          Print version information and then exit.\n\
757   -w                 Use a window interface.\n\
758   --write            Set writing into executable and core files.\n\
759   --xdb              XDB compatibility mode.\n\
760 ", stream);
761 #ifdef ADDITIONAL_OPTION_HELP
762   fputs_unfiltered (ADDITIONAL_OPTION_HELP, stream);
763 #endif
764   fputs_unfiltered ("\n\
765 For more information, type \"help\" from within GDB, or consult the\n\
766 GDB manual (available as on-line info or a printed manual).\n\
767 Report bugs to \"bug-gdb@gnu.org\".\
768 ", stream);
769 }