#include "event-loop.h"
#include "ui-out.h"
-#if defined (TUI)
-/* FIXME: cagney/2000-01-31: This #include is to allow older code such
- as that found in the TUI to continue to build. */
-#include "tui/tui-file.h"
-#endif
-
/* If nonzero, display time usage both at startup and for each command. */
int display_time;
/* These two are used to set the external editor commands when gdb is farming
out files to be edited by another program. */
-extern int enable_external_editor;
extern char *external_editor_command;
/* Call command_loop. If it happens to return, pass that through as a
int count;
static int quiet = 0;
static int batch = 0;
+ static int set_args = 0;
/* Pointers to various arguments from command line. */
char *symarg = NULL;
getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
current_directory = gdb_dirbuf;
-#if defined (TUI)
- gdb_stdout = tui_fileopen (stdout);
- gdb_stderr = tui_fileopen (stderr);
- gdb_stdlog = gdb_stdout; /* for moment */
- gdb_stdtarg = gdb_stderr; /* for moment */
-#else
gdb_stdout = stdio_fileopen (stdout);
gdb_stderr = stdio_fileopen (stderr);
gdb_stdlog = gdb_stderr; /* for moment */
gdb_stdtarg = gdb_stderr; /* for moment */
-#endif
/* initialize error() */
error_init ();
{"windows", no_argument, &use_windows, 1},
{"statistics", no_argument, 0, 13},
{"write", no_argument, &write_files, 1},
+ {"args", no_argument, &set_args, 1},
/* Allow machine descriptions to add more options... */
#ifdef ADDITIONAL_OPTIONS
ADDITIONAL_OPTIONS
c = getopt_long_only (argc, argv, "",
long_options, &option_index);
- if (c == EOF)
+ if (c == EOF || set_args)
break;
/* Long option that takes an argument. */
break;
}
case 'y':
- {
- /*
- * This enables the edit/button in the main window, even
- * when IDE_ENABLED is set to false. In this case you must
- * use --tclcommand to specify a tcl/script to be called,
- * Tcl/Variable to store the edit/command is:
- * external_editor
- */
- enable_external_editor = 1;
- break;
- }
+ /* Backwards compatibility only. */
+ break;
case 'w':
{
- /*
- * if editor command is enabled, both flags are set
- */
- enable_external_editor = 1;
external_editor_command = xstrdup (optarg);
break;
}
use_windows = 0;
#endif
- /* OK, that's all the options. The other arguments are filenames. */
- count = 0;
- for (; optind < argc; optind++)
- switch (++count)
- {
- case 1:
- symarg = argv[optind];
- execarg = argv[optind];
- break;
- case 2:
- /* FIXME: The documentation says this can be a "ProcID". as well. */
- corearg = argv[optind];
- break;
- case 3:
- fprintf_unfiltered (gdb_stderr,
- "Excess command line arguments ignored. (%s%s)\n",
- argv[optind], (optind == argc - 1) ? "" : " ...");
- break;
- }
+ if (set_args)
+ {
+ /* The remaining options are the command-line options for the
+ inferior. The first one is the sym/exec file, and the rest
+ are arguments. */
+ if (optind >= argc)
+ {
+ fprintf_unfiltered (gdb_stderr,
+ "%s: `--args' specified but no program specified\n",
+ argv[0]);
+ exit (1);
+ }
+ symarg = argv[optind];
+ execarg = argv[optind];
+ ++optind;
+ set_inferior_args_vector (argc - optind, &argv[optind]);
+ }
+ else
+ {
+ /* OK, that's all the options. The other arguments are filenames. */
+ count = 0;
+ for (; optind < argc; optind++)
+ switch (++count)
+ {
+ case 1:
+ symarg = argv[optind];
+ execarg = argv[optind];
+ break;
+ case 2:
+ /* FIXME: The documentation says this can be a
+ "ProcID". as well. */
+ corearg = argv[optind];
+ break;
+ case 3:
+ fprintf_unfiltered (gdb_stderr,
+ "Excess command line arguments ignored. (%s%s)\n",
+ argv[optind], (optind == argc - 1) ? "" : " ...");
+ break;
+ }
+ }
if (batch)
quiet = 1;
}
-#if defined(TUI)
- /* Should this be moved to tui-top.c:_initialize_tui()? */
- if (tui_version)
- init_ui_hook = tuiInit;
-#endif
-
/* Initialize all files. Give the interpreter a chance to take
control of the console via the init_ui_hook()) */
gdb_init (argv[0]);
{
fputs_unfiltered ("\
This is the GNU debugger. Usage:\n\n\
- gdb [options] [executable-file [core-file or process-id]]\n\n\
+ gdb [options] [executable-file [core-file or process-id]]\n\
+ gdb [options] --args executable-file [inferior-arguments ...]\n\n\
Options:\n\n\
+", stream);
+ fputs_unfiltered ("\
+ --args Arguments after executable-file are passed to inferior\n\
", stream);
fputs_unfiltered ("\
--[no]async Enable (disable) asynchronous version of CLI\n\