From 45af139bfc7713ed4eb237ac1f5288e82706564c Mon Sep 17 00:00:00 2001
From: Ketmar Dark <ketmar@ketmar.no-ip.org>
Date: Sat, 16 Apr 2016 18:53:38 +0300
Subject: [PATCH] added "--gdb" cli arg to stop df from eating exceptions

---
 src/game/Doom2DF.dpr | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/game/Doom2DF.dpr b/src/game/Doom2DF.dpr
index df5de45..6796156 100644
--- a/src/game/Doom2DF.dpr
+++ b/src/game/Doom2DF.dpr
@@ -95,14 +95,21 @@ uses
   {$R CustomRes.res}
 {$ENDIF}
 
+var
+  f: Integer;
+  noct: Boolean = false;
 begin
-  try
-    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);
-    else
-      e_WriteLog(Format(_lc[I_SYSTEM_ERROR_UNKNOWN], [LongWord(ExceptAddr())]), MSG_FATALERROR);
-  end;
+  for f := 1 to ParamCount do if ParamStr(f) = '--gdb' then noct := true;
+  if noct then
+    Main()
+  else
+    try
+      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);
+      else
+        e_WriteLog(Format(_lc[I_SYSTEM_ERROR_UNKNOWN], [LongWord(ExceptAddr())]), MSG_FATALERROR);
+    end;
 end.
-- 
2.29.2