make basic debugging possible

This commit is contained in:
Arne Döring
2018-06-26 01:42:36 +02:00
parent 27b081d1f7
commit ba3c6d022b
3 changed files with 9 additions and 9 deletions

View File

@@ -27,9 +27,9 @@ proc lineInfoToStr*(conf: ConfigRef; info: TLineInfo): Rope
when declared(echo):
# these are for debugging only: They are not really deprecated, but I want
# the warning so that release versions do not contain debugging statements:
proc debug*(conf: ConfigRef; n: PSym) {.deprecated.}
proc debug*(conf: ConfigRef; n: PType) {.deprecated.}
proc debug*(conf: ConfigRef; n: PNode) {.deprecated.}
proc debug*(n: PSym; conf: ConfigRef = nil) {.deprecated.}
proc debug*(n: PType; conf: ConfigRef = nil) {.deprecated.}
proc debug*(n: PNode; conf: ConfigRef = nil) {.deprecated.}
template mdbg*: bool {.dirty.} =
when compiles(c.module):
@@ -409,7 +409,7 @@ proc debugTree(conf: ConfigRef; n: PNode, indent: int, maxRecDepth: int;
addf(result, "$N$1}", [rspaces(indent)])
when declared(echo):
proc debug(conf: ConfigRef; n: PSym) =
proc debug(n: PSym; conf: ConfigRef) =
if n == nil:
echo("null")
elif n.kind == skUnknown:
@@ -420,10 +420,10 @@ when declared(echo):
n.name.s, $n.id, $flagsToStr(n.flags), $flagsToStr(n.loc.flags),
$lineInfoToStr(conf, n.info), $n.kind])
proc debug(conf: ConfigRef; n: PType) =
proc debug(n: PType; conf: ConfigRef) =
echo($debugType(conf, n))
proc debug(conf: ConfigRef; n: PNode) =
proc debug(n: PNode; conf: ConfigRef) =
echo($debugTree(conf, n, 0, 100))
proc nextTry(h, maxHash: Hash): Hash =

View File

@@ -155,10 +155,10 @@ proc getInfoContext*(conf: ConfigRef; index: int): TLineInfo =
else: result = conf.m.msgContext[i]
template toFilename*(conf: ConfigRef; fileIdx: FileIndex): string =
(if fileIdx.int32 < 0: "???" else: conf.m.fileInfos[fileIdx.int32].projPath)
(if fileIdx.int32 < 0 or conf == nil: "???" else: conf.m.fileInfos[fileIdx.int32].projPath)
proc toFullPath*(conf: ConfigRef; fileIdx: FileIndex): string =
if fileIdx.int32 < 0: result = "???"
if fileIdx.int32 < 0 or conf == nil: result = "???"
else: result = conf.m.fileInfos[fileIdx.int32].fullPath
proc setDirtyFile*(conf: ConfigRef; fileIdx: FileIndex; filename: string) =

View File

@@ -470,7 +470,7 @@ proc temp(args: string) =
# commit.
let (bootArgs, programArgs) = splitArgs(args)
let nimexec = findNim()
exec(nimexec & " c -d:debug " & bootArgs & " compiler" / "nim", 125)
exec(nimexec & " c --debugger:native " & bootArgs & " compiler" / "nim", 125)
copyExe(output, finalDest)
if programArgs.len > 0: exec(finalDest & " " & programArgs)