Index: trunk/src/VBox/VMM/VMMR3/SSM.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/SSM.cpp	(revision 49799)
+++ trunk/src/VBox/VMM/VMMR3/SSM.cpp	(revision 49800)
@@ -3559,15 +3559,15 @@
 
             case SSMFIELDTRANS_GCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3PutGCPtr(pSSM, *(PRTGCPTR)pbField);
                 break;
 
             case SSMFIELDTRANS_GCPHYS:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3PutGCPhys(pSSM, *(PRTGCPHYS)pbField);
                 break;
 
             case SSMFIELDTRANS_RCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3PutRCPtr(pSSM, *(PRTRCPTR)pbField);
                 break;
@@ -3576,5 +3576,6 @@
             {
                 uint32_t const cEntries = pCur->cb / sizeof(RTRCPTR);
-                AssertMsgReturn(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = VINF_SUCCESS;
                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
@@ -3584,8 +3585,12 @@
 
             default:
-                AssertMsgFailedReturn(("%#x\n", pCur->pfnGetPutOrTransformer), VERR_SSM_FIELD_COMPLEX);
+                AssertMsgFailedBreakStmt(("%#x\n", pCur->pfnGetPutOrTransformer), rc = VERR_SSM_FIELD_COMPLEX);
         }
         if (RT_FAILURE(rc))
+        {
+            if (RT_SUCCESS(pSSM->rc))
+                pSSM->rc = rc;
             return rc;
+        }
     }
 
@@ -3659,5 +3664,5 @@
     SSM_ASSERT_WRITEABLE_RET(pSSM);
     SSM_CHECK_CANCELLED_RET(pSSM);
