Here we encountered a dead-loop issue caused by 'while' statement .
We have a solution that set a lua hook of instruction count. For every 100000 instructions we print a stack backtrace. (debug.sethook() and debug.traceback())
for example, if we find following stack traces take place many times. we figure out that the Dead-loop is in function D.
This is a positive method because it checks dead-loop every some steps.
However, a hook which prints stacktrace hurts performance. We need a passive detection method.
When a dead-loop occurs, we attach a gdb to that process and it probably break at luaV_execute.
How to trace lua's stack in GDB (according to lua_State *L in luaV_execute). Is there a ready-made gdb script???