** Traces Lua calls. If code is running the first instruction of a function, ** and function is not vararg, and it is not coming from an yield, ** calls 'luaD_hookcall'. (Vararg functions will call 'luaD_hookcall' ** after adjusting its variable arguments; otherwise, they could call ** a line/count hook before the call hook. Functions coming from ** an yield already called 'luaD_hookcall' before y
| 908 | ** an yield already called 'luaD_hookcall' before yielding.) |
| 909 | */ |
| 910 | int luaG_tracecall (lua_State *L) { |
| 911 | CallInfo *ci = L->ci; |
| 912 | Proto *p = ci_func(ci)->p; |
| 913 | ci->u.l.trap = 1; /* ensure hooks will be checked */ |
| 914 | if (ci->u.l.savedpc == p->code) { /* first instruction (not resuming)? */ |
| 915 | if (isvararg(p)) |
| 916 | return 0; /* hooks will start at VARARGPREP instruction */ |
| 917 | else if (!(ci->callstatus & CIST_HOOKYIELD)) /* not yielded? */ |
| 918 | luaD_hookcall(L, ci); /* check 'call' hook */ |
| 919 | } |
| 920 | return 1; /* keep 'trap' on */ |
| 921 | } |
| 922 | |
| 923 | |
| 924 | /* |
no test coverage detected