[Spice-devel] [PATCH 26/35] [debug] loadvm logging

alexl at redhat.com alexl at redhat.com
Thu Sep 9 10:16:09 PDT 2010


From: Gerd Hoffmann <kraxel at redhat.com>

---
 arch_init.c |    9 ++++++++-
 savevm.c    |    6 ++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index e468c0c..2003bd6 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -346,6 +346,7 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
         if (flags & RAM_SAVE_FLAG_MEM_SIZE) {
             if (version_id == 3) {
                 if (addr != ram_bytes_total()) {
+                    fprintf(stderr, "%s: v3 size mismatch\n", __FUNCTION__);
                     return -EINVAL;
                 }
             } else {
@@ -365,8 +366,13 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
 
                     QLIST_FOREACH(block, &ram_list.blocks, next) {
                         if (!strncmp(id, block->idstr, sizeof(id))) {
-                            if (block->length != length)
+                            if (block->length != length) {
+                                fprintf(stderr, "%s: block \"%s\" size mismatch, "
+                                        "got 0x%lx, want 0x%lx\n",
+                                        __FUNCTION__, block->idstr,
+                                        length, block->length);
                                 return -EINVAL;
+                            }
                             break;
                         }
                     }
@@ -410,6 +416,7 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
             qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
         }
         if (qemu_file_has_error(f)) {
+            fprintf(stderr, "%s: i/o error\n", __FUNCTION__);
             return -EIO;
         }
     } while (!(flags & RAM_SAVE_FLAG_EOS));
diff --git a/savevm.c b/savevm.c
index 99e4949..0c8844b 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1710,6 +1710,10 @@ int qemu_loadvm_state(QEMUFile *f)
                 goto out;
             }
 
+            fprintf(stderr, "%s: name \"%s\", version %d, instance %d, %s\n",
+                    __FUNCTION__, idstr, version_id, instance_id,
+                    se->vmsd ? "vmsd" : "func");
+
             /* Validate version */
             if (version_id > se->version_id) {
                 fprintf(stderr, "savevm: unsupported version %d for '%s' v%d\n",
@@ -1775,6 +1779,8 @@ out:
     if (qemu_file_has_error(f))
         ret = -EIO;
 
+    fprintf(stderr, "%s: done, %s\n", __FUNCTION__,
+            ret == 0 ? "success" : "failure");
     return ret;
 }
 
-- 
1.7.0.1



More information about the Spice-devel mailing list