import gdb-1999-12-13 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       {"d", required_argument, 0, 'd'},
253       {"cd", required_argument, 0, 11},
254       {"tty", required_argument, 0, 't'},
255       {"baud", required_argument, 0, 'b'},
256       {"b", required_argument, 0, 'b'},
257       {"nw", no_argument, &use_windows, 0},
258       {"nowindows", no_argument, &use_windows, 0},
259       {"w", no_argument, &use_windows, 1},
260       {"windows", no_argument, &use_windows, 1},
261       {"statistics", no_argument, 0, 13},
262       {"write", no_argument, &write_files, 1},
263 /* Allow machine descriptions to add more options... */
264 #ifdef ADDITIONAL_OPTIONS
265       ADDITIONAL_OPTIONS
266 #endif
267       {0, no_argument, 0, 0}
268     };
269
270     while (1)
271       {
272         int option_index;
273
274         c = getopt_long_only (argc, argv, "",
275                               long_options, &option_index);
276         if (c == EOF)
277           break;
278
279         /* Long option that takes an argument.  */
280         if (c == 0 && long_options[option_index].flag == 0)
281           c = long_options[option_index].val;
282
283         switch (c)
284           {
285           case 0:
286             /* Long option that just sets a flag.  */
287             break;
288           case 10:
289             symarg = optarg;
290             execarg = optarg;
291             break;
292           case 11:
293             cdarg = optarg;
294             break;
295           case 12:
296             /* FIXME: what if the syntax is wrong (e.g. not digits)?  */
297             annotation_level = atoi (optarg);
298             break;
299           case 13:
300             /* Enable the display of both time and space usage.  */
301             display_time = 1;
302             display_space = 1;
303             break;
304           case 'f':
305             annotation_level = 1;
306 /* We have probably been invoked from emacs.  Disable window interface.  */
307             use_windows = 0;
308             break;
309           case 's':
310             symarg = optarg;
311             break;
312           case 'e':
313             execarg = optarg;
314             break;
315           case 'c':
316             corearg = optarg;
317             break;
318           case 'x':
319             cmdarg[ncmd++] = optarg;
320             if (ncmd >= cmdsize)
321               {
322                 cmdsize *= 2;
323                 cmdarg = (char **) xrealloc ((char *) cmdarg,
324                                              cmdsize * sizeof (*cmdarg));
325               }
326             break;
327           case 'd':
328             dirarg[ndir++] = optarg;
329             if (ndir >= dirsize)
330               {
331                 dirsize *= 2;
332                 dirarg = (char **) xrealloc ((char *) dirarg,
333                                              dirsize * sizeof (*dirarg));
334               }
335             break;
336           case 't':
337             ttyarg = optarg;
338             break;
339           case 'q':
340             quiet = 1;
341             break;
342           case 'b':
343             {
344               int i;
345               char *p;
346
347               i = strtol (optarg, &p, 0);
348               if (i == 0 && p == optarg)
349
350                 /* Don't use *_filtered or warning() (which relies on
351                    current_target) until after initialize_all_files(). */
352
353                 fprintf_unfiltered
354                   (gdb_stderr,
355                    "warning: could not set baud rate to `%s'.\n", optarg);
356               else
357                 baud_rate = i;
358             }
359           case 'l':
360             {
361               int i;
362               char *p;
363
364               i = strtol (optarg, &p, 0);
365               if (i == 0 && p == optarg)
366
367                 /* Don't use *_filtered or warning() (which relies on
368                    current_target) until after initialize_all_files(). */
369
370                 fprintf_unfiltered
371                   (gdb_stderr,
372                  "warning: could not set timeout limit to `%s'.\n", optarg);
373               else
374                 remote_timeout = i;
375             }
376             break;
377
378 #ifdef ADDITIONAL_OPTION_CASES
379             ADDITIONAL_OPTION_CASES
380 #endif
381           case '?':
382             fprintf_unfiltered (gdb_stderr,
383                         "Use `%s --help' for a complete list of options.\n",
384                                 argv[0]);
385             exit (1);
386           }
387       }
388
389     /* If --help or --version, disable window interface.  */
390     if (print_help || print_version)
391       {
392         use_windows = 0;
393 #ifdef TUI
394         /* Disable the TUI as well.  */
395         tui_version = 0;
396 #endif
397       }
398
399 #ifdef TUI
400     /* An explicit --tui flag overrides the default UI, which is the
401        window system.  */
402     if (tui_version)
403       use_windows = 0;
404 #endif
405
406     /* OK, that's all the options.  The other arguments are filenames.  */
407     count = 0;
408     for (; optind < argc; optind++)
409       switch (++count)
410         {
411         case 1:
412           symarg = argv[optind];
413           execarg = argv[optind];
414           break;
415         case 2:
416           corearg = argv[optind];
417           break;
418         case 3:
419           fprintf_unfiltered (gdb_stderr,
420                           "Excess command line arguments ignored. (%s%s)\n",
421                           argv[optind], (optind == argc - 1) ? "" : " ...");
422           break;
423         }
424     if (batch)
425       quiet = 1;
426   }
427
428 #if defined(TUI)
429   /* Should this be moved to tui-top.c:_initialize_tui()? */
430   if (tui_version)
431     init_ui_hook = tuiInit;
432 #endif
433
434   /* Initialize all files.  Give the interpreter a chance to take
435      control of the console via the init_ui_hook()) */
436   gdb_init (argv[0]);
437
438   /* Do these (and anything which might call wrap_here or *_filtered)
439      after initialize_all_files.  */
440   if (print_version)
441     {
442       print_gdb_version (gdb_stdout);
443       wrap_here ("");
444       printf_filtered ("\n");
445       exit (0);
446     }
447
448   if (print_help)
449     {
450       print_gdb_help (gdb_stdout);
451       fputs_unfiltered ("\n", gdb_stdout);
452       exit (0);
453     }
454
455   if (!quiet)
456     {
457       /* Print all the junk at the top, with trailing "..." if we are about
458          to read a symbol file (possibly slowly).  */
459       print_gdb_version (gdb_stdout);
460       if (symarg)
461         printf_filtered ("..");
462       wrap_here ("");
463       gdb_flush (gdb_stdout);   /* Force to screen during slow operations */
464     }
465
466   error_pre_print = "\n\n";
467   quit_pre_print = error_pre_print;
468
469   /* We may get more than one warning, don't double space all of them... */
470   warning_pre_print = "\nwarning: ";
471
472   /* Read and execute $HOME/.gdbinit file, if it exists.  This is done
473      *before* all the command line arguments are processed; it sets
474      global parameters, which are independent of what file you are
475      debugging or what directory you are in.  */
476 #ifdef __CYGWIN32__
477   {
478     char *tmp = getenv ("HOME");
479
480     if (tmp != NULL)
481       {
482         homedir = (char *) alloca (MAX_PATH + 1);
483         cygwin32_conv_to_posix_path (tmp, homedir);
484       }
485     else
486       homedir = NULL;
487   }
488 #else
489   homedir = getenv ("HOME");
490 #endif
491   if (homedir)
492     {
493       homeinit = (char *) alloca (strlen (homedir) +
494                                   strlen (gdbinit) + 10);
495       strcpy (homeinit, homedir);
496       strcat (homeinit, "/");
497       strcat (homeinit, gdbinit);
498
499       if (!inhibit_gdbinit)
500         {
501           catch_command_errors (source_command, homeinit, 0, RETURN_MASK_ALL);
502         }
503
504       /* Do stats; no need to do them elsewhere since we'll only
505          need them if homedir is set.  Make sure that they are
506          zero in case one of them fails (this guarantees that they
507          won't match if either exists).  */
508
509       memset (&homebuf, 0, sizeof (struct stat));
510       memset (&cwdbuf, 0, sizeof (struct stat));
511
512       stat (homeinit, &homebuf);
513       stat (gdbinit, &cwdbuf);  /* We'll only need this if
514                                    homedir was set.  */
515     }
516
517   /* Now perform all the actions indicated by the arguments.  */
518   if (cdarg != NULL)
519     {
520       catch_command_errors (cd_command, cdarg, 0, RETURN_MASK_ALL);
521     }
522
523   for (i = 0; i < ndir; i++)
524     catch_command_errors (directory_command, dirarg[i], 0, RETURN_MASK_ALL);
525   free ((PTR) dirarg);
526
527   if (execarg != NULL
528       && symarg != NULL
529       && STREQ (execarg, symarg))
530     {
531       /* The exec file and the symbol-file are the same.  If we can't
532          open it, better only print one error message.
533          catch_command_errors returns non-zero on success! */
534       if (catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL))
535         catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
536     }
537   else
538     {
539       if (execarg != NULL)
540         catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL);
541       if (symarg != NULL)
542         catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
543     }
544
545   /* After the symbol file has been read, print a newline to get us
546      beyond the copyright line...  But errors should still set off
547      the error message with a (single) blank line.  */
548   if (!quiet)
549     printf_filtered ("\n");
550   error_pre_print = "\n";
551   quit_pre_print = error_pre_print;
552   warning_pre_print = "\nwarning: ";
553
554   if (corearg != NULL)
555     {
556       if (catch_command_errors (core_file_command, corearg, !batch, RETURN_MASK_ALL) == 0)
557         {
558           /* See if the core file is really a PID. */
559           if (isdigit (corearg[0]))
560             catch_command_errors (attach_command, corearg, !batch, RETURN_MASK_ALL);
561         }
562     }
563
564   if (ttyarg != NULL)
565     catch_command_errors (tty_command, ttyarg, !batch, RETURN_MASK_ALL);
566
567 #ifdef ADDITIONAL_OPTION_HANDLER
568   ADDITIONAL_OPTION_HANDLER;
569 #endif
570
571   /* Error messages should no longer be distinguished with extra output. */
572   error_pre_print = NULL;
573   quit_pre_print = NULL;
574   warning_pre_print = "warning: ";
575
576   /* Read the .gdbinit file in the current directory, *if* it isn't
577      the same as the $HOME/.gdbinit file (it should exist, also).  */
578
579   if (!homedir
580       || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
581     if (!inhibit_gdbinit)
582       {
583         catch_command_errors (source_command, gdbinit, 0, RETURN_MASK_ALL);
584       }
585
586   for (i = 0; i < ncmd; i++)
587     {
588 #if 0
589       /* NOTE: cagney/1999-11-03: SET_TOP_LEVEL() was a macro that
590          expanded into a call to setjmp().  */
591       if (!SET_TOP_LEVEL ()) /* NB: This is #if 0'd out */
592         {
593           /* NOTE: I am commenting this out, because it is not clear
594              where this feature is used. It is very old and
595              undocumented. ezannoni: 1999-05-04 */
596 #if 0
597           if (cmdarg[i][0] == '-' && cmdarg[i][1] == '\0')
598             read_command_file (stdin);
599           else
600 #endif
601             source_command (cmdarg[i], !batch);
602           do_cleanups (ALL_CLEANUPS);
603         }
604 #endif
605       catch_command_errors (source_command, cmdarg[i], !batch, RETURN_MASK_ALL);
606     }
607   free ((PTR) cmdarg);
608
609   /* Read in the old history after all the command files have been read. */
610   init_history ();
611
612   if (batch)
613     {
614       /* We have hit the end of the batch file.  */
615       exit (0);
616     }
617
618   /* Do any host- or target-specific hacks.  This is used for i960 targets
619      to force the user to set a nindy target and spec its parameters.  */
620
621 #ifdef BEFORE_MAIN_LOOP_HOOK
622   BEFORE_MAIN_LOOP_HOOK;
623 #endif
624
625   END_PROGRESS (argv[0]);
626
627   /* Show time and/or space usage.  */
628
629   if (display_time)
630     {
631       long init_time = get_run_time () - time_at_startup;
632
633       printf_unfiltered ("Startup time: %ld.%06ld\n",
634                          init_time / 1000000, init_time % 1000000);
635     }
636
637   if (display_space)
638     {
639 #ifdef HAVE_SBRK
640       extern char **environ;
641       char *lim = (char *) sbrk (0);
642
643       printf_unfiltered ("Startup size: data size %ld\n",
644                          (long) (lim - (char *) &environ));
645 #endif
646     }
647
648   /* The default command loop. 
649      The WIN32 Gui calls this main to set up gdb's state, and 
650      has its own command loop. */
651 #if !defined _WIN32 || defined __GNUC__
652   /* GUIs generally have their own command loop, mainloop, or
653      whatever.  This is a good place to gain control because many
654      error conditions will end up here via longjmp(). */
655 #if 0
656   /* FIXME: cagney/1999-11-06: The original main loop was like: */
657   while (1)
658     {
659       if (!SET_TOP_LEVEL ())
660         {
661           do_cleanups (ALL_CLEANUPS);   /* Do complete cleanup */
662           /* GUIs generally have their own command loop, mainloop, or whatever.
663              This is a good place to gain control because many error
664              conditions will end up here via longjmp(). */
665           if (command_loop_hook)
666             command_loop_hook ();
667           else
668             command_loop ();
669           quit_command ((char *) 0, instream == stdin);
670         }
671     }
672   /* NOTE: If the command_loop() returned normally, the loop would
673      attempt to exit by calling the function quit_command().  That
674      function would either call exit() or throw an error returning
675      control to SET_TOP_LEVEL. */
676   /* NOTE: The function do_cleanups() was called once each time round
677      the loop.  The usefulness of the call isn't clear.  If an error
678      was thrown, everything would have already been cleaned up.  If
679      command_loop() returned normally and quit_command() was called,
680      either exit() or error() (again cleaning up) would be called. */
681 #endif
682   /* NOTE: cagney/1999-11-07: There is probably no reason for not
683      moving this loop and the code found in captured_command_loop()
684      into the command_loop() proper.  The main thing holding back that
685      change - SET_TOP_LEVEL() - has been eliminated. */
686   while (1)
687     {
688       catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL);
689     }
690 #endif
691   /* No exit -- exit is through quit_command.  */
692 }
693
694 int
695 main (int argc, char **argv)
696 {
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 }