Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp	(revision 24083)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp	(revision 24084)
@@ -38,5 +38,9 @@
 
 /**
- * Helper function used with "VBoxManage snapshot ... dump".
+ * Helper function used with "VBoxManage snapshot ... dump". Gets called to find the
+ * snapshot in the machine's snapshot tree that uses a particular diff image child of
+ * a medium.
+ * Horribly inefficient since we keep re-querying the snapshots tree for each image,
+ * but this is for quick debugging only.
  * @param pMedium
  * @param pThisSnapshot
@@ -64,6 +68,4 @@
         CHECK_ERROR_BREAK(pSnapshotMachine, COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(aAttachments)));
 
-        bool fFound = false;
-
         for (uint32_t i = 0;
              i < aAttachments.size();
@@ -84,7 +86,8 @@
                     CHECK_ERROR_BREAK(pThisSnapshot, COMGETTER(Name)(bstrSnapshotName.asOutParam()));
 
-                    RTPrintf("%*s  \"%ls\"\n",
+                    RTPrintf("%*s  \"%ls\"%s\n",
                              50 + uSnapshotLevel * 2, "",            // indent
-                             bstrSnapshotName.raw());
+                             bstrSnapshotName.raw(),
+                             (pThisSnapshot == pCurrentSnapshot) ? " (CURSNAP)" : "");
                     return true;        // found
                 }
@@ -92,22 +95,20 @@
         }
 
-        if (!fFound)
-        {
-            SafeIfaceArray<ISnapshot> aSnapshots;
-            CHECK_ERROR_BREAK(pThisSnapshot, COMGETTER(Children)(ComSafeArrayAsOutParam(aSnapshots)));
-
-            for (uint32_t i = 0;
-                i < aSnapshots.size();
-                ++i)
-            {
-                ComPtr<ISnapshot> pChild(aSnapshots[i]);
-                if (FindAndPrintSnapshotUsingMedium(pMedium,
-                                                    pChild,
-                                                    pCurrentSnapshot,
-                                                    uMediumLevel,
-                                                    uSnapshotLevel + 1))
-                    // found:
-                    break;
-            }
+        // not found: then recurse into child snapshots
+        SafeIfaceArray<ISnapshot> aSnapshots;
+        CHECK_ERROR_BREAK(pThisSnapshot, COMGETTER(Children)(ComSafeArrayAsOutParam(aSnapshots)));
+
+        for (uint32_t i = 0;
+            i < aSnapshots.size();
+            ++i)
+        {
+            ComPtr<ISnapshot> pChild(aSnapshots[i]);
+            if (FindAndPrintSnapshotUsingMedium(pMedium,
+                                                pChild,
+                                                pCurrentSnapshot,
+                                                uMediumLevel,
+                                                uSnapshotLevel + 1))
+                // found:
+                break;
         }
     } while (0);
@@ -142,5 +143,5 @@
                  uLevel * 2, "",            // indent
                  bstrMediumName.raw(),
-                 (pCurrentStateMedium == pMedium) ? " (CURRENT STATE)" : "");
+                 (pCurrentStateMedium == pMedium) ? " (CURSTATE)" : "");
 
         // find and print the snapshot that uses this particular medium (diff image)
