Make Nim gdb pretty print friendly (#6240)

This commit is contained in:
cooldome 2017-08-24 09:21:38 +01:00 • committed by Andreas Rumpf
commit 82453825e9
2 changed files with 3 additions and 2 deletions

View file

@ -125,7 +125,7 @@ proc typeName(typ: PType): Rope =
let typ = typ.skipTypes(irrelevantForBackend) let typ = typ.skipTypes(irrelevantForBackend)
result = result =
if typ.sym != nil and typ.kind in {tyObject, tyEnum}: 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: else:
rope($typ.kind) rope($typ.kind)
@ -799,7 +799,7 @@ proc getTypeDescAux(m: BModule, origTyp: PType, check: var IntSet): Rope =
add(m.s[cfsTypes], recdesc) add(m.s[cfsTypes], recdesc)
elif tfIncompleteStruct notin t.flags: addAbiCheck(m, t, result) elif tfIncompleteStruct notin t.flags: addAbiCheck(m, t, result)
of tySet: 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 m.typeCache[sig] = result
if not isImportedType(t): if not isImportedType(t):
let s = int(getSize(t)) let s = int(getSize(t))

View file

@ -454,6 +454,7 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
of "native", "gdb": of "native", "gdb":
incl(gGlobalOptions, optCDebug) incl(gGlobalOptions, optCDebug)
gOptions = gOptions + {optLineDir} - {optEndb} gOptions = gOptions + {optLineDir} - {optEndb}
defineSymbol("nimTypeNames", nil) # type names are used in gdb pretty printing
undefSymbol("endb") undefSymbol("endb")
else: else:
localError(info, "expected endb|gdb but found " & arg) localError(info, "expected endb|gdb but found " & arg)