Normalize TRY_CATCH exception handling block
[binutils-gdb.git] / gdb / cli / cli-interp.c
index d708a36f113d906cc65d8c8e5ef84f229c39f4f3..106901887483d7b3aa9157ca498660a01b21092d 100644 (file)
@@ -179,17 +179,22 @@ cli_interpreter_exec (void *data, const char *command_str)
 static struct gdb_exception
 safe_execute_command (struct ui_out *command_uiout, char *command, int from_tty)
 {
-  volatile struct gdb_exception e;
+  volatile struct gdb_exception exception;
+  struct gdb_exception e = exception_none;
   struct ui_out *saved_uiout;
 
   /* Save and override the global ``struct ui_out'' builder.  */
   saved_uiout = current_uiout;
   current_uiout = command_uiout;
 
-  TRY_CATCH (e, RETURN_MASK_ALL)
+  TRY_CATCH (exception, RETURN_MASK_ALL)
     {
       execute_command (command, from_tty);
     }
+  if (exception.reason < 0)
+    {
+      e = exception;
+    }
 
   /* Restore the global builder.  */
   current_uiout = saved_uiout;