Zeex / samp-plugin-crashdetect

Crash/error reporting plugin for SA-MP server
http://forum.sa-mp.com/showthread.php?t=262796
BSD 2-Clause "Simplified" License
116 stars 23 forks source link

Address naught write detection #105

Closed Y-Less closed 2 years ago

Y-Less commented 2 years ago

Adds detection for writing to address 0 (not always an error) and flags to control it.:

# Address Naught

Often writing to address naught is a mistake, it indicates that some target address is unset,
especially in larger modes.  `address_naught` mode detects all writes to this address and gives a
new (to VM) error in that case - `AMX_ERR_ADDRESS_0`.  Note that this isn't always an error, it is a
valid address and real data can be stored there, so if this detection is enabled the mode must
ensure that nothing important will be written there (fixes.inc does this by defining and not using
the anonymous automata).

## Functions

There are several functions in the include to use these tests:

* `DisableCrashDetectAddr0();` - Disable address naught write detection in this mode.
* `EnableCrashDetectAddr0();` - Enable address naught write detection in this mode.
* `bool:IsCrashDetectAddr0Enabled();` - Is the error currently enabled?
* `bool:HasCrashDetectAddr0();` - Does the current version of crashdetect support this feature?

This also cleaned up some other register uses.