Don't complain about -fPIC for undefined symbol
[deliverable/binutils-gdb.git] / gdb / completer.c
index 67d7f458bc66d68ddbe69d61f2f5e36d8c89dbfa..2b6aa87e5b263ba38e326b857a13e382d2191698 100644 (file)
@@ -1,5 +1,5 @@
 /* Line completion stuff for GDB, the GNU debugger.
-   Copyright (C) 2000-2014 Free Software Foundation, Inc.
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "expression.h"
 #include "filenames.h"         /* For DOSish file names.  */
 #include "language.h"
-#include "exceptions.h"
 #include "gdb_signals.h"
+#include "target.h"
+#include "reggroups.h"
+#include "user-regs.h"
 
 #include "cli/cli-decode.h"
 
@@ -837,6 +839,45 @@ signal_completer (struct cmd_list_element *ignore,
   return return_val;
 }
 
+/* Complete on a register or reggroup.  */
+
+VEC (char_ptr) *
+reg_or_group_completer (struct cmd_list_element *ignore,
+                       const char *text, const char *word)
+{
+  VEC (char_ptr) *result = NULL;
+  size_t len = strlen (word);
+  struct gdbarch *gdbarch;
+  struct reggroup *group;
+  const char *name;
+  int i;
+
+  if (!target_has_registers)
+    return result;
+
+  gdbarch = get_frame_arch (get_selected_frame (NULL));
+
+  for (i = 0;
+       (name = user_reg_map_regnum_to_name (gdbarch, i)) != NULL;
+       i++)
+    {
+      if (*name != '\0' && strncmp (word, name, len) == 0)
+       VEC_safe_push (char_ptr, result, xstrdup (name));
+    }
+
+  for (group = reggroup_next (gdbarch, NULL);
+       group != NULL;
+       group = reggroup_next (gdbarch, group))
+    {
+      name = reggroup_name (group);
+      if (strncmp (word, name, len) == 0)
+       VEC_safe_push (char_ptr, result, xstrdup (name));
+    }
+
+  return result;
+}
+
+
 /* Get the list of chars that are considered as word breaks
    for the current command.  */
 
This page took 0.040601 seconds and 4 git commands to generate.