endian_auto,
NULL,
};
-static const char *set_endian_string;
+static const char *set_endian_string = endian_auto;
enum bfd_endian
selected_byte_order (void)
list of architectures. */
{
/* Append ``auto''. */
- arches.push_back ("auto");
+ set_architecture_string = "auto";
+ arches.push_back (set_architecture_string);
arches.push_back (nullptr);
set_show_commands architecture_cmds
= add_setshow_enum_cmd ("architecture", class_support,
size_t offset = strlen ("reg-names-");
const char *style = disasm_options->name[i];
valid_disassembly_styles[j++] = &style[offset];
+ if (strcmp (&style[offset], "std") == 0)
+ disassembly_style = &style[offset];
length = snprintf (rdptr, rest, "%s - %s\n", &style[offset],
disasm_options->description[i]);
rdptr += length;
#endif
#endif
+ /* Recall that the first element is always "auto". */
+ host_charset_name = charset_enum[0];
+ gdb_assert (strcmp (host_charset_name, "auto") == 0);
add_setshow_enum_cmd ("charset", class_support,
charset_enum, &host_charset_name, _("\
Set the host and target character sets."), _("\
show_host_charset_name,
&setlist, &showlist);
+ /* Recall that the first element is always "auto". */
+ target_charset_name = charset_enum[0];
+ gdb_assert (strcmp (target_charset_name, "auto") == 0);
add_setshow_enum_cmd ("target-charset", class_support,
charset_enum, &target_charset_name, _("\
Set the target character set."), _("\
show_target_charset_name,
&setlist, &showlist);
+ /* Recall that the first element is always "auto". */
+ target_wide_charset_name = charset_enum[0];
+ gdb_assert (strcmp (target_wide_charset_name, "auto") == 0);
add_setshow_enum_cmd ("target-wide-charset", class_support,
charset_enum, &target_wide_charset_name,
_("\
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
+ /* We require *VAR to be initialized before this call, and
+ furthermore it must be == to one of the values in ENUMLIST. */
+ gdb_assert (var != nullptr && *var != nullptr);
+ for (int i = 0; ; ++i)
+ {
+ gdb_assert (enumlist[i] != nullptr);
+ if (*var == enumlist[i])
+ break;
+ }
+
set_show_commands commands
= add_setshow_cmd_full<const char *> (name, theclass, var_enum, var,
set_doc, show_doc, help_doc,
break;
case var_enum:
+ /* Initialize the value, just in case. */
+ make_setting (self).set<const char *> (self->enumeration[0]);
commands = add_setshow_enum_cmd (cmd_name, cmd_class, self->enumeration,
&self->value.cstringval, set_doc,
show_doc, help_doc, set_func, show_func,
set_list, show_list);
- /* Initialize the value, just in case. */
- make_setting (self).set<const char *> (self->enumeration[0]);
break;
default:
/* Display "auto", "local" and "unknown" first, and then the rest,
alpha sorted. */
const char **language_names_p = language_names;
- *language_names_p++ = language_def (language_auto)->name ();
+ language = language_def (language_auto)->name ();
+ *language_names_p++ = language;
*language_names_p++ = "local";
*language_names_p++ = language_def (language_unknown)->name ();
const char **sort_begin = language_names_p;
add_alias_cmd ("c", setshow_check_cmds.show, no_class, 1, &showlist);
add_alias_cmd ("ch", setshow_check_cmds.show, no_class, 1, &showlist);
+ range = type_or_range_names[3];
+ gdb_assert (strcmp (range, "auto") == 0);
add_setshow_enum_cmd ("range", class_support, type_or_range_names,
&range,
_("Set range checking (on/warn/off/auto)."),
show_range_command,
&setchecklist, &showchecklist);
+ case_sensitive = case_sensitive_names[2];
+ gdb_assert (strcmp (case_sensitive, "auto") == 0);
add_setshow_enum_cmd ("case-sensitive", class_support, case_sensitive_names,
&case_sensitive, _("\
Set case sensitivity in name search (on/off/auto)."), _("\
add_set_language_command ();
- language = "auto";
- range = "auto";
- case_sensitive = "auto";
-
/* Have the above take effect. */
set_language (language_auto);
}
generic_elf_osabi_sniffer);
/* Register the "set osabi" command. */
+ user_osabi_state = osabi_auto;
+ set_osabi_string = gdb_osabi_available_names[0];
+ gdb_assert (strcmp (set_osabi_string, "auto") == 0);
add_setshow_enum_cmd ("osabi", class_support, gdb_osabi_available_names,
&set_osabi_string,
_("Set OS ABI of target."),
_("Show OS ABI of target."),
NULL, set_osabi, show_osabi,
&setlist, &showlist);
- user_osabi_state = osabi_auto;
}
break;
case var_enum:
+ /* Initialize the value, just in case. */
+ self->value.cstringval = self->enumeration[0];
commands = add_setshow_enum_cmd (cmd_name.get (), cmdclass,
self->enumeration,
&self->value.cstringval, set_doc,
show_doc, help_doc, get_set_value,
get_show_value, set_list, show_list);
- /* Initialize the value, just in case. */
- self->value.cstringval = self->enumeration[0];
break;
default:
test_deprecated_api_parameter
test_integer_parameter
test_throwing_parameter
+
+# This caused a gdb crash.
+gdb_test "python print(gdb.parameter('endian'))" "auto" \
+ "print endian parameter"