Replace hardwired error handler in captured_main
authorGary Benson <gbenson@redhat.com>
Mon, 4 Aug 2014 13:08:46 +0000 (14:08 +0100)
committerGary Benson <gbenson@redhat.com>
Fri, 29 Aug 2014 09:12:02 +0000 (10:12 +0100)
If the requested interpreter cannot be set captured_main reports the
error with a hardwired fprintf/exit pair.  A fprintf/exit pair on the
previous line was replaced with a call to error in March 2003
(https://sourceware.org/ml/gdb-patches/2003-03/msg00444.html) but I
found no documentation as to why this particular hardwired handler
was left untouched.  I was also unable to come up with a situation
where error would not be suitable, so I have replaced it with a call
to error.

gdb/ChangeLog:

* main.c (captured_main): Replace a fprintf/exit
pair with a call to error.  Wrap the message with _().

gdb/ChangeLog
gdb/main.c

index 809afe5..8898962 100644 (file)
@@ -1,5 +1,10 @@
 2014-08-29  Gary Benson  <gbenson@redhat.com>
 
+       * main.c (captured_main): Replace a fprintf/exit
+       pair with a call to error.  Wrap the message with _().
+
+2014-08-29  Gary Benson  <gbenson@redhat.com>
+
        * tui/tui-io.c (tui_initialize_io): Replace two fprintf/exit
        pairs with calls to error.  Wrap the message with _().
 
index ed2187a..415b900 100644 (file)
@@ -984,12 +984,7 @@ captured_main (void *data)
       error (_("Interpreter `%s' unrecognized"), interpreter_p);
     /* Install it.  */
     if (!interp_set (interp, 1))
-      {
-        fprintf_unfiltered (gdb_stderr,
-                           "Interpreter `%s' failed to initialize.\n",
-                            interpreter_p);
-        exit (1);
-      }
+      error (_("Interpreter `%s' failed to initialize."), interpreter_p);
   }
 
   /* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets