MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaG_traceexec

Function luaG_traceexec

third-party/lua-5.3.5/src/ldebug.c:666–698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664
665
666void luaG_traceexec (lua_State *L) {
667 CallInfo *ci = L->ci;
668 lu_byte mask = L->hookmask;
669 int counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT));
670 if (counthook)
671 resethookcount(L); /* reset count */
672 else if (!(mask & LUA_MASKLINE))
673 return; /* no line hook and count != 0; nothing to be done */
674 if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */
675 ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */
676 return; /* do not call hook again (VM yielded, so it did not move) */
677 }
678 if (counthook)
679 luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */
680 if (mask & LUA_MASKLINE) {
681 Proto *p = ci_func(ci)->p;
682 int npc = pcRel(ci->u.l.savedpc, p);
683 int newline = getfuncline(p, npc);
684 if (npc == 0 || /* call linehook when enter a new function, */
685 ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */
686 newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */
687 luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */
688 }
689 L->oldpc = ci->u.l.savedpc;
690 if (L->status == LUA_YIELD) { /* did hook yield? */
691 if (counthook)
692 L->hookcount = 1; /* undo decrement to zero */
693 ci->u.l.savedpc--; /* undo increment (resume will increment it again) */
694 ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */
695 ci->func = L->top - 1; /* protect stack below results */
696 luaD_throw(L, LUA_YIELD);
697 }
698}
699

Callers

nothing calls this directly

Calls 2

luaD_hookFunction · 0.70
luaD_throwFunction · 0.70

Tested by

no test coverage detected