From: DeaDDooMER Date: Mon, 22 Jul 2019 15:24:00 +0000 (+0300) Subject: disable stack trace after user interrupt X-Git-Tag: v0.2~6 X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=e01013bb2dfa7aaab246a94bdde530fd91ea4a43;p=cpc.git disable stack trace after user interrupt --- diff --git a/src/cpfront/posix/generic/System/Mod/Kernel.cp b/src/cpfront/posix/generic/System/Mod/Kernel.cp index 8d4c334..622e0b1 100644 --- a/src/cpfront/posix/generic/System/Mod/Kernel.cp +++ b/src/cpfront/posix/generic/System/Mod/Kernel.cp @@ -238,7 +238,9 @@ MODULE Kernel; wouldFinalize: BOOLEAN; - watcher*: PROCEDURE (event: INTEGER); (* for debugging *) + watcher*: PROCEDURE (event: INTEGER); (* for debugging *) + + intTrap*: BOOLEAN; PROCEDURE Erase (adr, words: INTEGER); BEGIN @@ -1559,7 +1561,7 @@ MODULE Kernel; SetDLink(tryDLink); setjmp._longjmp(tryEnv, 1) END; - IF err = 128 THEN (* do nothing *) + IF (err = 128) OR (err = 200) & ~intTrap THEN (* do nothing *) ELSIF (trapViewer # NIL) & (restart # NIL) & ~trapped & ~guarded THEN trapped := TRUE; trapViewer() ELSE DefaultTrapViewer @@ -1622,7 +1624,7 @@ MODULE Kernel; SetDLink(tryDLink); setjmp._longjmp(tryEnv, 1) END; - IF err = 128 THEN (* do nothing *) + IF (err = 128) OR (err = 200) & ~intTrap THEN (* do nothing *) ELSIF (trapViewer # NIL) & (restart # NIL) & ~trapped & ~guarded THEN trapped := TRUE; trapViewer() ELSE DefaultTrapViewer @@ -1662,6 +1664,7 @@ MODULE Kernel; PROCEDURE Init; VAR i: INTEGER; BEGIN + intTrap := TRUE; baseStack := S.ADR(i); (* XXX *) pagesize := unistd.sysconf(unistd._SC_PAGESIZE); diff --git a/src/generic/Dsw/Mod/Compiler486Main.cp b/src/generic/Dsw/Mod/Compiler486Main.cp index 77ded19..5d1a68f 100644 --- a/src/generic/Dsw/Mod/Compiler486Main.cp +++ b/src/generic/Dsw/Mod/Compiler486Main.cp @@ -136,6 +136,7 @@ MODULE DswCompiler486Main; ELSIF p = "-no-hints" THEN EXCL(opts, hint) ELSIF p = "-trap" THEN + Kernel.intTrap := TRUE; INCL(opts, errorTrap) ELSIF p = "-no-trap" THEN EXCL(opts, errorTrap) @@ -315,6 +316,7 @@ MODULE DswCompiler486Main; END Init; BEGIN + Kernel.intTrap := FALSE; Kernel.Start(Init) END DswCompiler486Main. diff --git a/src/generic/Dsw/Mod/CompilerCPfrontMain.cp b/src/generic/Dsw/Mod/CompilerCPfrontMain.cp index 672ca76..b5d4ec9 100644 --- a/src/generic/Dsw/Mod/CompilerCPfrontMain.cp +++ b/src/generic/Dsw/Mod/CompilerCPfrontMain.cp @@ -137,6 +137,7 @@ MODULE DswCompilerCPfrontMain; ELSIF p = "-no-hints" THEN EXCL(opts, hint) ELSIF p = "-trap" THEN + Kernel.intTrap := TRUE; INCL(opts, errorTrap) ELSIF p = "-no-trap" THEN EXCL(opts, errorTrap) @@ -334,5 +335,6 @@ MODULE DswCompilerCPfrontMain; END Init; BEGIN + Kernel.intTrap := FALSE; Kernel.Start(Init) END DswCompilerCPfrontMain. diff --git a/src/generic/Dsw/Mod/Linker486Main.cp b/src/generic/Dsw/Mod/Linker486Main.cp index 27997e2..677681f 100644 --- a/src/generic/Dsw/Mod/Linker486Main.cp +++ b/src/generic/Dsw/Mod/Linker486Main.cp @@ -103,7 +103,8 @@ MODULE DswLinker486Main; inobj.next := obj; INC(i) ELSIF p = "-trap" THEN - LB.trap := TRUE + LB.trap := TRUE; + Kernel.intTrap := TRUE ELSE Console.WriteStr("unknown option "); Console.WriteStr(p); Console.WriteLn; @@ -255,5 +256,6 @@ MODULE DswLinker486Main; END Init; BEGIN + Kernel.intTrap := FALSE; Kernel.Start(Init) END DswLinker486Main. diff --git a/src/native/linux/486/System/Mod/Kernel.cp b/src/native/linux/486/System/Mod/Kernel.cp index 115a773..4c8688e 100644 --- a/src/native/linux/486/System/Mod/Kernel.cp +++ b/src/native/linux/486/System/Mod/Kernel.cp @@ -237,7 +237,9 @@ MODULE Kernel; wouldFinalize: BOOLEAN; - watcher*: PROCEDURE (event: INTEGER); (* for debugging *) + watcher*: PROCEDURE (event: INTEGER); (* for debugging *) + + intTrap*: BOOLEAN; PROCEDURE Erase (adr, words: INTEGER); BEGIN @@ -1563,7 +1565,7 @@ MODULE Kernel; IF isTry THEN setjmp._longjmp(tryEnv, 1) END; - IF err = 128 THEN (* do nothing *) + IF (err = 128) OR (err = 200) & ~intTrap THEN (* do nothing *) ELSIF (trapViewer # NIL) & (restart # NIL) & ~trapped & ~guarded THEN trapped := TRUE; trapViewer() ELSE DefaultTrapViewer @@ -1637,7 +1639,7 @@ MODULE Kernel; IF isTry THEN setjmp._longjmp(tryEnv, 1) END; - IF err = 128 THEN (* do nothing *) + IF (err = 128) OR (err = 200) & ~intTrap THEN (* do nothing *) ELSIF (trapViewer # NIL) & (restart # NIL) & ~trapped & ~guarded THEN trapped := TRUE; trapViewer() ELSE DefaultTrapViewer @@ -1676,6 +1678,7 @@ MODULE Kernel; PROCEDURE Init; VAR i: INTEGER; BEGIN + intTrap := TRUE; pagesize := unistd.sysconf(unistd._SC_PAGESIZE); (* init heap *) diff --git a/src/native/posix/generic/System/Mod/Kernel.cp b/src/native/posix/generic/System/Mod/Kernel.cp index 5773b4e..2039e17 100644 --- a/src/native/posix/generic/System/Mod/Kernel.cp +++ b/src/native/posix/generic/System/Mod/Kernel.cp @@ -237,7 +237,9 @@ MODULE Kernel; wouldFinalize: BOOLEAN; - watcher*: PROCEDURE (event: INTEGER); (* for debugging *) + watcher*: PROCEDURE (event: INTEGER); (* for debugging *) + + intTrap*: BOOLEAN; PROCEDURE Erase (adr, words: INTEGER); BEGIN @@ -1566,7 +1568,7 @@ MODULE Kernel; IF isTry THEN setjmp._longjmp(tryEnv, 1) END; - IF err = 128 THEN (* do nothing *) + IF (err = 128) OR (err = 200) & ~intTrap THEN (* do nothing *) ELSIF (trapViewer # NIL) & (restart # NIL) & ~trapped & ~guarded THEN trapped := TRUE; trapViewer() ELSE DefaultTrapViewer @@ -1625,7 +1627,7 @@ MODULE Kernel; IF isTry THEN setjmp._longjmp(tryEnv, 1) END; - IF err = 128 THEN (* do nothing *) + IF (err = 128) OR (err = 200) & ~intTrap THEN (* do nothing *) ELSIF (trapViewer # NIL) & (restart # NIL) & ~trapped & ~guarded THEN trapped := TRUE; trapViewer() ELSE DefaultTrapViewer @@ -1664,6 +1666,7 @@ MODULE Kernel; PROCEDURE Init; VAR i: INTEGER; BEGIN + intTrap := TRUE; pagesize := unistd.sysconf(unistd._SC_PAGESIZE); (* init heap *)