Merge branch 'master' into merge-job
[deliverable/binutils-gdb.git] / gdb / cli / cli-cmds.c
index be59721c2702cd10700fa05c493412cd3f4b5663..e1204f74ef1aea3840f4c94007cdcaa158551fb8 100644 (file)
@@ -1,7 +1,7 @@
 /* GDB CLI commands.
 
-   Copyright (C) 2000-2019 Free Software Foundation, Inc.
-   Copyright (C) 2019 Advanced Micro Devices, Inc. All rights reserved.
+   Copyright (C) 2000-2020 Free Software Foundation, Inc.
+   Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
 
    This file is part of GDB.
 
@@ -801,6 +801,18 @@ exit_status_set_internal_vars (int exit_status)
   clear_internalvar (var_signal);
   if (WIFEXITED (exit_status))
     set_internalvar_integer (var_code, WEXITSTATUS (exit_status));
+#ifdef __MINGW32__
+  else if (WIFSIGNALED (exit_status) && WTERMSIG (exit_status) == -1)
+    {
+      /* The -1 condition can happen on MinGW, if we don't recognize
+        the fatal exception code encoded in the exit status; see
+        gdbsupport/gdb_wait.c.  We don't want to lose information in
+        the exit status in that case.  Record it as a normal exit
+        with the full exit status, including the higher 0xC0000000
+        bits.  */
+      set_internalvar_integer (var_code, exit_status);
+    }
+#endif
   else if (WIFSIGNALED (exit_status))
     set_internalvar_integer (var_signal, WTERMSIG (exit_status));
   else
This page took 0.025327 seconds and 4 git commands to generate.