#include "inferior.h"
#include "symfile.h"
#include "gdbcore.h"
-
-#include "exceptions.h"
#include "getopt.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
-
-#include <string.h>
#include "event-loop.h"
#include "ui-out.h"
#include "filestuff.h"
#include <signal.h>
#include "event-top.h"
+#include "infrun.h"
/* The selected interpreter. This will be used as a set command
variable, so it should always be malloc'ed - since
TRY_CATCH (e, mask)
{
+ int was_sync = sync_execution;
+
command (arg, from_tty);
+
+ maybe_wait_sync_command_done (was_sync);
}
return handle_command_errors (e);
}
TRY_CATCH (e, mask)
{
+ int was_sync = sync_execution;
+
command (arg, from_tty);
+
+ maybe_wait_sync_command_done (was_sync);
}
return handle_command_errors (e);
}
gdb_program_name = xstrdup (argv[0]);
#endif
+ /* Prefix warning messages with the command name. */
+ warning_pre_print = xstrprintf ("%s: warning: ", gdb_program_name);
+
if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
- /* Don't use *_filtered or warning() (which relies on
- current_target) until after initialize_all_files(). */
- fprintf_unfiltered (gdb_stderr,
- _("%s: warning: error finding "
- "working directory: %s\n"),
- argv[0], safe_strerror (errno));
-
+ perror_warning_with_name (_("error finding working directory"));
+
current_directory = gdb_dirbuf;
/* Set the sysroot path. */
xfree (interpreter_p);
interpreter_p = xstrdup (INTERP_TUI);
#else
- fprintf_unfiltered (gdb_stderr,
- _("%s: TUI mode is not supported\n"),
- argv[0]);
- exit (1);
+ error (_("%s: TUI mode is not supported"), gdb_program_name);
#endif
break;
case OPT_WINDOWS:
break;
case 'D':
if (optarg[0] == '\0')
- {
- fprintf_unfiltered (gdb_stderr,
- _("%s: empty path for"
- " `--data-directory'\n"),
- argv[0]);
- exit (1);
- }
+ error (_("%s: empty path for `--data-directory'"),
+ gdb_program_name);
set_gdb_data_directory (optarg);
gdb_datadir_provided = 1;
break;
extern int gdbtk_test (char *);
if (!gdbtk_test (optarg))
- {
- fprintf_unfiltered (gdb_stderr,
- _("%s: unable to load "
- "tclcommand file \"%s\""),
- argv[0], optarg);
- exit (1);
- }
+ error (_("%s: unable to load tclcommand file \"%s\""),
+ gdb_program_name, optarg);
break;
}
case 'y':
i = strtol (optarg, &p, 0);
if (i == 0 && p == optarg)
-
- /* Don't use *_filtered or warning() (which relies on
- current_target) until after initialize_all_files(). */
-
- fprintf_unfiltered
- (gdb_stderr,
- _("warning: could not set baud rate to `%s'.\n"), optarg);
+ warning (_("could not set baud rate to `%s'."),
+ optarg);
else
baud_rate = i;
}
i = strtol (optarg, &p, 0);
if (i == 0 && p == optarg)
-
- /* Don't use *_filtered or warning() (which relies on
- current_target) until after initialize_all_files(). */
-
- fprintf_unfiltered (gdb_stderr,
- _("warning: could not set "
- "timeout limit to `%s'.\n"), optarg);
+ warning (_("could not set timeout limit to `%s'."),
+ optarg);
else
remote_timeout = i;
}
break;
case '?':
- fprintf_unfiltered (gdb_stderr,
- _("Use `%s --help' for a "
- "complete list of options.\n"),
- argv[0]);
- exit (1);
+ error (_("Use `%s --help' for a complete list of options."),
+ gdb_program_name);
}
}
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);
- }
+ error (_("%s: `--args' specified but no program specified"),
+ gdb_program_name);
+
symarg = argv[optind];
execarg = argv[optind];
++optind;
error (_("Interpreter `%s' unrecognized"), interpreter_p);
/* Install it. */
if (!interp_set (interp, 1))
- {
- fprintf_unfiltered (gdb_stderr,
- "Interpreter `%s' failed to initialize.\n",
- interpreter_p);
- exit (1);
- }
+ error (_("Interpreter `%s' failed to initialize."), interpreter_p);
}
/* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets
}
/* Set off error and warning messages with a blank line. */
+ xfree (warning_pre_print);
warning_pre_print = _("\nwarning: ");
/* Read and execute the system-wide gdbinit file, if it exists.