From fa26d294aef136aa4ec48c23b4b87b853df0e3da Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 16 Jul 2003 17:49:02 -0300 Subject: new way to control `pc' of running functions --- ldebug.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index bc7f9237..e7413507 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 1.153 2003/05/14 12:09:12 roberto Exp roberto $ +** $Id: ldebug.c,v 1.154 2003/07/10 11:59:06 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -30,14 +30,8 @@ static const char *getfuncname (CallInfo *ci, const char **name); -#define isLua(ci) (!((ci)->state & CI_C)) - - static int currentpc (CallInfo *ci) { if (!isLua(ci)) return -1; /* function is not a Lua function? */ - if (ci->state & CI_HASFRAME) /* function has a frame? */ - ci->u.l.savedpc = *ci->u.l.pc; /* use `pc' from there */ - /* function's pc is saved */ return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); } @@ -51,14 +45,6 @@ static int currentline (CallInfo *ci) { } -void luaG_inithooks (lua_State *L) { - CallInfo *ci; - for (ci = L->ci; ci != L->base_ci; ci--) /* update all `savedpc's */ - currentpc(ci); - L->hookinit = 1; -} - - /* ** this function can be called asynchronous (e.g. during a signal) */ @@ -71,7 +57,6 @@ LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { L->basehookcount = count; resethookcount(L); L->hookmask = cast(lu_byte, mask); - L->hookinit = 0; return 1; } @@ -97,7 +82,7 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { lua_lock(L); for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { level--; - if (!(ci->state & CI_C)) /* Lua function? */ + if (f_isLua(ci)) /* Lua function? */ level -= ci->u.l.tailcalls; /* skip lost tail calls */ } if (level > 0 || ci == L->base_ci) status = 0; /* there is no such level */ -- cgit v1.2.3-55-g6feb