improve the debugging experience when line directives are used
This commit is contained in:
parent
2db96d4f7b
commit
c446806f75
2 changed files with 7 additions and 4 deletions
|
|
@ -215,7 +215,7 @@ proc genLineDir(p: BProc, t: PNode) =
|
||||||
{optLineTrace, optStackTrace}) and
|
{optLineTrace, optStackTrace}) and
|
||||||
(p.prc == nil or sfPure notin p.prc.flags) and tt.info.fileIndex >= 0:
|
(p.prc == nil or sfPure notin p.prc.flags) and tt.info.fileIndex >= 0:
|
||||||
if freshLineInfo(p, tt.info):
|
if freshLineInfo(p, tt.info):
|
||||||
linefmt(p, cpsStmts, "nimln_($1, $2);$N",
|
linefmt(p, cpsStmts, "nimln_($1, $2);$n",
|
||||||
line.rope, tt.info.quotedFilename)
|
line.rope, tt.info.quotedFilename)
|
||||||
|
|
||||||
proc postStmtActions(p: BProc) {.inline.} =
|
proc postStmtActions(p: BProc) {.inline.} =
|
||||||
|
|
@ -394,7 +394,8 @@ proc assignLocalVar(p: BProc, s: PSym) =
|
||||||
#assert(s.loc.k == locNone) # not yet assigned
|
#assert(s.loc.k == locNone) # not yet assigned
|
||||||
# this need not be fulfilled for inline procs; they are regenerated
|
# this need not be fulfilled for inline procs; they are regenerated
|
||||||
# for each module that uses them!
|
# for each module that uses them!
|
||||||
let decl = localVarDecl(p, s) & ";" & tnl
|
let nl = if optLineDir in gOptions: "" else: tnl
|
||||||
|
let decl = localVarDecl(p, s) & ";" & nl
|
||||||
line(p, cpsLocals, decl)
|
line(p, cpsLocals, decl)
|
||||||
localDebugInfo(p, s)
|
localDebugInfo(p, s)
|
||||||
|
|
||||||
|
|
@ -627,11 +628,11 @@ proc initFrame(p: BProc, procname, filename: Rope): Rope =
|
||||||
discard cgsym(p.module, "nimFrame")
|
discard cgsym(p.module, "nimFrame")
|
||||||
if p.maxFrameLen > 0:
|
if p.maxFrameLen > 0:
|
||||||
discard cgsym(p.module, "VarSlot")
|
discard cgsym(p.module, "VarSlot")
|
||||||
result = rfmt(nil, "\tnimfrs_($1, $2, $3, $4)$N",
|
result = rfmt(nil, "\tnimfrs_($1, $2, $3, $4);$n",
|
||||||
procname, filename, p.maxFrameLen.rope,
|
procname, filename, p.maxFrameLen.rope,
|
||||||
p.blocks[0].frameLen.rope)
|
p.blocks[0].frameLen.rope)
|
||||||
else:
|
else:
|
||||||
result = rfmt(nil, "\tnimfr_($1, $2)$N", procname, filename)
|
result = rfmt(nil, "\tnimfr_($1, $2);$n", procname, filename)
|
||||||
|
|
||||||
proc deinitFrame(p: BProc): Rope =
|
proc deinitFrame(p: BProc): Rope =
|
||||||
result = rfmt(p.module, "\t#popFrame();$n")
|
result = rfmt(p.module, "\t#popFrame();$n")
|
||||||
|
|
@ -1311,6 +1312,7 @@ proc myProcess(b: PPassContext, n: PNode): PNode =
|
||||||
if b == nil or passes.skipCodegen(n): return
|
if b == nil or passes.skipCodegen(n): return
|
||||||
var m = BModule(b)
|
var m = BModule(b)
|
||||||
m.initProc.options = initProcOptions(m)
|
m.initProc.options = initProcOptions(m)
|
||||||
|
softRnl = if optLineDir in gOptions: noRnl else: rnl
|
||||||
genStmts(m.initProc, n)
|
genStmts(m.initProc, n)
|
||||||
|
|
||||||
proc finishModule(m: BModule) =
|
proc finishModule(m: BModule) =
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,7 @@ proc prepend*(a: var Rope, b: string) = a = b & a
|
||||||
var
|
var
|
||||||
rnl* = tnl.newRope
|
rnl* = tnl.newRope
|
||||||
softRnl* = tnl.newRope
|
softRnl* = tnl.newRope
|
||||||
|
noRnl* = "".newRope
|
||||||
|
|
||||||
proc `%`*(frmt: FormatStr, args: openArray[Rope]): Rope =
|
proc `%`*(frmt: FormatStr, args: openArray[Rope]): Rope =
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue