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