diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-12 14:23:12 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-12 14:23:12 -0300 |
| commit | 8e4ac679ffce4a2d59b0a404473275411854f598 (patch) | |
| tree | 8758db19adc160f2366d40f2d39287611a3d4279 /ldebug.c | |
| parent | 221b5be7b78dc401d4fac49df534f7ff68c04d58 (diff) | |
| download | lua-8e4ac679ffce4a2d59b0a404473275411854f598.tar.gz lua-8e4ac679ffce4a2d59b0a404473275411854f598.tar.bz2 lua-8e4ac679ffce4a2d59b0a404473275411854f598.zip | |
use a linear count for count hook
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 13 |
1 files changed, 5 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.130 2002/08/07 19:22:39 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.131 2002/08/08 20:08:41 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -33,11 +33,8 @@ static const char *getfuncname (CallInfo *ci, const char **name); | |||
| 33 | 33 | ||
| 34 | static int currentpc (CallInfo *ci) { | 34 | static int currentpc (CallInfo *ci) { |
| 35 | if (!isLua(ci)) return -1; /* function is not a Lua function? */ | 35 | if (!isLua(ci)) return -1; /* function is not a Lua function? */ |
| 36 | if (!(ci->state & CI_SAVEDPC)) { /* savedpc outdated? */ | 36 | if (ci->state & CI_HASFRAME) /* function has a frame? */ |
| 37 | lua_assert(ci->state & CI_HASFRAME); | 37 | ci->u.l.savedpc = *ci->u.l.pc; /* use `pc' from there */ |
| 38 | ci->u.l.savedpc = *ci->u.l.pc; | ||
| 39 | ci->state |= CI_SAVEDPC; | ||
| 40 | } | ||
| 41 | /* function's pc is saved */ | 38 | /* function's pc is saved */ |
| 42 | return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); | 39 | return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); |
| 43 | } | 40 | } |
| @@ -52,7 +49,7 @@ static int currentline (CallInfo *ci) { | |||
| 52 | } | 49 | } |
| 53 | 50 | ||
| 54 | 51 | ||
| 55 | LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask) { | 52 | LUA_API int lua_sethook (lua_State *L, lua_Hook func, unsigned long mask) { |
| 56 | int allow; | 53 | int allow; |
| 57 | CallInfo *ci; | 54 | CallInfo *ci; |
| 58 | lua_lock(L); | 55 | lua_lock(L); |
| @@ -75,7 +72,7 @@ LUA_API lua_Hook lua_gethook (lua_State *L) { | |||
| 75 | } | 72 | } |
| 76 | 73 | ||
| 77 | 74 | ||
| 78 | LUA_API int lua_gethookmask (lua_State *L) { | 75 | LUA_API unsigned long lua_gethookmask (lua_State *L) { |
| 79 | return L->hookmask; | 76 | return L->hookmask; |
| 80 | } | 77 | } |
| 81 | 78 | ||
