summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2017-08-24 09:21:38 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-08-24 10:21:38 +0200
commit82453825e98872862fc0adab536d2dd8c6f24116 (patch)
treedfe7c47c38b2cae1a23ab60c8bed8ec7b20bf26b /compiler
parent3ce8bec3599ddf1bbebc0951e03e9b74f62d7efc (diff)
downloadNim-82453825e98872862fc0adab536d2dd8c6f24116.tar.gz
Make Nim gdb pretty print friendly (#6240)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgtypes.nim4
-rw-r--r--compiler/commands.nim1
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index bd3e6d40d..35d73aac0 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -125,7 +125,7 @@ proc typeName(typ: PType): Rope =
   let typ = typ.skipTypes(irrelevantForBackend)
   result =
     if typ.sym != nil and typ.kind in {tyObject, tyEnum}:
-      typ.sym.name.s.mangle.rope
+      rope($typ.kind & '_' & typ.sym.name.s.mangle)
     else:
       rope($typ.kind)
 
@@ -799,7 +799,7 @@ proc getTypeDescAux(m: BModule, origTyp: PType, check: var IntSet): Rope =
         add(m.s[cfsTypes], recdesc)
       elif tfIncompleteStruct notin t.flags: addAbiCheck(m, t, result)
   of tySet:
-    result = getTypeName(m, t.lastSon, hashType t.lastSon) & "_Set"
+    result = $t.kind & '_' & getTypeName(m, t.lastSon, hashType t.lastSon)
     m.typeCache[sig] = result
     if not isImportedType(t):
       let s = int(getSize(t))
diff --git a/compiler/commands.nim b/compiler/commands.nim
index e837ee922..9781a8af4 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -454,6 +454,7 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
     of "native", "gdb":
       incl(gGlobalOptions, optCDebug)
       gOptions = gOptions + {optLineDir} - {optEndb}
+      defineSymbol("nimTypeNames", nil) # type names are used in gdb pretty printing
       undefSymbol("endb")
     else:
       localError(info, "expected endb|gdb but found " & arg)