aboutsummaryrefslogtreecommitdiff
path: root/gdb/main.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-09-19 08:51:16 +0000
committerJohn Gilmore <gnu@cygnus>1991-09-19 08:51:16 +0000
commitbd099407658f0f5ebbfe8444d233f3e03ba088ef (patch)
tree4116384fa51a1466a1ec7ceb548514fc31346f7a /gdb/main.c
parent89e0bbcd4fc4e6cc95e7ab58e7e66b0031475084 (diff)
downloadfsf-binutils-gdb-bd099407658f0f5ebbfe8444d233f3e03ba088ef.zip
fsf-binutils-gdb-bd099407658f0f5ebbfe8444d233f3e03ba088ef.tar.gz
fsf-binutils-gdb-bd099407658f0f5ebbfe8444d233f3e03ba088ef.tar.bz2
* main.c (execute_command): Warn as language changes automatically.
(main): If error() is called during early initialization, print its message and then exit(1) from GDB.
Diffstat (limited to 'gdb/main.c')
-rw-r--r--gdb/main.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/gdb/main.c b/gdb/main.c
index 2c4f133..353e7b1 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -27,6 +27,7 @@ int fclose ();
#include "signals.h"
#include "target.h"
#include "breakpoint.h"
+#include "language.h"
#include "getopt.h"
@@ -80,6 +81,8 @@ extern char *version;
extern char *error_pre_print;
+extern char lang_frame_mismatch_warn[]; /* language.c */
+
/* Flag for whether we want all the "from_tty" gubbish printed. */
int caution = 1; /* Default is yes, sigh. */
@@ -144,7 +147,7 @@ static char dirbuf[MAXPATHLEN];
/* Function to call before reading a command, if nonzero.
The function receives two args: an input stream,
and a prompt string. */
-
+
void (*window_hook) ();
extern int frame_file_full_name;
@@ -338,6 +341,11 @@ main (argc, argv)
alloca (4 - i);
#endif
+ /* If error() is called from initialization code, just exit */
+ if (setjmp (to_top_level)) {
+ exit(1);
+ }
+
cmdsize = 1;
cmdarg = (char **) xmalloc (cmdsize * sizeof (*cmdarg));
ncmd = 0;
@@ -542,7 +550,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
print_gdb_version ();
if (symarg)
printf_filtered ("..");
- wrap_here();
+ wrap_here("");
fflush (stdout); /* Force to screen during slow operations */
}
@@ -705,6 +713,9 @@ execute_command (p, from_tty)
{
register struct cmd_list_element *c;
register struct command_line *cmdlines;
+ register enum language flang;
+ static enum language current = language_unknown;
+ static int warned = 0;
free_all_values ();
@@ -748,7 +759,31 @@ execute_command (p, from_tty)
error ("That is not a command, just a help topic.");
else
(*c->function) (arg, from_tty & caution);
+ }
+
+ /* Tell the user if the language has changed */
+ if (working_lang != current)
+ {
+ if (language_mode == language_mode_auto) {
+ if (current != language_unknown)
+ language_info ();
}
+ current = working_lang;
+ warned = 0;
+ }
+
+ /* Warn the user if the working language does not match the
+ language of the current frame. Only warn the user if we are
+ actually running the program, i.e. there is a stack. */
+ if (target_has_stack)
+ {
+ flang = get_frame_language();
+ if(!warned && flang != language_unknown && flang != working_lang)
+ {
+ printf_filtered ("%s\n", lang_frame_mismatch_warn);
+ warned = 1;
+ }
+ }
}
/* ARGSUSED */