enigma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Enigma-devel] crashes on linux gcc exception handling


From: Ronald Lamprecht
Subject: [Enigma-devel] crashes on linux gcc exception handling
Date: Sun, 24 Sep 2006 12:45:00 +0200
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Hi,

after solving our Windows gcc crashes Andreas did report another problem that results in crashes on Linux and likely on Mac, too. (Windows is not affected as our workaround solves this problem on the fly)

Enigma's engine throws C++ "XRuntime" exceptions on errors during execution of a level. They should be caught and the level should be aborted with an error message instead a crash of Enigma.

These exceptions can occur anywhere in the engine and with the switch from the old fashioned "assert", that did cause an app crash either way, to exception based "ASSERT"-macros we did increase the likelyhood of exceptions.

If such a runtime exception is thrown with C longjump-based Lua frames on the execution stack the C++ exception will not unwind to the catch statement but crash the app within gcc internal code (f.e. the appended diff causes all levels with triggers to throw exceptions on load).

This behaviour may be within some gcc specs or it may be a bug. But it is at least very annoying.

In general there are two Enigma internal solutions:

1. write an own unwind that catches all C++ exceptions before returning via Lua and rethrow the exceptions after returnung to C++.

2. switch Lua to C++ for Linux and other OS, too

As approach 1. means a lot of work and would force a rewrite of all tolua based code I would prefer the second solution.

Is anyone aware of other solutions? Does anyone object solution 2?

- Ronald
Index: src/items.cc
===================================================================
--- src/items.cc        (revision 302)
+++ src/items.cc        (working copy)
@@ -1315,6 +1315,7 @@
 
 void Trigger::init_model()
 {
+    ASSERT(0, XLevelRuntime, "Assert did not fail.");
     if (int_attrib("invisible"))
         set_model("invisible");
     else if (m_pressedp)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]