samp-plugin-jit icon indicating copy to clipboard operation
samp-plugin-jit copied to clipboard

Crashes

Open oscar-broman opened this issue 10 years ago • 2 comments

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.

oscar-broman avatar Sep 17 '15 16:09 oscar-broman

It might be possible indeed, I imagine it would be something like this:

  1. Set a crash handler (SetUnhandledExceptionFilter / SIGSEGV handler similar to crashdetect)
  2. Figure out the AMX that caused the crash by looking at EIP inside the crash context
  3. Get reset_ebp and reset_esp from the runtime info block (RIB)
  4. Reset the stack
  5. Jump to the return address stored on the stack

Zeex avatar Sep 18 '15 17:09 Zeex

Related to this issue: division by zero causes a crash which could be prevented by a simple check and raising AMX_ERR_DIVIDE.

IS4Code avatar Sep 01 '19 10:09 IS4Code