summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-12-06 10:08:38 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-12-06 10:08:38 +0100
commit36a97038665c3fa21ef97b2cc00d381e15b0d95c (patch)
tree309c86af6f24bac43443a86f0c8cde74aa3a5f61 /lib/system
parent0d6f4f1bb17e72b6bc0a7d781b2ca9fc1a6c4adb (diff)
parent14b9eaee06894f5bf00548117984381d37f16ec7 (diff)
downloadNim-36a97038665c3fa21ef97b2cc00d381e15b0d95c.tar.gz
Merge branch 'devel' into sighashes
Diffstat (limited to 'lib/system')
-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 c6ba639ea..8d9dc9025 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)