aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-08-13 14:56:19 +0000
committerPedro Alves <palves@redhat.com>2009-08-13 14:56:19 +0000
commit5efd5804f7ba64dc4c42d8c3db2d4ab2eeebac75 (patch)
treefe02f5e8a7893f132d4726987987651c18dd3a29 /gdb
parentef5e0cb158fe57480e963c022879ccf50bf1f335 (diff)
downloadgdb-5efd5804f7ba64dc4c42d8c3db2d4ab2eeebac75.zip
gdb-5efd5804f7ba64dc4c42d8c3db2d4ab2eeebac75.tar.gz
gdb-5efd5804f7ba64dc4c42d8c3db2d4ab2eeebac75.tar.bz2
Revert 2009-08-07 changes for PR gdb/8869:
* language.c (set_language_command): Strip whitespace. (set_type_command): Likewise. (set_range_command): Likewise. * language.c (language_completer): New function. (range_or_type_completer): New function. (case_completer): New function. (_initialize_language): Set completers. * cli/cli-decode.c (add_setshow_string_cmd): Return the "set" command. (add_setshow_string_noescape_cmd): Likewise. (add_setshow_integer_cmd): Likewise. (add_setshow_uinteger_cmd): Likewise. (add_setshow_zinteger_cmd): Likewise. (add_setshow_zuinteger_cmd): Likewise. * command.h (add_setshow_string_cmd, add_setshow_string_noescape_cmd, add_setshow_uinteger_cmd, add_setshow_zinteger_cmd, add_setshow_zuinteger_cmd): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog23
-rw-r--r--gdb/cli/cli-decode.c54
-rw-r--r--gdb/command.h128
-rw-r--r--gdb/language.c133
4 files changed, 133 insertions, 205 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e524f9a..6b734f7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,26 @@
+2009-08-13 Pedro Alves <pedro@codesourcery.com>
+
+ Revert 2009-08-07 changes for PR gdb/8869:
+
+ * language.c (set_language_command): Strip whitespace.
+ (set_type_command): Likewise.
+ (set_range_command): Likewise.
+
+ * language.c (language_completer): New function.
+ (range_or_type_completer): New function.
+ (case_completer): New function.
+ (_initialize_language): Set completers.
+ * cli/cli-decode.c (add_setshow_string_cmd): Return the "set"
+ command.
+ (add_setshow_string_noescape_cmd): Likewise.
+ (add_setshow_integer_cmd): Likewise.
+ (add_setshow_uinteger_cmd): Likewise.
+ (add_setshow_zinteger_cmd): Likewise.
+ (add_setshow_zuinteger_cmd): Likewise.
+ * command.h (add_setshow_string_cmd,
+ add_setshow_string_noescape_cmd, add_setshow_uinteger_cmd,
+ add_setshow_zinteger_cmd, add_setshow_zuinteger_cmd): Update.
+
2009-08-12 Michael Snyder <msnyder@vmware.com>
* remote.c (remote_add_inferior): Remove unused local.
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index b547ba9..3e4f6f5 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -494,9 +494,8 @@ add_setshow_filename_cmd (char *name, enum command_class class,
}
/* Add element named NAME to both the set and show command LISTs (the
- list for set/show or some sublist thereof). Return the new "set"
- command. */
-struct cmd_list_element *
+ list for set/show or some sublist thereof). */
+void
add_setshow_string_cmd (char *name, enum command_class class,
char **var,
const char *set_doc, const char *show_doc,
@@ -506,19 +505,16 @@ add_setshow_string_cmd (char *name, enum command_class class,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- struct cmd_list_element *cmd;
add_setshow_cmd_full (name, class, var_string, var,
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list,
- &cmd, NULL);
- return cmd;
+ NULL, NULL);
}
/* Add element named NAME to both the set and show command LISTs (the
- list for set/show or some sublist thereof). Return the new "set"
- command. */
-struct cmd_list_element *
+ list for set/show or some sublist thereof). */
+void
add_setshow_string_noescape_cmd (char *name, enum command_class class,
char **var,
const char *set_doc, const char *show_doc,
@@ -528,13 +524,11 @@ add_setshow_string_noescape_cmd (char *name, enum command_class class,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- struct cmd_list_element *cmd;
add_setshow_cmd_full (name, class, var_string_noescape, var,
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list,
- &cmd, NULL);
- return cmd;
+ NULL, NULL);
}
/* Add element named NAME to both the set and show command LISTs (the
@@ -564,9 +558,8 @@ add_setshow_optional_filename_cmd (char *name, enum command_class class,
/* Add element named NAME to both the set and show command LISTs (the
list for set/show or some sublist thereof). CLASS is as in
add_cmd. VAR is address of the variable which will contain the
- value. SET_DOC and SHOW_DOC are the documentation strings. Return
- the new "set" command. */
-struct cmd_list_element *
+ value. SET_DOC and SHOW_DOC are the documentation strings. */
+void
add_setshow_integer_cmd (char *name, enum command_class class,
int *var,
const char *set_doc, const char *show_doc,
@@ -576,21 +569,18 @@ add_setshow_integer_cmd (char *name, enum command_class class,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- struct cmd_list_element *cmd;
add_setshow_cmd_full (name, class, var_integer, var,
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list,
- &cmd, NULL);
- return cmd;
+ NULL, NULL);
}
/* Add element named NAME to both the set and show command LISTs (the
list for set/show or some sublist thereof). CLASS is as in
add_cmd. VAR is address of the variable which will contain the
- value. SET_DOC and SHOW_DOC are the documentation strings. Return
- the new "set" command. */
-struct cmd_list_element *
+ value. SET_DOC and SHOW_DOC are the documentation strings. */
+void
add_setshow_uinteger_cmd (char *name, enum command_class class,
unsigned int *var,
const char *set_doc, const char *show_doc,
@@ -600,21 +590,18 @@ add_setshow_uinteger_cmd (char *name, enum command_class class,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- struct cmd_list_element *cmd;
add_setshow_cmd_full (name, class, var_uinteger, var,
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list,
- &cmd, NULL);
- return cmd;
+ NULL, NULL);
}
/* Add element named NAME to both the set and show command LISTs (the
list for set/show or some sublist thereof). CLASS is as in
add_cmd. VAR is address of the variable which will contain the
- value. SET_DOC and SHOW_DOC are the documentation strings. Return
- the new "set" command. */
-struct cmd_list_element *
+ value. SET_DOC and SHOW_DOC are the documentation strings. */
+void
add_setshow_zinteger_cmd (char *name, enum command_class class,
int *var,
const char *set_doc, const char *show_doc,
@@ -624,21 +611,18 @@ add_setshow_zinteger_cmd (char *name, enum command_class class,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- struct cmd_list_element *cmd;
add_setshow_cmd_full (name, class, var_zinteger, var,
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list,
- &cmd, NULL);
- return cmd;
+ NULL, NULL);
}
/* Add element named NAME to both the set and show command LISTs (the
list for set/show or some sublist thereof). CLASS is as in
add_cmd. VAR is address of the variable which will contain the
- value. SET_DOC and SHOW_DOC are the documentation strings. Return
- the new "set" command. */
-struct cmd_list_element *
+ value. SET_DOC and SHOW_DOC are the documentation strings. */
+void
add_setshow_zuinteger_cmd (char *name, enum command_class class,
unsigned int *var,
const char *set_doc, const char *show_doc,
@@ -648,13 +632,11 @@ add_setshow_zuinteger_cmd (char *name, enum command_class class,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- struct cmd_list_element *cmd;
add_setshow_cmd_full (name, class, var_zuinteger, var,
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list,
- &cmd, NULL);
- return cmd;
+ NULL, NULL);
}
/* Remove the command named NAME from the command list. Return the
diff --git a/gdb/command.h b/gdb/command.h
index 4f12592..1a6bec4 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -260,29 +260,27 @@ extern void add_setshow_filename_cmd (char *name,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list);
-extern struct cmd_list_element *
- add_setshow_string_cmd (char *name,
- enum command_class class,
- char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern struct cmd_list_element *
- add_setshow_string_noescape_cmd (char *name,
- enum command_class class,
- char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
+extern void add_setshow_string_cmd (char *name,
+ enum command_class class,
+ char **var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
+
+extern void add_setshow_string_noescape_cmd (char *name,
+ enum command_class class,
+ char **var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
extern void add_setshow_optional_filename_cmd (char *name,
enum command_class class,
@@ -295,53 +293,49 @@ extern void add_setshow_optional_filename_cmd (char *name,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list);
-extern struct cmd_list_element *
- add_setshow_integer_cmd (char *name,
- enum command_class class,
- int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
+extern void add_setshow_integer_cmd (char *name,
+ enum command_class class,
+ int *var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
-extern struct cmd_list_element *
- add_setshow_uinteger_cmd (char *name,
- enum command_class class,
- unsigned int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
+extern void add_setshow_uinteger_cmd (char *name,
+ enum command_class class,
+ unsigned int *var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
-extern struct cmd_list_element *
- add_setshow_zinteger_cmd (char *name,
- enum command_class class,
- int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
+extern void add_setshow_zinteger_cmd (char *name,
+ enum command_class class,
+ int *var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
-extern struct cmd_list_element *
- add_setshow_zuinteger_cmd (char *name,
- enum command_class class,
- unsigned int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
+extern void add_setshow_zuinteger_cmd (char *name,
+ enum command_class class,
+ unsigned int *var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
/* Do a "show" command for each thing on a command list. */
diff --git a/gdb/language.c b/gdb/language.c
index 04c2fe4..62eeb62 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -150,21 +150,11 @@ show_language_command (struct ui_file *file, int from_tty,
static void
set_language_command (char *ignore, int from_tty, struct cmd_list_element *c)
{
- int i, len;
+ int i;
enum language flang;
- char *err_lang, *tem;
-
- /* Strip trailing whitespace. */
- if (!language)
- len = 0;
- else
- {
- len = strlen (language);
- while (len > 0 && language[len - 1] == ' ')
- --len;
- }
+ char *err_lang;
- if (len == 0)
+ if (!language || !language[0])
{
printf_unfiltered (_("\
The currently understood settings are:\n\n\
@@ -191,11 +181,6 @@ local or auto Automatic setting based on source file\n"));
return;
}
- /* Reset LANGUAGE to avoid trailing spaces. */
- tem = savestring (language, len);
- xfree (language);
- language = tem;
-
/* Search the list of languages for a match. */
for (i = 0; i < languages_size; i++)
{
@@ -236,20 +221,6 @@ local or auto Automatic setting based on source file\n"));
error (_("Unknown language `%s'."), err_lang);
}
-static char **
-language_completer (struct cmd_list_element *self, char *text, char *word)
-{
- int i;
- const char **langnames
- = (const char **) alloca ((languages_size + 1) * sizeof (const char *));
-
- for (i = 0; i < languages_size; ++i)
- langnames[i] = languages[i]->la_name;
- langnames[i] = NULL;
-
- return complete_on_enum (langnames, text, word);
-}
-
/* Show command. Display a warning if the type setting does
not match the current language. */
static void
@@ -266,18 +237,6 @@ show_type_command (struct ui_file *file, int from_tty,
static void
set_type_command (char *ignore, int from_tty, struct cmd_list_element *c)
{
- int len;
- char *tem;
-
- /* Strip trailing whitespace. */
- len = strlen (type);
- while (len > 0 && type[len - 1] == ' ')
- --len;
- /* Reset TYPE. */
- tem = savestring (type, len);
- xfree (type);
- type = tem;
-
if (strcmp (type, "on") == 0)
{
type_check = type_check_on;
@@ -325,18 +284,6 @@ show_range_command (struct ui_file *file, int from_tty,
static void
set_range_command (char *ignore, int from_tty, struct cmd_list_element *c)
{
- int len;
- char *tem;
-
- /* Strip trailing whitespace. */
- len = strlen (range);
- while (len > 0 && range[len - 1] == ' ')
- --len;
- /* Reset RANGE. */
- tem = savestring (range, len);
- xfree (range);
- range = tem;
-
if (strcmp (range, "on") == 0)
{
range_check = range_check_on;
@@ -368,14 +315,6 @@ set_range_command (char *ignore, int from_tty, struct cmd_list_element *c)
show_range_command (NULL, from_tty, NULL, NULL);
}
-/* Completer for range and type parameters. */
-static char **
-range_or_type_completer (struct cmd_list_element *self, char *text, char *word)
-{
- static const char *values[] = { "on", "off", "warn", "auto", NULL };
- return complete_on_enum (values, text, word);
-}
-
/* Show command. Display a warning if the case sensitivity setting does
not match the current language. */
static void
@@ -420,14 +359,6 @@ set_case_command (char *ignore, int from_tty, struct cmd_list_element *c)
show_case_command (NULL, from_tty, NULL, NULL);
}
-/* Completer for case-sensitive parameter. */
-static char **
-case_completer (struct cmd_list_element *self, char *text, char *word)
-{
- static const char *values[] = { "on", "off", "auto", NULL };
- return complete_on_enum (values, text, word);
-}
-
/* Set the status of range and type checking and case sensitivity based on
the current modes and the current language.
If SHOW is non-zero, then print out the current language,
@@ -1409,21 +1340,21 @@ language_lookup_primitive_type_by_name (const struct language_defn *la,
void
_initialize_language (void)
{
- struct cmd_list_element *command;
+ struct cmd_list_element *set, *show;
language_gdbarch_data
= gdbarch_data_register_post_init (language_gdbarch_post_init);
/* GDB commands for language specific stuff */
- command = add_setshow_string_noescape_cmd ("language", class_support,
- &language, _("\
+ /* FIXME: cagney/2005-02-20: This should be implemented using an
+ enum. */
+ add_setshow_string_noescape_cmd ("language", class_support, &language, _("\
Set the current source language."), _("\
Show the current source language."), NULL,
- set_language_command,
- show_language_command,
- &setlist, &showlist);
- set_cmd_completer (command, language_completer);
+ set_language_command,
+ show_language_command,
+ &setlist, &showlist);
add_prefix_cmd ("check", no_class, set_check,
_("Set the status of the type/range checker."),
@@ -1437,36 +1368,34 @@ Show the current source language."), NULL,
add_alias_cmd ("c", "check", no_class, 1, &showlist);
add_alias_cmd ("ch", "check", no_class, 1, &showlist);
- command =
- add_setshow_string_noescape_cmd ("type", class_support,
- &type, _("\
+ /* FIXME: cagney/2005-02-20: This should be implemented using an
+ enum. */
+ add_setshow_string_noescape_cmd ("type", class_support, &type, _("\
Set type checking. (on/warn/off/auto)"), _("\
Show type checking. (on/warn/off/auto)"), NULL,
- set_type_command,
- show_type_command,
- &setchecklist, &showchecklist);
- set_cmd_completer (command, range_or_type_completer);
-
- command =
- add_setshow_string_noescape_cmd ("range", class_support,
- &range, _("\
+ set_type_command,
+ show_type_command,
+ &setchecklist, &showchecklist);
+
+ /* FIXME: cagney/2005-02-20: This should be implemented using an
+ enum. */
+ add_setshow_string_noescape_cmd ("range", class_support, &range, _("\
Set range checking. (on/warn/off/auto)"), _("\
Show range checking. (on/warn/off/auto)"), NULL,
- set_range_command,
- show_range_command,
- &setchecklist, &showchecklist);
- set_cmd_completer (command, range_or_type_completer);
-
- command =
- add_setshow_string_noescape_cmd ("case-sensitive", class_support,
- &case_sensitive, _("\
+ set_range_command,
+ show_range_command,
+ &setchecklist, &showchecklist);
+
+ /* FIXME: cagney/2005-02-20: This should be implemented using an
+ enum. */
+ add_setshow_string_noescape_cmd ("case-sensitive", class_support,
+ &case_sensitive, _("\
Set case sensitivity in name search. (on/off/auto)"), _("\
Show case sensitivity in name search. (on/off/auto)"), _("\
For Fortran the default is off; for other languages the default is on."),
- set_case_command,
- show_case_command,
- &setlist, &showlist);
- set_cmd_completer (command, case_completer);
+ set_case_command,
+ show_case_command,
+ &setlist, &showlist);
add_language (&unknown_language_defn);
add_language (&local_language_defn);