diff options
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 41 |
1 files changed, 25 insertions, 16 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.122 2002/06/20 20:39:44 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.123 2002/06/24 15:07:21 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 | */ |
| @@ -53,26 +53,31 @@ static int currentline (lua_State *L, CallInfo *ci) { | |||
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func) { | 56 | LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask) { |
| 57 | lua_Hook oldhook; | ||
| 58 | lua_lock(L); | ||
| 59 | oldhook = L->callhook; | ||
| 60 | L->callhook = func; | ||
| 61 | lua_unlock(L); | ||
| 62 | return oldhook; | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func) { | ||
| 67 | CallInfo *ci; | 57 | CallInfo *ci; |
| 68 | lua_Hook oldhook; | 58 | int allow; |
| 69 | lua_lock(L); | 59 | lua_lock(L); |
| 70 | oldhook = L->linehook; | 60 | allow = allowhook(L); |
| 71 | L->linehook = func; | 61 | if (func == NULL) mask = 0; |
| 62 | else if (mask == 0) func = NULL; | ||
| 63 | L->hook = func; | ||
| 64 | L->hookmask = mask; | ||
| 65 | setallowhook(L, allow); | ||
| 66 | resethookcount(L); | ||
| 72 | for (ci = L->base_ci; ci <= L->ci; ci++) | 67 | for (ci = L->base_ci; ci <= L->ci; ci++) |
| 73 | currentpc(L, ci); /* update `savedpc' */ | 68 | currentpc(L, ci); /* update `savedpc' */ |
| 74 | lua_unlock(L); | 69 | lua_unlock(L); |
| 75 | return oldhook; | 70 | return 1; |
| 71 | } | ||
| 72 | |||
| 73 | |||
| 74 | LUA_API lua_Hook lua_gethook (lua_State *L) { | ||
| 75 | return L->hook; | ||
| 76 | } | ||
| 77 | |||
| 78 | |||
| 79 | LUA_API int lua_gethookmask (lua_State *L) { | ||
| 80 | return L->hookmask; | ||
| 76 | } | 81 | } |
| 77 | 82 | ||
| 78 | 83 | ||
| @@ -396,6 +401,10 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 396 | return pt->code[last]; | 401 | return pt->code[last]; |
| 397 | } | 402 | } |
| 398 | 403 | ||
| 404 | #undef check | ||
| 405 | #undef checkjump | ||
| 406 | #undef checkreg | ||
| 407 | |||
| 399 | /* }====================================================== */ | 408 | /* }====================================================== */ |
| 400 | 409 | ||
| 401 | 410 | ||
