Overload catch_command_errors
authorTom Tromey <tom@tromey.com>
Tue, 12 Sep 2017 20:14:33 +0000 (14:14 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 20 Sep 2017 22:04:11 +0000 (16:04 -0600)
This changes catch_command_errors_const to be an overload of
catch_command_errors, which may mildly help future constification
efforts.

Tested by rebuilding.

gdb/ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

* main.c (catch_command_errors): Rename from
catch_command_errors_const.
(captured_main_1): Update.

gdb/ChangeLog
gdb/main.c

index 8db2f6e4ce0b82aa9245e576f79acdf83d5cf05a..4140f559bc407ab532810e9976f881bf785a7207 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-20  Tom Tromey  <tom@tromey.com>
+
+       * main.c (catch_command_errors): Rename from
+       catch_command_errors_const.
+       (captured_main_1): Update.
+
 2017-09-20  Pedro Alves  <palves@redhat.com>
 
        * cli/cli-cmds.c (list_command): Use print_sal_location.
index a0646edad6024f505532db43577684b1bff49498..fe80511243bb5bbdcd10af6896d9573c4ec504b8 100644 (file)
@@ -340,8 +340,7 @@ captured_command_loop (void *data)
   return 1;
 }
 
-/* Handle command errors thrown from within
-   catch_command_errors/catch_command_errors_const.  */
+/* Handle command errors thrown from within catch_command_errors.  */
 
 static int
 handle_command_errors (struct gdb_exception e)
@@ -386,15 +385,16 @@ catch_command_errors (catch_command_errors_ftype *command,
   return 1;
 }
 
-/* Type of the command callback passed to catch_command_errors_const.  */
+/* Type of the command callback passed to the const
+   catch_command_errors.  */
 
 typedef void (catch_command_errors_const_ftype) (const char *, int);
 
-/* Like catch_command_errors, but works with const command and args.  */
+/* Const-correct catch_command_errors.  */
 
 static int
-catch_command_errors_const (catch_command_errors_const_ftype *command,
-                           const char *arg, int from_tty)
+catch_command_errors (catch_command_errors_const_ftype command,
+                     const char *arg, int from_tty)
 {
   TRY
     {
@@ -982,7 +982,7 @@ captured_main_1 (struct captured_main_args *context)
      processed; it sets global parameters, which are independent of
      what file you are debugging or what directory you are in.  */
   if (system_gdbinit && !inhibit_gdbinit)
-    catch_command_errors_const (source_script, system_gdbinit, 0);
+    catch_command_errors (source_script, system_gdbinit, 0);
 
   /* Read and execute $HOME/.gdbinit file, if it exists.  This is done
      *before* all the command line arguments are processed; it sets
@@ -990,7 +990,7 @@ captured_main_1 (struct captured_main_args *context)
      debugging or what directory you are in.  */
 
   if (home_gdbinit && !inhibit_gdbinit && !inhibit_home_gdbinit)
-    catch_command_errors_const (source_script, home_gdbinit, 0);
+    catch_command_errors (source_script, home_gdbinit, 0);
 
   /* Process '-ix' and '-iex' options early.  */
   for (i = 0; i < cmdarg_vec.size (); i++)
@@ -1000,8 +1000,8 @@ captured_main_1 (struct captured_main_args *context)
       switch (cmdarg_p.type)
        {
        case CMDARG_INIT_FILE:
-         catch_command_errors_const (source_script, cmdarg_p.string,
-                                     !batch_flag);
+         catch_command_errors (source_script, cmdarg_p.string,
+                               !batch_flag);
          break;
        case CMDARG_INIT_COMMAND:
          catch_command_errors (execute_command, cmdarg_p.string,
@@ -1032,19 +1032,19 @@ captured_main_1 (struct captured_main_args *context)
       /* The exec file and the symbol-file are the same.  If we can't
          open it, better only print one error message.
          catch_command_errors returns non-zero on success!  */
-      if (catch_command_errors_const (exec_file_attach, execarg,
-                                     !batch_flag))
-       catch_command_errors_const (symbol_file_add_main_adapter, symarg,
-                                   !batch_flag);
+      if (catch_command_errors (exec_file_attach, execarg,
+                               !batch_flag))
+       catch_command_errors (symbol_file_add_main_adapter, symarg,
+                             !batch_flag);
     }
   else
     {
       if (execarg != NULL)
-       catch_command_errors_const (exec_file_attach, execarg,
-                                   !batch_flag);
+       catch_command_errors (exec_file_attach, execarg,
+                             !batch_flag);
       if (symarg != NULL)
-       catch_command_errors_const (symbol_file_add_main_adapter, symarg,
-                                   !batch_flag);
+       catch_command_errors (symbol_file_add_main_adapter, symarg,
+                             !batch_flag);
     }
 
   if (corearg && pidarg)
@@ -1094,7 +1094,7 @@ captured_main_1 (struct captured_main_args *context)
        {
          auto_load_local_gdbinit_loaded = 1;
 
-         catch_command_errors_const (source_script, local_gdbinit, 0);
+         catch_command_errors (source_script, local_gdbinit, 0);
        }
     }
 
@@ -1114,8 +1114,8 @@ captured_main_1 (struct captured_main_args *context)
       switch (cmdarg_p.type)
        {
        case CMDARG_FILE:
-         catch_command_errors_const (source_script, cmdarg_p.string,
-                                     !batch_flag);
+         catch_command_errors (source_script, cmdarg_p.string,
+                               !batch_flag);
          break;
        case CMDARG_COMMAND:
          catch_command_errors (execute_command, cmdarg_p.string,
This page took 0.033038 seconds and 4 git commands to generate.