samp-plugin-jit
samp-plugin-jit copied to clipboard
Crashes
Could it be possible to prevent errors from killing the whole server (similar to the default behavior)? Instead of crashing and shutting down, just halt execution of the current callback.
Having int3 breakpoints in BOUNDS opcodes and such would also be nice, but that's a separate thing.
It might be possible indeed, I imagine it would be something like this:
- Set a crash handler (SetUnhandledExceptionFilter / SIGSEGV handler similar to crashdetect)
- Figure out the AMX that caused the crash by looking at EIP inside the crash context
- Get
reset_ebpandreset_espfrom the runtime info block (RIB) - Reset the stack
- Jump to the return address stored on the stack
Related to this issue: division by zero causes a crash which could be prevented by a simple check and raising AMX_ERR_DIVIDE.