Fixed debug trap code

- Made sure we only do a minimal include for the Windows headers.
- Guard using the standard WIN32 instead of PLATFORM_WINDOWS
- Added debug trap support for gcc-based platforms.