Bug 398531 : Fixed error with LuaJIT 2.0 without 5.2 compatibility

Current debugging logic was based on the assumption that
coroutine.running()
can return main thread, which is the case only when LuaJIT is compiled
with LUAJIT_ENABLE_LUA52COMPAT. Now the debugger can be started on the
top of user code, just like with regular 5.1 (with some modifications
due
to different tail call handling)
Bug 396930: Prevent global access that may trigger metamethods
Bug 396930,379965: Continue program execution when debug socket closes