* scripttempl/elfppc.sc: Remove.
[deliverable/binutils-gdb.git] / gdb / top.c
index 4acf4db4ad62b8a940c5037c7a80b7abd632279c..0959d4151e71f1e662d156e74126d8b497ccf577 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -144,6 +144,10 @@ static void complete_command PARAMS ((char *, int));
 
 static void do_nothing PARAMS ((int));
 
+static void show_debug PARAMS ((char *, int));
+
+static void set_debug PARAMS ((char *, int));
+
 #ifdef SIGHUP
 /* NOTE 1999-04-29: This function will be static again, once we modify
    gdb to use the event loop as the default command loop and we merge
@@ -255,6 +259,10 @@ struct cmd_list_element *setprintlist;
 
 struct cmd_list_element *showprintlist;
 
+struct cmd_list_element *setdebuglist;
+
+struct cmd_list_element *showdebuglist;
+
 struct cmd_list_element *setchecklist;
 
 struct cmd_list_element *showchecklist;
@@ -469,7 +477,7 @@ void (*call_command_hook) PARAMS ((struct cmd_list_element * c, char *cmd,
 /* Called after a `set' command has finished.  Is only run if the
    `set' command succeeded.  */
 
-void (*set_hook) PARAMS ((struct cmd_list_element *c));
+void (*set_hook) (struct cmd_list_element * c);
 
 /* Called when the current thread changes.  Argument is thread id.  */
 
@@ -478,8 +486,7 @@ void (*context_hook) PARAMS ((int id));
 /* Takes control from error ().  Typically used to prevent longjmps out of the
    middle of the GUI.  Usually used in conjunction with a catch routine.  */
 
-NORETURN void (*error_hook)
-PARAMS ((void)) ATTR_NORETURN;
+NORETURN void (*error_hook) (void) ATTR_NORETURN;
 \f
 
 /* One should use catch_errors rather than manipulating these
@@ -532,7 +539,7 @@ return_to_top_level (reason)
      to that call via setjmp's return value.  Note that REASON can't
      be zero, by definition in defs.h. */
 
-  (NORETURN void) SIGLONGJMP (*catch_return, (int)reason);
+  (NORETURN void) SIGLONGJMP (*catch_return, (int) reason);
 }
 
 /* Call FUNC with arg ARGS, catching any errors.  If there is no
@@ -682,7 +689,7 @@ do_captured_command (void *data)
 }
 
 int
-catch_command_errors (catch_command_errors_ftype *command,
+catch_command_errors (catch_command_errors_ftype * command,
                      char *arg, int from_tty, return_mask mask)
 {
   struct captured_command_args args;
@@ -1474,6 +1481,7 @@ execute_command (p, from_tty)
   register struct cmd_list_element *c;
   register enum language flang;
   static int warned = 0;
+  char *line;
   /* FIXME: These should really be in an appropriate header file */
   extern void serial_log_command PARAMS ((const char *));
 
@@ -1494,6 +1502,7 @@ execute_command (p, from_tty)
   if (*p)
     {
       char *arg;
+      line = p;
 
       c = lookup_cmd (&p, cmdlist, "", 0, 1);
 
@@ -1522,6 +1531,9 @@ execute_command (p, from_tty)
       if (c->hook)
        execute_user_command (c->hook, (char *) 0);
 
+      if (c->flags & DEPRECATED_WARN_USER)
+       deprecated_cmd_warning (&line);
+
       if (c->class == class_user)
        execute_user_command (c, arg);
       else if (c->type == set_cmd || c->type == show_cmd)
@@ -1821,6 +1833,12 @@ char *gdb_completer_word_break_characters =
 char *gdb_completer_command_word_break_characters =
 " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,";
 
+/* When completing on file names, we remove from the list of word
+   break characters any characters that are commonly used in file
+   names, such as '-', '+', '~', etc.  Otherwise, readline displays
+   incorrect completion candidates.  */
+char *gdb_completer_file_name_break_characters = " \t\n*|\"';:?/><";
+
 /* Characters that can be used to quote completion strings.  Note that we
    can't include '"' because the gdb C parser treats such quoted sequences
    as strings. */
@@ -1875,6 +1893,11 @@ filename_completer (text, word)
          return_val[return_val_used++] = p;
          break;
        }
+      /* We need to set subsequent_name to a non-zero value before the
+        continue line below, because otherwise, if the first file seen
+        by GDB is a backup file whose name ends in a `~', we will loop
+        indefinitely.  */
+      subsequent_name = 1;
       /* Like emacs, don't complete on old versions.  Especially useful
          in the "source" command.  */
       if (p[strlen (p) - 1] == '~')
@@ -1904,7 +1927,6 @@ filename_completer (text, word)
            free (p);
          }
       }
-      subsequent_name = 1;
     }
 #if 0
   /* There is no way to do this just long enough to affect quote inserting
@@ -2106,6 +2128,9 @@ line_completion_function (text, matches, line_buffer, point)
                      /* It is a normal command; what comes after it is
                         completed by the command's completer function.  */
                      list = (*c->completer) (p, word);
+                     if (c->completer == filename_completer)
+                       rl_completer_word_break_characters =
+                         gdb_completer_file_name_break_characters;
                    }
                }
              else
@@ -2152,6 +2177,9 @@ line_completion_function (text, matches, line_buffer, point)
                {
                  /* It is a normal command.  */
                  list = (*c->completer) (p, word);
+                 if (c->completer == filename_completer)
+                   rl_completer_word_break_characters =
+                     gdb_completer_file_name_break_characters;
                }
            }
        }
