- struct cmd_list_element *set, *show;
-
- set = add_set_cmd ("demangle-style", class_support, var_string_noescape,
- (char *) ¤t_demangling_style_string,
- "Set the current C++ demangling style.",
- &setlist);
- show = add_show_from_set (set, &showlist);
- set -> function.cfunc = set_demangling_command;
- show -> function.cfunc = show_demangling_command;
-
- /* Set the default demangling style chosen at compilation time. */
- set_demangling_style (DEMANGLING_STYLE);
+ struct cmd_list_element *set, *show;
+ int i, ndems;
+
+ /* Fill the demangling_style_names[] array. */
+ for (ndems = 0;
+ libiberty_demanglers[ndems].demangling_style != unknown_demangling;
+ ndems++)
+ ;
+ demangling_style_names = xcalloc (ndems + 1, sizeof (char *));
+ for (i = 0;
+ libiberty_demanglers[i].demangling_style != unknown_demangling;
+ i++)
+ demangling_style_names[i] =
+ xstrdup (libiberty_demanglers[i].demangling_style_name);
+
+ set = add_set_enum_cmd ("demangle-style", class_support,
+ demangling_style_names,
+ (const char **) ¤t_demangling_style_string,
+ "Set the current C++ demangling style.\n\
+Use `set demangle-style' without arguments for a list of demangling styles.",
+ &setlist);
+ show = add_show_from_set (set, &showlist);
+ set_cmd_sfunc (set, set_demangling_command);
+
+ /* Set the default demangling style chosen at compilation time. */
+ set_demangling_style (DEFAULT_DEMANGLING_STYLE);