aboutsummaryrefslogtreecommitdiff
path: root/gdb/demangle.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2001-02-19 11:47:16 +0000
committerEli Zaretskii <eliz@gnu.org>2001-02-19 11:47:16 +0000
commitfa58ee119617c4302d6bf94ff751c3ee8e1062cd (patch)
treefa0ec2445538b681e9d27d997818528437e631a0 /gdb/demangle.c
parentfb33b906916095eb3e0497bccbbb8017f9e4a4eb (diff)
downloadgdb-fa58ee119617c4302d6bf94ff751c3ee8e1062cd.zip
gdb-fa58ee119617c4302d6bf94ff751c3ee8e1062cd.tar.gz
gdb-fa58ee119617c4302d6bf94ff751c3ee8e1062cd.tar.bz2
* demangle.c (demangling_style_names): New variable.
(_initialize_demangler): Fill demangling_style_names with the names of known demangling styles from libiberty_demanglers[]. Use add_set_enum_cmd instead of add_set_cmd, to get completion on demangling style names. * proc-api.c (_initialize_proc_api): Make `procfs-file' use file-name completion. * remote-rdi.c (_initialize_remote_rdi): Ditto for `rdilogfile'. * solib.c (_initialize_solib): Ditto for `solib-search-path' and `solib-absolute-prefix'. * tracepoint.c (_initialize_tracepoint): Ditto for `save-tracepoints'. * win32-nat.c (_initialize_inftarg): Ditto for `dll-symbols'. * cli/cli-cmds.c (init_cli_cmds): Make `shell' and `make' use file-name completion. * infcmd.c (_initialize_infcmd): Make the following commands use the file-name completer: `tty', `args', `path', `paths', and `run'.
Diffstat (limited to 'gdb/demangle.c')
-rw-r--r--gdb/demangle.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/gdb/demangle.c b/gdb/demangle.c
index 2c59dec..20758be 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -49,6 +49,11 @@ extern void _initialize_demangler (void);
static char *current_demangling_style_string;
+/* The array of names of the known demanglyng styles. Generated by
+ _initialize_demangler from libiberty_demanglers[] array. */
+
+static const char **demangling_style_names;
+
static void set_demangling_command (char *, int, struct cmd_list_element *);
/* Set current demangling style. Called by the "set demangle-style"
@@ -173,12 +178,26 @@ void
_initialize_demangler (void)
{
struct cmd_list_element *set, *show;
-
- set = add_set_cmd ("demangle-style", class_support, var_string_noescape,
- (char *) &current_demangling_style_string,
- "Set the current C++ demangling style.\n\
+ int i, ndems;
+
+ /* Fill the demangling_style_names[] array. */
+ for (ndems = 0;
+ libiberty_demanglers[ndems].demangling_style != unknown_demangling;
+ ndems++)
+ ;
+ demangling_style_names = xmalloc (ndems * 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 **) &current_demangling_style_string,
+ "Set the current C++ demangling style.\n\
Use `set demangle-style' without arguments for a list of demangling styles.",
- &setlist);
+ &setlist);
show = add_show_from_set (set, &showlist);
set->function.sfunc = set_demangling_command;