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

Function traceexec

third-party/lua-5.2.4/src/lvm.c:60–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60static void traceexec (lua_State *L) {
61 CallInfo *ci = L->ci;
62 lu_byte mask = L->hookmask;
63 int counthook = ((mask & LUA_MASKCOUNT) && L->hookcount == 0);
64 if (counthook)
65 resethookcount(L); /* reset count */
66 if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */
67 ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */
68 return; /* do not call hook again (VM yielded, so it did not move) */
69 }
70 if (counthook)
71 luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */
72 if (mask & LUA_MASKLINE) {
73 Proto *p = ci_func(ci)->p;
74 int npc = pcRel(ci->u.l.savedpc, p);
75 int newline = getfuncline(p, npc);
76 if (npc == 0 || /* call linehook when enter a new function, */
77 ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */
78 newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */
79 luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */
80 }
81 L->oldpc = ci->u.l.savedpc;
82 if (L->status == LUA_YIELD) { /* did hook yield? */
83 if (counthook)
84 L->hookcount = 1; /* undo decrement to zero */
85 ci->u.l.savedpc--; /* undo increment (resume will increment it again) */
86 ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */
87 ci->func = L->top - 1; /* protect stack below results */
88 luaD_throw(L, LUA_YIELD);
89 }
90}
91
92
93static void callTM (lua_State *L, const TValue *f, const TValue *p1,

Callers 1

luaV_executeFunction · 0.70

Calls 2

luaD_hookFunction · 0.70
luaD_throwFunction · 0.70

Tested by

no test coverage detected