summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 89b25c3)
raw | patch | inline | side by side (parent: 89b25c3)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 3 Sep 2017 13:59:13 +0000 (16:59 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 3 Sep 2017 13:59:41 +0000 (16:59 +0300) |
src/engine/e_log.pas | patch | blob | history | |
src/game/Doom2DF.dpr | patch | blob | history | |
src/game/g_console.pas | patch | blob | history |
diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas
index 937730d5d4fd822260f19fbbe9d42861c8ef4192..ed4cfe525f4479957cca8754c690a99be9f64b4c 100644 (file)
--- a/src/engine/e_log.pas
+++ b/src/engine/e_log.pas
procedure e_LogWriteln (const s: AnsiString; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true);
+procedure e_WriteStackTrace (const msg: AnsiString);
+
+
var
e_WriteToStdOut: Boolean = False;
end;
+{$I-}
+procedure e_WriteStackTrace (const msg: AnsiString);
+var
+ tfo: TextFile;
+begin
+ e_LogWriteln(msg, MSG_FATALERROR);
+ if (Length(FileName) > 0) then
+ begin
+ if xlogFileOpened then CloseFile(xlogFile);
+ xlogFileOpened := false;
+ AssignFile(tfo, FileName);
+ Append(tfo);
+ if (IOResult <> 0) then Rewrite(tfo);
+ if (IOResult = 0) then begin writeln(tfo, '====================='); DumpExceptionBackTrace(tfo); CloseFile(tfo); end;
+ end;
+end;
+
+
procedure e_DeinitLog ();
begin
if xlogFileOpened then CloseFile(xlogFile);
diff --git a/src/game/Doom2DF.dpr b/src/game/Doom2DF.dpr
index a66e792b6e38d9f44e537b7ac95d34254e571787..a47b72d1db22465bab5092fbcc08ba1400e3a82b 100644 (file)
--- a/src/game/Doom2DF.dpr
+++ b/src/game/Doom2DF.dpr
var
f: Integer;
noct: Boolean = false;
+ tfo: Text;
begin
for f := 1 to ParamCount do
begin
Main();
e_WriteLog('Shutdown with no errors.', MSG_NOTIFY);
except
- on E: Exception do
- e_WriteLog(Format(_lc[I_SYSTEM_ERROR_MSG], [E.Message]), MSG_FATALERROR);
+ on e: Exception do
+ begin
+ e_WriteStackTrace(e.message);
+ //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_MSG], [E.Message]), MSG_FATALERROR);
+ AssignFile(tfo, GameDir+'/trace.log');
+ {$I-}
+ Append(tfo);
+ if (IOResult <> 0) then Rewrite(tfo);
+ if (IOResult = 0) then begin writeln(tfo, '====================='); DumpExceptionBackTrace(tfo); CloseFile(tfo); end;
+ end
else
- e_WriteLog(Format(_lc[I_SYSTEM_ERROR_UNKNOWN], [NativeUInt(ExceptAddr())]), MSG_FATALERROR);
+ begin
+ //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_UNKNOWN], [NativeUInt(ExceptAddr())]), MSG_FATALERROR);
+ e_WriteStackTrace('FATAL ERROR');
+ end;
end;
end;
e_DeinitLog();
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 6cd897c6d6992237ceedbab3105922cd0f5b2e65..b62a7e186c920d98b873e8c6eaebcd6f26d0292c 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
cp.cheat := acheat;
end;
+
+procedure segfault (p: SArray);
+var
+ pp: PByte = nil;
+begin
+ pp^ := 0;
+end;
+
+
procedure g_Console_Init();
var
a: Integer;
Time := 0;
end;
+ AddCommand('segfault', segfault, 'make segfault');
+
AddCommand('clear', ConsoleCommands, 'clear console');
AddCommand('clearhistory', ConsoleCommands);
AddCommand('showhistory', ConsoleCommands);
g_Console_Add(Format(_lc[I_CONSOLE_UNKNOWN], [Arr[0]]));
end;
+
end.