-    AssertMsgReturn(!(fFlags & ~SSMSTRUCT_FLAGS_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!(fFlags & ~SSMSTRUCT_FLAGS_VALID_MASK), ("%#x\n", fFlags), pSSM->rc = VERR_INVALID_PARAMETER);
     AssertPtr(pvStruct);
     AssertPtr(paFields);
@@ -3677,4 +3682,5 @@
      * Put the fields
      */
+    rc = VINF_SUCCESS;
     uint32_t    off          = 0;
     for (PCSSMFIELD pCur = paFields;
@@ -3691,13 +3697,13 @@
                                 ? RT_HIWORD(pCur->cb)
                                 : pCur->cb;
-        AssertMsgReturn(   cbField            <= cbStruct
-                        && offField + cbField <= cbStruct
-                        && offField + cbField >= offField,
-                        ("off=%#x cb=%#x cbStruct=%#x (%s)\n", cbField, offField, cbStruct, pCur->pszName),
-                        VERR_SSM_FIELD_OUT_OF_BOUNDS);
-        AssertMsgReturn(    !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
-                        || off == offField,
-                        ("off=%#x offField=%#x (%s)\n", off, offField, pCur->pszName),
-                        VERR_SSM_FIELD_NOT_CONSECUTIVE);
+        AssertMsgBreakStmt(   cbField            <= cbStruct
+                           && offField + cbField <= cbStruct
+                           && offField + cbField >= offField,
+                           ("off=%#x cb=%#x cbStruct=%#x (%s)\n", cbField, offField, cbStruct, pCur->pszName),
+                           rc = VERR_SSM_FIELD_OUT_OF_BOUNDS);
+        AssertMsgBreakStmt(   !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
+                           || off == offField,
+                           ("off=%#x offField=%#x (%s)\n", off, offField, pCur->pszName),
+                           rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
 
         rc = VINF_SUCCESS;
@@ -3710,15 +3716,18 @@
 
             case SSMFIELDTRANS_GCPHYS:
-                AssertMsgReturn(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3PutGCPhys(pSSM, *(PRTGCPHYS)pbField);
                 break;
 
             case SSMFIELDTRANS_GCPTR:
-                AssertMsgReturn(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3PutGCPtr(pSSM, *(PRTGCPTR)pbField);
                 break;
 
             case SSMFIELDTRANS_RCPTR:
-                AssertMsgReturn(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3PutRCPtr(pSSM, *(PRTRCPTR)pbField);
                 break;
@@ -3727,5 +3736,6 @@
             {
                 uint32_t const cEntries = cbField / sizeof(RTRCPTR);
-                AssertMsgReturn(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
                     rc = SSMR3PutRCPtr(pSSM, ((PRTRCPTR)pbField)[i]);
@@ -3734,5 +3744,6 @@
 
             case SSMFIELDTRANS_HCPTR_NI:
-                AssertMsgReturn(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3PutHCPtrNI(pSSM, *(void * const *)pbField, fFlags);
                 break;
@@ -3741,5 +3752,6 @@
             {
                 uint32_t const cEntries = cbField / sizeof(void *);
-                AssertMsgReturn(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
                     rc = ssmR3PutHCPtrNI(pSSM, ((void * const *)pbField)[i], fFlags);
@@ -3748,13 +3760,14 @@
 
             case SSMFIELDTRANS_HCPTR_HACK_U32:
-                AssertMsgReturn(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
-                AssertMsgReturn(*(uintptr_t *)pbField <= UINT32_MAX, ("%p (%s)\n", *(uintptr_t *)pbField, pCur->pszName), VERR_SSM_FIELD_INVALID_VALUE);
+                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(*(uintptr_t *)pbField <= UINT32_MAX, ("%p (%s)\n", *(uintptr_t *)pbField, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_VALUE);
                 rc = ssmR3DataWrite(pSSM, pbField, sizeof(uint32_t));
-                if ((fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE) && sizeof(void *) != sizeof(uint32_t))
+                if ((fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE) && sizeof(void *) != sizeof(uint32_t) && RT_SUCCESS(rc))
                     rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(uint32_t));
                 break;
 
             case SSMFIELDTRANS_U32_ZX_U64:
-                AssertFailedReturn(VERR_SSM_FIELD_LOAD_ONLY_TRANSFORMATION);
+                AssertFailedBreakStmt(rc = VERR_SSM_FIELD_LOAD_ONLY_TRANSFORMATION);
                 break;
 
@@ -3765,5 +3778,5 @@
 
             case SSMFIELDTRANS_IGN_GCPHYS:
-                AssertMsgReturn(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(RTGCPHYS));
@@ -3771,5 +3784,5 @@
 
             case SSMFIELDTRANS_IGN_GCPTR:
-                AssertMsgReturn(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(RTGCPTR));
@@ -3777,5 +3790,5 @@
 
             case SSMFIELDTRANS_IGN_RCPTR:
-                AssertMsgReturn(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(RTRCPTR));
@@ -3783,5 +3796,5 @@
 
             case SSMFIELDTRANS_IGN_HCPTR:
-                AssertMsgReturn(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(void *));
@@ -3790,35 +3803,41 @@
 
             case SSMFIELDTRANS_OLD:
-                AssertMsgReturn(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3PutZeros(pSSM, pCur->cb);
                 break;
 
             case SSMFIELDTRANS_OLD_GCPHYS:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(RTGCPHYS));
                 break;
 
             case SSMFIELDTRANS_OLD_GCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(RTGCPTR));
                 break;
 
             case SSMFIELDTRANS_OLD_RCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(RTRCPTR));
                 break;
 
             case SSMFIELDTRANS_OLD_HCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3DataWrite(pSSM, g_abZero, sizeof(void *));
                 break;
 
             case SSMFIELDTRANS_OLD_PAD_HC:
-                AssertMsgReturn(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3PutZeros(pSSM, HC_ARCH_BITS == 64 ? RT_HIWORD(pCur->cb) : RT_LOWORD(pCur->cb));
                 break;
 
             case SSMFIELDTRANS_OLD_PAD_MSC32:
-                AssertMsgReturn(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName),
+                                   rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (SSM_HOST_IS_MSC_32)
                     rc = ssmR3PutZeros(pSSM, pCur->cb);
@@ -3842,16 +3861,16 @@
                                        && !ssmR3IsHostMsc32(pSSM))
                                  ? cb64 : cb32;
-                AssertMsgReturn(    cbField == cbCtx
-                                &&  (   (   pCur->off == UINT32_MAX / 2
-                                         && (   cbField == 0
-                                             || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
-                                             || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
-                                            )
+                AssertMsgBreakStmt(    cbField == cbCtx
+                                   &&  (   (   pCur->off == UINT32_MAX / 2
+                                            && (   cbField == 0
+                                                || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
+                                                || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
+                                               )
+                                           )
+                                        || (pCur->off != UINT32_MAX / 2 && cbField != 0)
                                         )
-                                     || (pCur->off != UINT32_MAX / 2 && cbField != 0)
-                                     )
-                                , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
-                                   cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
-                                VERR_SSM_FIELD_INVALID_PADDING_SIZE);
+                                   , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
+                                      cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
+                                   rc = VERR_SSM_FIELD_INVALID_PADDING_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = ssmR3PutZeros(pSSM, cbSaved);
@@ -3860,17 +3879,26 @@
 
             default:
-                AssertPtrReturn(pCur->pfnGetPutOrTransformer, VERR_SSM_FIELD_INVALID_CALLBACK);
+                AssertPtrBreakStmt(pCur->pfnGetPutOrTransformer, rc = VERR_SSM_FIELD_INVALID_CALLBACK);
                 rc = pCur->pfnGetPutOrTransformer(pSSM, pCur, (void *)pvStruct, fFlags, false /*fGetOrPut*/, pvUser);
                 break;
         }
         if (RT_FAILURE(rc))
-            return rc;
+            break; /* Deal with failures in one place (see below). */
 
         off = offField + cbField;
     }
-    AssertMsgReturn(    !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
-                    || off == cbStruct,
-                    ("off=%#x cbStruct=%#x\n", off, cbStruct),
-                    VERR_SSM_FIELD_NOT_CONSECUTIVE);
+
+    if (RT_SUCCESS(rc))
+        AssertMsgStmt(   !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
+                      || off == cbStruct,
+                      ("off=%#x cbStruct=%#x\n", off, cbStruct),
+                      rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
+
+    if (RT_FAILURE(rc))
+    {
+        if (RT_SUCCESS(pSSM->rc))
+            pSSM->rc = rc;
+        return rc;
+    }
 
     /*
@@ -5921,5 +5949,5 @@
                           && pSSM->u.Read.cbRecLeft <= RT_SIZEOFMEMB(SSMHANDLE, u.Read.abComprBuffer) + 2,
                           ("%#x\n", pSSM->u.Read.cbRecLeft),
-                          VERR_SSM_INTEGRITY_DECOMPRESSION);
+                          pSSM->rc = VERR_SSM_INTEGRITY_DECOMPRESSION);
 
     uint8_t cKB;
@@ -5933,5 +5961,5 @@
                           && cbDecompr <= RT_SIZEOFMEMB(SSMHANDLE, u.Read.abDataBuffer),
                           ("%#x\n", cbDecompr),
-                          VERR_SSM_INTEGRITY_DECOMPRESSION);
+                          pSSM->rc = VERR_SSM_INTEGRITY_DECOMPRESSION);
 
     *pcbDecompr = cbDecompr;
@@ -5981,5 +6009,5 @@
     if (RT_SUCCESS(rc))
     {
-        AssertLogRelMsgReturn(cbDstActual == cbDecompr, ("%#x %#x\n", cbDstActual, cbDecompr), VERR_SSM_INTEGRITY_DECOMPRESSION);
+        AssertLogRelMsgReturn(cbDstActual == cbDecompr, ("%#x %#x\n", cbDstActual, cbDecompr), pSSM->rc = VERR_SSM_INTEGRITY_DECOMPRESSION);
         return VINF_SUCCESS;
     }
@@ -6000,5 +6028,5 @@
 {
     *pcbZero = 0; /* shuts up gcc. */
-    AssertLogRelMsgReturn(pSSM->u.Read.cbRecLeft == 1, ("%#x\n", pSSM->u.Read.cbRecLeft), VERR_SSM_INTEGRITY_DECOMPRESSION);
+    AssertLogRelMsgReturn(pSSM->u.Read.cbRecLeft == 1, ("%#x\n", pSSM->u.Read.cbRecLeft), pSSM->rc = VERR_SSM_INTEGRITY_DECOMPRESSION);
 
     uint8_t cKB;
@@ -6010,5 +6038,5 @@
     uint32_t cbZero = (uint32_t)cKB * _1K;
     AssertLogRelMsgReturn(cbZero <= RT_SIZEOFMEMB(SSMHANDLE, u.Read.abDataBuffer),
-                          ("%#x\n", cbZero), VERR_SSM_INTEGRITY_DECOMPRESSION);
+                          ("%#x\n", cbZero), pSSM->rc = VERR_SSM_INTEGRITY_DECOMPRESSION);
 
     *pcbZero = cbZero;
@@ -6189,4 +6217,5 @@
  * Buffer miss, do an unbuffered read.
  *
+ * @returns VBox status code. Sets pSSM->rc on error.
  * @param   pSSM            The saved state handle.
  * @param   pvBuf           Where to store the read data.
@@ -6290,5 +6319,5 @@
 
             default:
-                AssertMsgFailedReturn(("%x\n", pSSM->u.Read.u8TypeAndFlags), VERR_SSM_BAD_REC_TYPE);
+                AssertMsgFailedReturn(("%x\n", pSSM->u.Read.u8TypeAndFlags), pSSM->rc = VERR_SSM_BAD_REC_TYPE);
         }
 
@@ -6393,5 +6422,5 @@
 
             default:
-                AssertMsgFailedReturn(("%x\n", pSSM->u.Read.u8TypeAndFlags), VERR_SSM_BAD_REC_TYPE);
+                AssertMsgFailedReturn(("%x\n", pSSM->u.Read.u8TypeAndFlags), pSSM->rc = VERR_SSM_BAD_REC_TYPE);
         }
         /*pSSM->u.Read.offDataBuffer = 0;*/
@@ -6478,5 +6507,5 @@
     if (RT_FAILURE(rc))
         return rc;
-    AssertMsgReturn(u32Magic == SSMR3STRUCT_BEGIN, ("u32Magic=%#RX32\n", u32Magic), VERR_SSM_STRUCTURE_MAGIC);
+    AssertMsgReturn(u32Magic == SSMR3STRUCT_BEGIN, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
 
     /* get the fields */
@@ -6493,15 +6522,15 @@
 
             case SSMFIELDTRANS_GCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
                 break;
 
             case SSMFIELDTRANS_GCPHYS:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
                 break;
 
             case SSMFIELDTRANS_RCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
                 break;
@@ -6510,5 +6539,5 @@
             {
                 uint32_t const cEntries = pCur->cb / sizeof(RTRCPTR);
-                AssertMsgReturn(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = VINF_SUCCESS;
                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
@@ -6518,8 +6547,12 @@
 
             default:
-                AssertMsgFailedReturn(("%#x\n", pCur->pfnGetPutOrTransformer), VERR_SSM_FIELD_COMPLEX);
+                AssertMsgFailedBreakStmt(("%#x\n", pCur->pfnGetPutOrTransformer), rc = VERR_SSM_FIELD_COMPLEX);
         }
         if (RT_FAILURE(rc))
+        {
+            if (RT_SUCCESS(pSSM->rc))
+                pSSM->rc = rc;
             return rc;
+        }
     }
 
@@ -6528,5 +6561,5 @@
     if (RT_FAILURE(rc))
         return rc;
-    AssertMsgReturn(u32Magic == SSMR3STRUCT_END, ("u32Magic=%#RX32\n", u32Magic), VERR_SSM_STRUCTURE_MAGIC);
+    AssertMsgReturn(u32Magic == SSMR3STRUCT_END, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
     return rc;
 }
@@ -6601,5 +6634,5 @@
     SSM_ASSERT_READABLE_RET(pSSM);
     SSM_CHECK_CANCELLED_RET(pSSM);
-    AssertMsgReturn(!(fFlags & ~SSMSTRUCT_FLAGS_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!(fFlags & ~SSMSTRUCT_FLAGS_VALID_MASK), ("%#x\n", fFlags), pSSM->rc = VERR_INVALID_PARAMETER);
     AssertPtr(pvStruct);
     AssertPtr(paFields);
@@ -6613,5 +6646,5 @@
         if (RT_FAILURE(rc))
             return rc;
-        AssertMsgReturn(u32Magic == SSMR3STRUCT_BEGIN, ("u32Magic=%#RX32\n", u32Magic), VERR_SSM_STRUCTURE_MAGIC);
+        AssertMsgReturn(u32Magic == SSMR3STRUCT_BEGIN, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
     }
 
@@ -6637,9 +6670,9 @@
                         && offField + cbField >= offField,
                         ("off=%#x cb=%#x cbStruct=%#x (%s)\n", cbField, offField, cbStruct, pCur->pszName),
-                        VERR_SSM_FIELD_OUT_OF_BOUNDS);
+                        pSSM->rc = VERR_SSM_FIELD_OUT_OF_BOUNDS);
         AssertMsgReturn(    !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
                         || off == offField,
                         ("off=%#x offField=%#x (%s)\n", off, offField, pCur->pszName),
-                        VERR_SSM_FIELD_NOT_CONSECUTIVE);
+                        pSSM->rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
 
         rc = VINF_SUCCESS;
@@ -6652,15 +6685,15 @@
 
             case SSMFIELDTRANS_GCPHYS:
-                AssertMsgReturn(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
                 break;
 
             case SSMFIELDTRANS_GCPTR:
-                AssertMsgReturn(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
                 break;
 
             case SSMFIELDTRANS_RCPTR:
-                AssertMsgReturn(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
                 break;
@@ -6669,5 +6702,5 @@
             {
                 uint32_t const cEntries = cbField / sizeof(RTRCPTR);
-                AssertMsgReturn(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = VINF_SUCCESS;
                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
@@ -6677,5 +6710,5 @@
 
             case SSMFIELDTRANS_HCPTR_NI:
-                AssertMsgReturn(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = ssmR3GetHCPtrNI(pSSM, (void **)pbField, fFlags);
                 break;
@@ -6684,5 +6717,5 @@
             {
                 uint32_t const cEntries = cbField / sizeof(void *);
-                AssertMsgReturn(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = VINF_SUCCESS;
                 for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
@@ -6692,5 +6725,5 @@
 
             case SSMFIELDTRANS_HCPTR_HACK_U32:
-                AssertMsgReturn(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 *(uintptr_t *)pbField = 0;
                 rc = ssmR3DataRead(pSSM, pbField, sizeof(uint32_t));
@@ -6699,12 +6732,12 @@
                     uint32_t u32;
                     rc = ssmR3DataRead(pSSM, &u32, sizeof(uint32_t));
-                    AssertMsgReturn(RT_FAILURE(rc) || u32 == 0 || (fFlags & SSMSTRUCT_FLAGS_SAVED_AS_MEM),
-                                    ("high=%#x low=%#x (%s)\n", u32, *(uint32_t *)pbField, pCur->pszName),
-                                    VERR_SSM_FIELD_INVALID_VALUE);
+                    AssertMsgBreakStmt(RT_FAILURE(rc) || u32 == 0 || (fFlags & SSMSTRUCT_FLAGS_SAVED_AS_MEM),
+                                       ("high=%#x low=%#x (%s)\n", u32, *(uint32_t *)pbField, pCur->pszName),
+                                       rc = VERR_SSM_FIELD_INVALID_VALUE);
                 }
                 break;
 
             case SSMFIELDTRANS_U32_ZX_U64:
-                AssertMsgReturn(cbField == sizeof(uint64_t), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(uint64_t), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 ((uint32_t *)pbField)[1] = 0;
                 rc = SSMR3GetU32(pSSM, (uint32_t *)pbField);
@@ -6718,5 +6751,5 @@
 
             case SSMFIELDTRANS_IGN_GCPHYS:
-                AssertMsgReturn(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
@@ -6724,5 +6757,5 @@
 
             case SSMFIELDTRANS_IGN_GCPTR:
-                AssertMsgReturn(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
@@ -6730,5 +6763,5 @@
 
             case SSMFIELDTRANS_IGN_RCPTR:
-                AssertMsgReturn(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
@@ -6736,5 +6769,5 @@
 
             case SSMFIELDTRANS_IGN_HCPTR:
-                AssertMsgReturn(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
@@ -6743,35 +6776,35 @@
 
             case SSMFIELDTRANS_OLD:
-                AssertMsgReturn(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3Skip(pSSM, pCur->cb);
                 break;
 
             case SSMFIELDTRANS_OLD_GCPHYS:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
                 break;
 
             case SSMFIELDTRANS_OLD_GCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
                 break;
 
             case SSMFIELDTRANS_OLD_RCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
                 break;
 
             case SSMFIELDTRANS_OLD_HCPTR:
-                AssertMsgReturn(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
                 break;
 
             case SSMFIELDTRANS_OLD_PAD_HC:
-                AssertMsgReturn(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) == 64 ? RT_HIWORD(pCur->cb) : RT_LOWORD(pCur->cb));
                 break;
 
             case SSMFIELDTRANS_OLD_PAD_MSC32:
-                AssertMsgReturn(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), VERR_SSM_FIELD_INVALID_SIZE);
+                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
                 if (ssmR3IsHostMsc32(pSSM))
                     rc = SSMR3Skip(pSSM, pCur->cb);
@@ -6795,16 +6828,16 @@
                                        && !ssmR3IsHostMsc32(pSSM))
                                  ? cb64 : cb32;
-                AssertMsgReturn(    cbField == cbCtx
-                                &&  (   (   pCur->off == UINT32_MAX / 2
-                                         && (   cbField == 0
-                                             || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
-                                             || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
-                                            )
+                AssertMsgBreakStmt(    cbField == cbCtx
+                                   &&  (   (   pCur->off == UINT32_MAX / 2
+                                            && (   cbField == 0
+                                                || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
+                                                || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
+                                               )
+                                           )
+                                        || (pCur->off != UINT32_MAX / 2 && cbField != 0)
                                         )
-                                     || (pCur->off != UINT32_MAX / 2 && cbField != 0)
-                                     )
-                                , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
-                                   cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
-                                VERR_SSM_FIELD_INVALID_PADDING_SIZE);
+                                   , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
+                                      cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
+                                   rc = VERR_SSM_FIELD_INVALID_PADDING_SIZE);
                 if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
                     rc = SSMR3Skip(pSSM, cbSaved);
@@ -6813,17 +6846,26 @@
 
             default:
-                AssertPtrReturn(pCur->pfnGetPutOrTransformer, VERR_SSM_FIELD_INVALID_CALLBACK);
+                AssertBreakStmt(pCur->pfnGetPutOrTransformer, rc = VERR_SSM_FIELD_INVALID_CALLBACK);
                 rc = pCur->pfnGetPutOrTransformer(pSSM, pCur, pvStruct, fFlags, true /*fGetOrPut*/, pvUser);
                 break;
         }
         if (RT_FAILURE(rc))
-            return rc;
+            break;
 
         off = offField + cbField;
     }
-    AssertMsgReturn(    !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
-                    || off == cbStruct,
-                    ("off=%#x cbStruct=%#x\n", off, cbStruct),
-                    VERR_SSM_FIELD_NOT_CONSECUTIVE);
+
+    if (RT_SUCCESS(rc))
+        AssertMsgStmt(   !(fFlags & SSMSTRUCT_FLAGS_FULL_STRUCT)
+                      || off == cbStruct,
+                      ("off=%#x cbStruct=%#x\n", off, cbStruct),
+                      rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
+
+    if (RT_FAILURE(rc))
+    {
+        if (RT_SUCCESS(pSSM->rc))
+            pSSM->rc = rc;
+        return rc;
+    }
 
     /*
@@ -6835,5 +6877,5 @@
         if (RT_FAILURE(rc))
             return rc;
-        AssertMsgReturn(u32Magic == SSMR3STRUCT_END, ("u32Magic=%#RX32\n", u32Magic), VERR_SSM_STRUCTURE_MAGIC);
+        AssertMsgReturn(u32Magic == SSMR3STRUCT_END, ("u32Magic=%#RX32\n", u32Magic), pSSM->rc = VERR_SSM_STRUCTURE_MAGIC);
     }
 
