]> git.saurik.com Git - redis.git/blobdiff - src/debug.c
Merge remote-tracking branch 'origin/unstable' into unstable
[redis.git] / src / debug.c
index d218f0f93179fc74e4ff4fc53c12cbf04bee4a2d..728aa8a18cc052277f8520759d4cb916e845267e 100644 (file)
@@ -336,9 +336,7 @@ void _redisAssertPrintClientInfo(redisClient *c) {
     }
 }
 
     }
 }
 
-void _redisAssertPrintObject(robj *o) {
-    bugReportStart();
-    redisLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
+void redisLogObjectDebugInfo(robj *o) {
     redisLog(REDIS_WARNING,"Object type: %d", o->type);
     redisLog(REDIS_WARNING,"Object encoding: %d", o->encoding);
     redisLog(REDIS_WARNING,"Object refcount: %d", o->refcount);
     redisLog(REDIS_WARNING,"Object type: %d", o->type);
     redisLog(REDIS_WARNING,"Object encoding: %d", o->encoding);
     redisLog(REDIS_WARNING,"Object refcount: %d", o->refcount);
@@ -346,9 +344,25 @@ void _redisAssertPrintObject(robj *o) {
         redisLog(REDIS_WARNING,"Object raw string len: %d", sdslen(o->ptr));
         if (sdslen(o->ptr) < 4096)
             redisLog(REDIS_WARNING,"Object raw string content: \"%s\"", (char*)o->ptr);
         redisLog(REDIS_WARNING,"Object raw string len: %d", sdslen(o->ptr));
         if (sdslen(o->ptr) < 4096)
             redisLog(REDIS_WARNING,"Object raw string content: \"%s\"", (char*)o->ptr);
+    } else if (o->type == REDIS_LIST) {
+        redisLog(REDIS_WARNING,"List length: %d", (int) listTypeLength(o));
+    } else if (o->type == REDIS_SET) {
+        redisLog(REDIS_WARNING,"Set size: %d", (int) setTypeSize(o));
+    } else if (o->type == REDIS_HASH) {
+        redisLog(REDIS_WARNING,"Hash size: %d", (int) hashTypeLength(o));
+    } else if (o->type == REDIS_ZSET) {
+        redisLog(REDIS_WARNING,"Sorted set size: %d", (int) zsetLength(o));
+        if (o->encoding == REDIS_ENCODING_SKIPLIST)
+            redisLog(REDIS_WARNING,"Skiplist level: %d", (int) ((zset*)o->ptr)->zsl->level);
     }
 }
 
     }
 }
 
+void _redisAssertPrintObject(robj *o) {
+    bugReportStart();
+    redisLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
+    redisLogObjectDebugInfo(o);
+}
+
 void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line) {
     if (c) _redisAssertPrintClientInfo(c);
     if (o) _redisAssertPrintObject(o);
 void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line) {
     if (c) _redisAssertPrintClientInfo(c);
     if (o) _redisAssertPrintObject(o);