Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch segfaults from using action instead of safeaction #36

Open
alochmann opened this issue Jan 17, 2021 · 3 comments
Open

Catch segfaults from using action instead of safeaction #36

alochmann opened this issue Jan 17, 2021 · 3 comments

Comments

@alochmann
Copy link
Contributor

Enigma segfaults on certain level input, e.g. objects that destroy themselves on their own actions (like opals) or callback functions.

It is extremely complicated (maybe impossible) to catch all possible ways levels can cause segfaults. However, we should at least try.

segvcatch is a cross-platform library that transforms SIGSEGV and other signals into exceptions:
https://github.com/Plaristote/segvcatch
The idea would be to just show a meaningful error message, in the case of SIGSEGV with a hint to safeaction, and unconditionally quit afterwards (do not try to recover -- repair the faulty level code instead).

@double-a
Copy link

Some time ago I was using a method obtained from http://tlug.up.ac.za/wiki/index.php/Obtaining_a_stack_trace_in_C_upon_SIGSEGV
and using it via

export LD_PRELOAD=/usr/local/lib/segv_handler.so
./enigma

Any sample level to create a reproducible error?

@alochmann
Copy link
Contributor Author

Hi,
maybe "Frogger" is a suitable test level. It is broken right now, and it is broken due to using action instead of safeaction on a hidden trigger, deleting the very boulder that just triggered the trigger. This might not be best example however, because it does not cause a segfault (at least not for me), and might actually be a regular bug in the code instead.

@alochmann
Copy link
Contributor Author

Here is another idea (just writing this down as a memo to myself, actually): Introduce a flag "i-am-active-please-dont-delete-me" high in the object hierarchy, and add a check on this flag in the destructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants