diff options
Diffstat (limited to 'ldo.c')
| -rw-r--r-- | ldo.c | 9 |
1 files changed, 5 insertions, 4 deletions
| @@ -331,6 +331,7 @@ void luaD_hook (lua_State *L, int event, int line, | |||
| 331 | ** active. | 331 | ** active. |
| 332 | */ | 332 | */ |
| 333 | void luaD_hookcall (lua_State *L, CallInfo *ci) { | 333 | void luaD_hookcall (lua_State *L, CallInfo *ci) { |
| 334 | L->oldpc = 0; /* set 'oldpc' for new function */ | ||
| 334 | if (L->hookmask & LUA_MASKCALL) { /* is call hook on? */ | 335 | if (L->hookmask & LUA_MASKCALL) { /* is call hook on? */ |
| 335 | int event = (ci->callstatus & CIST_TAIL) ? LUA_HOOKTAILCALL | 336 | int event = (ci->callstatus & CIST_TAIL) ? LUA_HOOKTAILCALL |
| 336 | : LUA_HOOKCALL; | 337 | : LUA_HOOKCALL; |
| @@ -343,9 +344,9 @@ void luaD_hookcall (lua_State *L, CallInfo *ci) { | |||
| 343 | 344 | ||
| 344 | 345 | ||
| 345 | /* | 346 | /* |
| 346 | ** Executes a call hook for Lua and C functions. This function is called | 347 | ** Executes a return hook for Lua and C functions and sets/corrects |
| 347 | ** whenever 'hookmask' is not zero, so it checks whether return hooks are | 348 | ** 'oldpc'. (Note that this correction is needed by the line hook, so it |
| 348 | ** active. | 349 | ** is done even when return hooks are off.) |
| 349 | */ | 350 | */ |
| 350 | static void rethook (lua_State *L, CallInfo *ci, int nres) { | 351 | static void rethook (lua_State *L, CallInfo *ci, int nres) { |
| 351 | if (L->hookmask & LUA_MASKRET) { /* is return hook on? */ | 352 | if (L->hookmask & LUA_MASKRET) { /* is return hook on? */ |
| @@ -363,7 +364,7 @@ static void rethook (lua_State *L, CallInfo *ci, int nres) { | |||
| 363 | ci->func -= delta; | 364 | ci->func -= delta; |
| 364 | } | 365 | } |
| 365 | if (isLua(ci = ci->previous)) | 366 | if (isLua(ci = ci->previous)) |
| 366 | L->oldpc = pcRel(ci->u.l.savedpc, ci_func(ci)->p); /* update 'oldpc' */ | 367 | L->oldpc = pcRel(ci->u.l.savedpc, ci_func(ci)->p); /* set 'oldpc' */ |
| 367 | } | 368 | } |
| 368 | 369 | ||
| 369 | 370 | ||
