diff options
author | Clyybber <darkmine956@gmail.com> | 2019-08-31 07:44:53 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-08-31 07:44:53 +0200 |
commit | f9600b7207e45573ee066ec7c9145df113ff5b99 (patch) | |
tree | 0b9e1d3fab05b0ec4893c61b80614d8d0f0faaf0 /compiler | |
parent | 82d5e773e3cccbca6632ff7cbfcec055ab4b915b (diff) | |
download | Nim-f9600b7207e45573ee066ec7c9145df113ff5b99.tar.gz |
Remove ENDB (#12095)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgstmts.nim | 26 | ||||
-rw-r--r-- | compiler/cgen.nim | 45 | ||||
-rw-r--r-- | compiler/cgendata.nim | 2 | ||||
-rw-r--r-- | compiler/commands.nim | 24 | ||||
-rw-r--r-- | compiler/jsgen.nim | 6 | ||||
-rw-r--r-- | compiler/options.nim | 1 | ||||
-rw-r--r-- | compiler/pragmas.nim | 15 | ||||
-rw-r--r-- | compiler/wordrecg.nim | 8 |
8 files changed, 18 insertions, 109 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index bfd053f2d..ffeeb0db9 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -1161,36 +1161,10 @@ proc genEmit(p: BProc, t: PNode) = genLineDir(p, t) line(p, cpsStmts, s) -proc genBreakPoint(p: BProc, t: PNode) = - var name: string - if optEndb in p.options: - if t.kind == nkExprColonExpr: - assert(t.sons[1].kind in {nkStrLit..nkTripleStrLit}) - name = normalize(t.sons[1].strVal) - else: - inc(p.module.g.breakPointId) - name = "bp" & $p.module.g.breakPointId - genLineDir(p, t) # BUGFIX - appcg(p.module, p.module.g.breakpoints, - "#dbgRegisterBreakpoint($1, (NCSTRING)$2, (NCSTRING)$3);$n", [ - toLinenumber(t.info), makeCString(toFilename(p.config, t.info)), - makeCString(name)]) - -proc genWatchpoint(p: BProc, n: PNode) = - if optEndb notin p.options: return - var a: TLoc - initLocExpr(p, n.sons[1], a) - let typ = skipTypes(n.sons[1].typ, abstractVarRange) - lineCg(p, cpsStmts, "#dbgRegisterWatchpoint($1, (NCSTRING)$2, $3);$n", - [addrLoc(p.config, a), makeCString(renderTree(n.sons[1])), - genTypeInfo(p.module, typ, n.info)]) - proc genPragma(p: BProc, n: PNode) = for it in n.sons: case whichPragma(it) of wEmit: genEmit(p, it) - of wBreakpoint: genBreakPoint(p, it) - of wWatchPoint: genWatchpoint(p, it) of wInjectStmt: var p = newProc(nil, p.module) p.options = p.options - {optLineTrace, optStackTrace} diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 033003485..6e79b2d7b 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -264,13 +264,7 @@ proc genLineDir(p: BProc, t: PNode) = if optEmbedOrigSrc in p.config.globalOptions: add(p.s(cpsStmts), ~"//" & sourceLine(p.config, t.info) & "\L") genCLineDir(p.s(cpsStmts), toFullPath(p.config, t.info), line, p.config) - if ({optStackTrace, optEndb} * p.options == {optStackTrace, optEndb}) and - (p.prc == nil or sfPure notin p.prc.flags): - if freshLineInfo(p, t.info): - linefmt(p, cpsStmts, "#endb($1, $2);$N", - [line, makeCString(toFilename(p.config, t.info))]) - elif ({optLineTrace, optStackTrace} * p.options == - {optLineTrace, optStackTrace}) and + if ({optLineTrace, optStackTrace} * p.options == {optLineTrace, optStackTrace}) and (p.prc == nil or sfPure notin p.prc.flags) and t.info.fileIndex != InvalidFileIdx: if freshLineInfo(p, t.info): linefmt(p, cpsStmts, "nimln_($1, $2);$n", @@ -479,19 +473,6 @@ proc deinitGCFrame(p: BProc): Rope = result = ropecg(p.module, "if (((NU)&GCFRAME_) < 4096) #nimGCFrame(&GCFRAME_);$n", []) -proc localDebugInfo(p: BProc, s: PSym, retType: PType) = - if {optStackTrace, optEndb} * p.options != {optStackTrace, optEndb}: return - # XXX work around a bug: No type information for open arrays possible: - if skipTypes(s.typ, abstractVar).kind in {tyOpenArray, tyVarargs}: return - var a = "&" & s.loc.r - if s.kind == skParam and ccgIntroducedPtr(p.config, s, retType): a = s.loc.r - lineF(p, cpsInit, - "FR_.s[$1].address = (void*)$3; FR_.s[$1].typ = $4; FR_.s[$1].name = $2;$n", - [p.maxFrameLen.rope, makeCString(normalize(s.name.s)), a, - genTypeInfo(p.module, s.loc.t, s.info)]) - inc(p.maxFrameLen) - inc p.blocks[p.blocks.len-1].frameLen - proc localVarDecl(p: BProc; n: PNode): Rope = let s = n.sym if s.loc.k == locNone: @@ -515,7 +496,6 @@ proc assignLocalVar(p: BProc, n: PNode) = let nl = if optLineDir in p.config.options: "" else: "\L" let decl = localVarDecl(p, n) & ";" & nl line(p, cpsLocals, decl) - localDebugInfo(p, n.sym, nil) include ccgthreadvars @@ -562,17 +542,10 @@ proc assignGlobalVar(p: BProc, n: PNode) = if p.withinLoop > 0: # fixes tests/run/tzeroarray: resetLoc(p, s.loc) - if p.module.module.options * {optStackTrace, optEndb} == - {optStackTrace, optEndb}: - appcg(p.module, p.module.s[cfsDebugInit], - "#dbgRegisterGlobal($1, &$2, $3);$n", - [makeCString(normalize(s.owner.name.s & '.' & s.name.s)), - s.loc.r, genTypeInfo(p.module, s.typ, n.info)]) proc assignParam(p: BProc, s: PSym, retType: PType) = assert(s.loc.r != nil) scopeMangledParam(p, s) - localDebugInfo(p, s, retType) proc fillProcLoc(m: BModule; n: PNode) = let sym = n.sym @@ -689,7 +662,7 @@ proc loadDynamicLib(m: BModule, lib: PLib) = [loadlib, genStringLiteral(m, lib.path)]) else: var p = newProc(nil, m) - p.options = p.options - {optStackTrace, optEndb} + p.options = p.options - {optStackTrace} var dest: TLoc initLoc(dest, locTemp, lib.path, OnStack) dest.r = getTempName(m) @@ -1318,7 +1291,6 @@ proc genMainProc(m: BModule) = PreMainBody = "$N" & "void PreMainInner(void) {$N" & "$2" & - "$3" & "}$N$N" & PosixCmdLine & "void PreMain(void) {$N" & @@ -1408,17 +1380,11 @@ proc genMainProc(m: BModule) = elif m.config.target.targetOS == osGenode: m.includeHeader("<libc/component.h>") - if optEndb in m.config.options: - for i in 0..<m.config.m.fileInfos.len: - m.g.breakpoints.addf("dbgRegisterFilename($1);$N", - [m.config.m.fileInfos[i].projPath.string.makeCString]) - let initStackBottomCall = if m.config.target.targetOS == osStandalone or m.config.selectedGC == gcNone: "".rope else: ropecg(m, "\t#initStackBottomWith((void *)&inner);$N", []) inc(m.labels) - appcg(m, m.s[cfsProcs], PreMainBody, [ - m.g.mainDatInit, m.g.breakpoints, m.g.otherModsInit]) + appcg(m, m.s[cfsProcs], PreMainBody, [m.g.mainDatInit, m.g.otherModsInit]) if m.config.target.targetOS == osWindows and m.config.globalOptions * {optGenGuiApp, optGenDynLib} != {}: @@ -2024,11 +1990,6 @@ proc myClose(graph: ModuleGraph; b: PPassContext, n: PNode): PNode = if emulatedThreadVars(m.config) and m.config.target.targetOS != osStandalone: discard cgsym(m, "initThreadVarsEmulation") - if m.g.breakpoints != nil: - discard cgsym(m, "dbgRegisterBreakpoint") - if optEndb in m.config.options: - discard cgsym(m, "dbgRegisterFilename") - if m.g.forwardedProcs.len == 0: incl m.flags, objHasKidsValid let disp = generateMethodDispatchers(graph) diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index 47b0f23ec..0035931f0 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -117,8 +117,6 @@ type modulesClosed*: seq[BModule] # list of the same compiled modules, but in the order they were closed forwardedProcs*: seq[PSym] # proc:s that did not yet have a body generatedHeader*: BModule - breakPointId*: int - breakpoints*: Rope # later the breakpoints are inserted into the main proc typeInfoMarker*: TypeCacheWithOwner config*: ConfigRef graph*: ModuleGraph diff --git a/compiler/commands.nim b/compiler/commands.nim index 662df9c84..5b6f3ac0f 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -266,7 +266,7 @@ proc testCompileOption*(conf: ConfigRef; switch: string, info: TLineInfo): bool of "threadanalysis": result = contains(conf.globalOptions, optThreadAnalysis) of "stacktrace": result = contains(conf.options, optStackTrace) of "linetrace": result = contains(conf.options, optLineTrace) - of "debugger": result = contains(conf.options, optEndb) + of "debugger": result = contains(conf.globalOptions, optCDebug) of "profiler": result = contains(conf.options, optProfiler) of "memtracker": result = contains(conf.options, optMemTracker) of "checks", "x": result = conf.options * ChecksOptions == ChecksOptions @@ -473,24 +473,18 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo; of "linetrace": processOnOffSwitch(conf, {optLineTrace}, arg, pass, info) of "debugger": case arg.normalize - of "on", "endb": - conf.options.incl optEndb - defineSymbol(conf.symbols, "endb") - of "off": - conf.options.excl optEndb - undefSymbol(conf.symbols, "endb") - of "native", "gdb": - incl(conf.globalOptions, optCDebug) - conf.options = conf.options + {optLineDir} - {optEndb} + of "on", "native", "gdb": + conf.globalOptions.incl optCDebug + conf.options.incl optLineDir #defineSymbol(conf.symbols, "nimTypeNames") # type names are used in gdb pretty printing - undefSymbol(conf.symbols, "endb") + of "off": + conf.globalOptions.excl optCDebug else: - localError(conf, info, "expected endb|gdb but found " & arg) + localError(conf, info, "expected native|gdb|on|off but found " & arg) of "g": # alias for --debugger:native - incl(conf.globalOptions, optCDebug) - conf.options = conf.options + {optLineDir} - {optEndb} + conf.globalOptions.incl optCDebug + conf.options.incl optLineDir #defineSymbol(conf.symbols, "nimTypeNames") # type names are used in gdb pretty printing - undefSymbol(conf.symbols, "endb") of "profiler": processOnOffSwitch(conf, {optProfiler}, arg, pass, info) if optProfiler in conf.options: defineSymbol(conf.symbols, "profiler") diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 5391a451b..107fa2b28 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -658,11 +658,7 @@ proc genLineDir(p: PProc, n: PNode) = if optLineDir in p.options: lineF(p, "// line $2 \"$1\"$n", [rope(toFilename(p.config, n.info)), rope(line)]) - if {optStackTrace, optEndb} * p.options == {optStackTrace, optEndb} and - ((p.prc == nil) or sfPure notin p.prc.flags): - useMagic(p, "endb") - lineF(p, "endb($1);$n", [rope(line)]) - elif hasFrameInfo(p): + if hasFrameInfo(p): lineF(p, "F.line = $1;$n", [rope(line)]) proc genWhileStmt(p: PProc, n: PNode) = diff --git a/compiler/options.nim b/compiler/options.nim index 8b5ade727..1b9bbb38f 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -30,7 +30,6 @@ type # please make sure we have under 32 options optAssert, optLineDir, optWarns, optHints, optOptimizeSpeed, optOptimizeSize, optStackTrace, # stack tracing support optLineTrace, # line tracing support (includes stack tracing) - optEndb, # embedded debugger optByRef, # use pass by ref for objects # (for interfacing with C) optProfiler, # profiler turned on diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 000066b8e..3de12cfa9 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -44,7 +44,7 @@ const wWarnings, wHints, wLineDir, wStackTrace, wLineTrace, wOptimization, wHint, wWarning, wError, wFatal, wDefine, wUndef, wCompile, wLink, wLinksys, wPure, wPush, wPop, - wBreakpoint, wWatchPoint, wPassl, wPassc, + wPassl, wPassc, wDeadCodeElimUnused, # deprecated, always on wDeprecated, wFloatChecks, wInfChecks, wNanChecks, wPragma, wEmit, wUnroll, @@ -345,7 +345,7 @@ proc pragmaToOptions(w: TSpecialWord): TOptions {.inline.} = of wLineDir: {optLineDir} of wStackTrace: {optStackTrace} of wLineTrace: {optLineTrace} - of wDebugger: {optEndb} + of wDebugger: {optNone} of wProfiler: {optProfiler, optMemTracker} of wMemTracker: {optMemTracker} of wByRef: {optByRef} @@ -513,15 +513,6 @@ proc processLink(c: PContext, n: PNode) = extccomp.addExternalFileToLink(c.config, found) recordPragma(c, n, "link", found.string) -proc pragmaBreakpoint(c: PContext, n: PNode) = - discard getOptionalStr(c, n, "") - -proc pragmaWatchpoint(c: PContext, n: PNode) = - if n.kind in nkPragmaCallKinds and n.len == 2: - n.sons[1] = c.semExpr(c, n.sons[1]) - else: - invalidPragma(c, n) - proc semAsmOrEmit*(con: PContext, n: PNode, marker: char): PNode = case n.sons[1].kind of nkStrLit, nkRStrLit, nkTripleStrLit: @@ -996,8 +987,6 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int, let s = expectStrLit(c, it) extccomp.addCompileOption(c.config, s) recordPragma(c, it, "passc", s) - of wBreakpoint: pragmaBreakpoint(c, it) - of wWatchPoint: pragmaWatchpoint(c, it) of wPush: processPush(c, n, i + 1) result = true diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index 837ce4268..62b26adf3 100644 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -48,7 +48,7 @@ type wCompilerProc, wCore, wProcVar, wBase, wUsed, wFatal, wError, wWarning, wHint, wLine, wPush, wPop, wDefine, wUndef, wLineDir, wStackTrace, wLineTrace, wLink, wCompile, - wLinksys, wDeprecated, wVarargs, wCallconv, wBreakpoint, wDebugger, + wLinksys, wDeprecated, wVarargs, wCallconv, wDebugger, wNimcall, wStdcall, wCdecl, wSafecall, wSyscall, wInline, wNoInline, wFastcall, wClosure, wNoconv, wOn, wOff, wChecks, wRangeChecks, wBoundChecks, wOverflowChecks, wNilChecks, @@ -62,8 +62,7 @@ type wCompileTime, wNoInit, wPassc, wPassl, wBorrow, wDiscardable, wFieldChecks, - wWatchPoint, wSubsChar, - wAcyclic, wShallow, wUnroll, wLinearScanEnd, wComputedGoto, + wSubsChar, wAcyclic, wShallow, wUnroll, wLinearScanEnd, wComputedGoto, wInjectStmt, wExperimental, wWrite, wGensym, wInject, wDirty, wInheritable, wThreadVar, wEmit, wAsmNoStackFrame, @@ -138,7 +137,7 @@ const "fatal", "error", "warning", "hint", "line", "push", "pop", "define", "undef", "linedir", "stacktrace", "linetrace", "link", "compile", "linksys", "deprecated", "varargs", - "callconv", "breakpoint", "debugger", "nimcall", "stdcall", + "callconv", "debugger", "nimcall", "stdcall", "cdecl", "safecall", "syscall", "inline", "noinline", "fastcall", "closure", "noconv", "on", "off", "checks", "rangechecks", "boundchecks", "overflowchecks", "nilchecks", @@ -152,7 +151,6 @@ const "pragma", "compiletime", "noinit", "passc", "passl", "borrow", "discardable", "fieldchecks", - "watchpoint", "subschar", "acyclic", "shallow", "unroll", "linearscanend", "computedgoto", "injectstmt", "experimental", "write", "gensym", "inject", "dirty", "inheritable", "threadvar", "emit", |