summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-12-06 08:35:09 +0100
committerGitHub <noreply@github.com>2016-12-06 08:35:09 +0100
commit5a82747d7c743c80eeb45452662fabfb69121131 (patch)
tree804478c7b989f397e6bcf542c708c3e4eb03feb5 /lib
parent3d36a1c9497ddb7976095e60c52a7b4e9de33ef7 (diff)
parent44ff8baf2a38e182cb238f4f24b2943a20b7a684 (diff)
downloadNim-5a82747d7c743c80eeb45452662fabfb69121131.tar.gz
Merge pull request #5100 from yglukhov/writeCell-typename
Show cell type name in writeCell
Diffstat (limited to 'lib')
-rw-r--r--lib/system/gc.nim16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index 7fb4c7ac7..6c418cc3a 100644
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -153,13 +153,19 @@ template setColor(c, col) =
 
 proc writeCell(msg: cstring, c: PCell) =
   var kind = -1
-  if c.typ != nil: kind = ord(c.typ.kind)
+  var typName: cstring = "nil"
+  if c.typ != nil:
+    kind = ord(c.typ.kind)
+    when defined(nimTypeNames):
+      if not c.typ.name.isNil:
+        typName = c.typ.name
+
   when leakDetector:
-    c_fprintf(stdout, "[GC] %s: %p %d rc=%ld from %s(%ld)\n",
-              msg, c, kind, c.refcount shr rcShift, c.filename, c.line)
+    c_fprintf(stdout, "[GC] %s: %p %d %s rc=%ld from %s(%ld)\n",
+              msg, c, kind, typName, c.refcount shr rcShift, c.filename, c.line)
   else:
-    c_fprintf(stdout, "[GC] %s: %p %d rc=%ld; color=%ld\n",
-              msg, c, kind, c.refcount shr rcShift, c.color)
+    c_fprintf(stdout, "[GC] %s: %p %d %s rc=%ld; color=%ld\n",
+              msg, c, kind, typName, c.refcount shr rcShift, c.color)
 
 template gcTrace(cell, state: expr): stmt {.immediate.} =
   when traceGC: traceCell(cell, state)