mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 12:24:19 +08:00
* language.c, language.h: Move saved_language out to global
expected_language. Set expected_language when user expectation changes. * language.c (language_info): Don't print type/range checking gub. * main.c (main): Set expected language. (execute_command): Check against expected language. * symfile.c (set_initial_language): Set expected language.
This commit is contained in:
@ -1,5 +1,13 @@
|
|||||||
Tue Oct 6 02:23:17 1992 John Gilmore (gnu@cygnus.com)
|
Tue Oct 6 02:23:17 1992 John Gilmore (gnu@cygnus.com)
|
||||||
|
|
||||||
|
* language.c, language.h: Move saved_language out to global
|
||||||
|
expected_language. Set expected_language when user expectation
|
||||||
|
changes.
|
||||||
|
* language.c (language_info): Don't print type/range checking gub.
|
||||||
|
* main.c (main): Set expected language.
|
||||||
|
(execute_command): Check against expected language.
|
||||||
|
* symfile.c (set_initial_language): Set expected language.
|
||||||
|
|
||||||
* configure.in, config/i386sol2.{mh,mt}: Preliminary Solaris-x86 conf.
|
* configure.in, config/i386sol2.{mh,mt}: Preliminary Solaris-x86 conf.
|
||||||
|
|
||||||
Fri Sep 4 00:34:30 1992 Per Bothner (bothner@rtl.cygnus.com)
|
Fri Sep 4 00:34:30 1992 Per Bothner (bothner@rtl.cygnus.com)
|
||||||
|
@ -102,6 +102,11 @@ enum type_check type_check = type_check_off;
|
|||||||
const struct language_defn *current_language = &unknown_language_defn;
|
const struct language_defn *current_language = &unknown_language_defn;
|
||||||
enum language_mode language_mode = language_mode_auto;
|
enum language_mode language_mode = language_mode_auto;
|
||||||
|
|
||||||
|
/* The language that the user expects to be typing in (the language
|
||||||
|
of main(), or the last language we notified them about, or C). */
|
||||||
|
|
||||||
|
const struct language_defn *expected_language;
|
||||||
|
|
||||||
/* The list of supported languages. The list itself is malloc'd. */
|
/* The list of supported languages. The list itself is malloc'd. */
|
||||||
|
|
||||||
static const struct language_defn **languages;
|
static const struct language_defn **languages;
|
||||||
@ -176,6 +181,7 @@ modula-2 Use the Modula-2 language\n");
|
|||||||
flang = get_frame_language();
|
flang = get_frame_language();
|
||||||
if (flang!=language_unknown)
|
if (flang!=language_unknown)
|
||||||
set_language(flang);
|
set_language(flang);
|
||||||
|
expected_language = current_language;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
/* Enter manual mode. Set the specified language. */
|
/* Enter manual mode. Set the specified language. */
|
||||||
@ -183,6 +189,7 @@ modula-2 Use the Modula-2 language\n");
|
|||||||
current_language = languages[i];
|
current_language = languages[i];
|
||||||
set_type_range ();
|
set_type_range ();
|
||||||
set_lang_str();
|
set_lang_str();
|
||||||
|
expected_language = current_language;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,17 +401,25 @@ set_range_str()
|
|||||||
|
|
||||||
/* Print out the current language settings: language, range and
|
/* Print out the current language settings: language, range and
|
||||||
type checking. If QUIETLY, print only what has changed. */
|
type checking. If QUIETLY, print only what has changed. */
|
||||||
|
|
||||||
void
|
void
|
||||||
language_info (quietly)
|
language_info (quietly)
|
||||||
int quietly;
|
int quietly;
|
||||||
{
|
{
|
||||||
/* FIXME: quietly is ignored at the moment. */
|
if (quietly && expected_language == current_language)
|
||||||
printf("Current Language: %s\n",language);
|
return;
|
||||||
show_language_command((char *)0, 1);
|
|
||||||
printf("Type checking: %s\n",type);
|
expected_language = current_language;
|
||||||
show_type_command((char *)0, 1);
|
printf("Current language: %s\n",language);
|
||||||
printf("Range checking: %s\n",range);
|
show_language_command((char *)0, 1);
|
||||||
show_range_command((char *)0, 1);
|
|
||||||
|
if (!quietly)
|
||||||
|
{
|
||||||
|
printf("Type checking: %s\n",type);
|
||||||
|
show_type_command((char *)0, 1);
|
||||||
|
printf("Range checking: %s\n",range);
|
||||||
|
show_range_command((char *)0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the result of a binary operation. */
|
/* Return the result of a binary operation. */
|
||||||
|
@ -95,6 +95,11 @@ const struct op_print
|
|||||||
|
|
||||||
extern const struct language_defn *current_language;
|
extern const struct language_defn *current_language;
|
||||||
|
|
||||||
|
/* Pointer to the language_defn expected by the user, e.g. the language
|
||||||
|
of main(), or the language we last mentioned in a message, or C. */
|
||||||
|
|
||||||
|
extern const struct language_defn *expected_language;
|
||||||
|
|
||||||
/* language_mode ==
|
/* language_mode ==
|
||||||
language_mode_auto: current_language automatically set upon selection
|
language_mode_auto: current_language automatically set upon selection
|
||||||
of scope (e.g. stack frame)
|
of scope (e.g. stack frame)
|
||||||
|
97
gdb/main.c
97
gdb/main.c
@ -704,6 +704,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
|
|||||||
"set width 0" won't fail if no language is explicitly set in a config file
|
"set width 0" won't fail if no language is explicitly set in a config file
|
||||||
or implicitly set by reading an executable during startup. */
|
or implicitly set by reading an executable during startup. */
|
||||||
set_language (language_c);
|
set_language (language_c);
|
||||||
|
expected_language = current_language; /* don't warn about the change. */
|
||||||
|
|
||||||
/* Read and execute $HOME/.gdbinit file, if it exists. This is done
|
/* Read and execute $HOME/.gdbinit file, if it exists. This is done
|
||||||
*before* all the command line arguments are processed; it sets
|
*before* all the command line arguments are processed; it sets
|
||||||
@ -860,6 +861,34 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
|
|||||||
/* No exit -- exit is through quit_command. */
|
/* No exit -- exit is through quit_command. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
execute_user_command (c, args)
|
||||||
|
struct cmd_list_element *c;
|
||||||
|
char *args;
|
||||||
|
{
|
||||||
|
register struct command_line *cmdlines;
|
||||||
|
struct cleanup *old_chain;
|
||||||
|
|
||||||
|
if (args)
|
||||||
|
error ("User-defined commands cannot take arguments.");
|
||||||
|
|
||||||
|
cmdlines = c->user_commands;
|
||||||
|
if (cmdlines == 0)
|
||||||
|
/* Null command */
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Set the instream to 0, indicating execution of a
|
||||||
|
user-defined function. */
|
||||||
|
old_chain = make_cleanup (source_cleanup, instream);
|
||||||
|
instream = (FILE *) 0;
|
||||||
|
while (cmdlines)
|
||||||
|
{
|
||||||
|
execute_command (cmdlines->line, 0);
|
||||||
|
cmdlines = cmdlines->next;
|
||||||
|
}
|
||||||
|
do_cleanups (old_chain);
|
||||||
|
}
|
||||||
|
|
||||||
/* Execute the line P as a command.
|
/* Execute the line P as a command.
|
||||||
Pass FROM_TTY as second argument to the defining function. */
|
Pass FROM_TTY as second argument to the defining function. */
|
||||||
|
|
||||||
@ -871,7 +900,6 @@ execute_command (p, from_tty)
|
|||||||
register struct cmd_list_element *c;
|
register struct cmd_list_element *c;
|
||||||
register struct command_line *cmdlines;
|
register struct command_line *cmdlines;
|
||||||
register enum language flang;
|
register enum language flang;
|
||||||
static const struct language_defn *saved_language = 0;
|
|
||||||
static int warned = 0;
|
static int warned = 0;
|
||||||
|
|
||||||
free_all_values ();
|
free_all_values ();
|
||||||
@ -888,28 +916,13 @@ execute_command (p, from_tty)
|
|||||||
c = lookup_cmd (&p, cmdlist, "", 0, 1);
|
c = lookup_cmd (&p, cmdlist, "", 0, 1);
|
||||||
/* Pass null arg rather than an empty one. */
|
/* Pass null arg rather than an empty one. */
|
||||||
arg = *p ? p : 0;
|
arg = *p ? p : 0;
|
||||||
if (c->class == class_user)
|
|
||||||
{
|
|
||||||
struct cleanup *old_chain;
|
|
||||||
|
|
||||||
if (*p)
|
|
||||||
error ("User-defined commands cannot take arguments.");
|
|
||||||
cmdlines = c->user_commands;
|
|
||||||
if (cmdlines == 0)
|
|
||||||
/* Null command */
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Set the instream to 0, indicating execution of a
|
/* If this command has been hooked, run the hook first. */
|
||||||
user-defined function. */
|
if (c->hook)
|
||||||
old_chain = make_cleanup (source_cleanup, instream);
|
execute_user_command (c->hook, (char *)0);
|
||||||
instream = (FILE *) 0;
|
|
||||||
while (cmdlines)
|
if (c->class == class_user)
|
||||||
{
|
execute_user_command (c, arg);
|
||||||
execute_command (cmdlines->line, 0);
|
|
||||||
cmdlines = cmdlines->next;
|
|
||||||
}
|
|
||||||
do_cleanups (old_chain);
|
|
||||||
}
|
|
||||||
else if (c->type == set_cmd || c->type == show_cmd)
|
else if (c->type == set_cmd || c->type == show_cmd)
|
||||||
do_setshow_command (arg, from_tty & caution, c);
|
do_setshow_command (arg, from_tty & caution, c);
|
||||||
else if (c->function.cfunc == NO_FUNCTION)
|
else if (c->function.cfunc == NO_FUNCTION)
|
||||||
@ -919,13 +932,11 @@ execute_command (p, from_tty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Tell the user if the language has changed (except first time). */
|
/* Tell the user if the language has changed (except first time). */
|
||||||
if (current_language != saved_language)
|
if (current_language != expected_language)
|
||||||
{
|
{
|
||||||
if (language_mode == language_mode_auto) {
|
if (language_mode == language_mode_auto) {
|
||||||
if (saved_language)
|
language_info (1); /* Print what changed. */
|
||||||
language_info (1); /* Print what changed. */
|
|
||||||
}
|
}
|
||||||
saved_language = current_language;
|
|
||||||
warned = 0;
|
warned = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1748,8 +1759,10 @@ define_command (comname, from_tty)
|
|||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
register struct command_line *cmds;
|
register struct command_line *cmds;
|
||||||
register struct cmd_list_element *c, *newc;
|
register struct cmd_list_element *c, *newc, *hookc;
|
||||||
char *tem = comname;
|
char *tem = comname;
|
||||||
|
#define HOOK_STRING "hook-"
|
||||||
|
#define HOOK_LEN 5
|
||||||
|
|
||||||
validate_comname (comname);
|
validate_comname (comname);
|
||||||
|
|
||||||
@ -1768,9 +1781,29 @@ define_command (comname, from_tty)
|
|||||||
error ("Command \"%s\" not redefined.", c->name);
|
error ("Command \"%s\" not redefined.", c->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this new command is a hook, then mark the command which it
|
||||||
|
is hooking. Note that we allow hooking `help' commands, so that
|
||||||
|
we can hook the `stop' pseudo-command. */
|
||||||
|
|
||||||
|
if (!strncmp (comname, HOOK_STRING, HOOK_LEN))
|
||||||
|
{
|
||||||
|
/* Look up cmd it hooks, and verify that we got an exact match. */
|
||||||
|
tem = comname+HOOK_LEN;
|
||||||
|
hookc = lookup_cmd (&tem, cmdlist, "", -1, 0);
|
||||||
|
if (hookc && 0 != strcmp (comname+HOOK_LEN, hookc->name))
|
||||||
|
hookc = 0;
|
||||||
|
if (!hookc)
|
||||||
|
{
|
||||||
|
warning ("Your new `%s' command does not hook any existing command.",
|
||||||
|
comname);
|
||||||
|
if (!query ("Proceed? ", (char *)0))
|
||||||
|
error ("Not confirmed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
comname = savestring (comname, strlen (comname));
|
comname = savestring (comname, strlen (comname));
|
||||||
|
|
||||||
/* If the rest of the commands will be case insensetive, this one
|
/* If the rest of the commands will be case insensitive, this one
|
||||||
should behave in the same manner. */
|
should behave in the same manner. */
|
||||||
for (tem = comname; *tem; tem++)
|
for (tem = comname; *tem; tem++)
|
||||||
if (isupper(*tem)) *tem = tolower(*tem);
|
if (isupper(*tem)) *tem = tolower(*tem);
|
||||||
@ -1791,6 +1824,14 @@ End with a line saying just \"end\".\n", comname);
|
|||||||
(c && c->class == class_user)
|
(c && c->class == class_user)
|
||||||
? c->doc : savestring ("User-defined.", 13), &cmdlist);
|
? c->doc : savestring ("User-defined.", 13), &cmdlist);
|
||||||
newc->user_commands = cmds;
|
newc->user_commands = cmds;
|
||||||
|
|
||||||
|
/* If this new command is a hook, then mark both commands as being
|
||||||
|
tied. */
|
||||||
|
if (hookc)
|
||||||
|
{
|
||||||
|
hookc->hook = newc; /* Target gets hooked. */
|
||||||
|
newc->hookee = hookc; /* We are marked as hooking target cmd. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user