@@ -2892,24 +2920,24 @@ free_command_lines (lptr)
 \f
 /* Add an element to the list of info subcommands.  */
 
-void
+struct cmd_list_element *
 add_info (name, fun, doc)
      char *name;
      void (*fun) PARAMS ((char *, int));
      char *doc;
 {
-  add_cmd (name, no_class, fun, doc, &infolist);
+  return add_cmd (name, no_class, fun, doc, &infolist);
 }
 
 /* Add an alias to the list of info subcommands.  */
 
-void
+struct cmd_list_element *
 add_info_alias (name, oldname, abbrev_flag)
      char *name;
      char *oldname;
      int abbrev_flag;
 {
-  add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist);
+  return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist);
 }
 
 /* The "info" command is defined as a prefix, with allow_unknown = 0.
@@ -2965,26 +2993,26 @@ show_command (arg, from_tty)
 \f
 /* Add an element to the list of commands.  */
 
-void
+struct cmd_list_element *
 add_com (name, class, fun, doc)
      char *name;
      enum command_class class;
      void (*fun) PARAMS ((char *, int));
      char *doc;
 {
-  add_cmd (name, class, fun, doc, &cmdlist);
+  return add_cmd (name, class, fun, doc, &cmdlist);
 }
 
 /* Add an alias or abbreviation command to the list of commands.  */
 
-void
+struct cmd_list_element *
 add_com_alias (name, oldname, class, abbrev_flag)
      char *name;
      char *oldname;
      enum command_class class;
      int abbrev_flag;
 {
-  add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
+  return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
 }
 
 void
@@ -3168,7 +3196,7 @@ print_gdb_version (stream)
 
   /* Second line is a copyright notice. */
 
-  fprintf_filtered (stream, "Copyright 1998 Free Software Foundation, Inc.\n");
+  fprintf_filtered (stream, "Copyright 2000 Free Software Foundation, Inc.\n");
 
   /* Following the copyright is a brief statement that the program is
      free software, that users are free to copy and change it on
@@ -3632,13 +3660,13 @@ cd_command (dir, from_tty)
 #endif
 
   len = strlen (dir);
-  if (SLASH_P (dir[len-1]))
+  if (SLASH_P (dir[len - 1]))
     {
       /* Remove the trailing slash unless this is a root directory
-        (including a drive letter on non-Unix systems).  */
-      if (!(len == 1) /* "/" */
+         (including a drive letter on non-Unix systems).  */
+      if (!(len == 1)          /* "/" */
 #if defined(_WIN32) || defined(__MSDOS__)
-         && !(!SLASH_P (*dir) && ROOTED_P (dir) && len <= 3) /* "d:/" */
+         && !(!SLASH_P (*dir) && ROOTED_P (dir) && len <= 3)   /* "d:/" */
 #endif
          )
        len--;
@@ -3981,7 +4009,23 @@ float_handler (signo)
   signal (SIGFPE, float_handler);
   error ("Erroneous arithmetic operation.");
 }
-\f
+
+static void
+set_debug (arg, from_tty)
+     char *arg;
+     int from_tty;
+{
+  printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
+  help_list (setdebuglist, "set debug ", -1, gdb_stdout);
+}
+
+static void
+show_debug (args, from_tty)
+     char *args;
+     int from_tty;
+{
+  cmd_show_list (showdebuglist, from_tty, "");
+}
 
 static void
 init_cmd_lists ()
@@ -4037,8 +4081,8 @@ init_history ()
          directories the file written will be the same as the one
          that was read.  */
 #ifdef __MSDOS__
-    /* No leading dots in file names are allowed on MSDOS.  */
-    history_filename = concat (current_directory, "/_gdb_history", NULL);
+      /* No leading dots in file names are allowed on MSDOS.  */
+      history_filename = concat (current_directory, "/_gdb_history", NULL);
 #else
       history_filename = concat (current_directory, "/.gdb_history", NULL);
 #endif
@@ -4308,12 +4352,20 @@ This value is used to set the speed of the serial port when debugging\n\
 using remote targets.", &setlist),
                     &showlist);
 
-  add_show_from_set (
-  add_set_cmd ("remotedebug", no_class, var_zinteger, (char *) &remote_debug,
-              "Set debugging of remote protocol.\n\
+  c = add_set_cmd ("remotedebug", no_class, var_zinteger,
+                  (char *) &remote_debug,
+                  "Set debugging of remote protocol.\n\
 When enabled, each packet sent or received with the remote target\n\
-is displayed.", &setlist),
-                     &showlist);
+is displayed.", &setlist);
+  deprecate_cmd (c, "set debug remote");
+  deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote");
+
+  add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger,
+                                 (char *) &remote_debug,
+                                 "Set debugging of remote protocol.\n\
+When enabled, each packet sent or received with the remote target\n\
+is displayed.", &setdebuglist),
+                    &showdebuglist);
 
   add_show_from_set (
                      add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout,
@@ -4353,4 +4405,11 @@ from the target.", &setlist),
 Use \"on\" to enable the notification, and \"off\" to disable it.", &setlist),
         &showlist);
     }
+  add_prefix_cmd ("debug", no_class, set_debug,
+                 "Generic command for setting gdb debugging flags",
+                 &setdebuglist, "set debug ", 0, &setlist);
+
+  add_prefix_cmd ("debug", no_class, show_debug,
+                 "Generic command for showing gdb debugging flags",
+                 &showdebuglist, "show debug ", 0, &showlist);
 }
This page took 0.027574 seconds and 4 git commands to generate.