diff options
| -rw-r--r-- | ldebug.c | 15 |
1 files changed, 8 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.141 2017/11/07 17:20:42 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.142 2017/11/08 14:50:23 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 | */ |
| @@ -754,15 +754,16 @@ void luaG_traceexec (lua_State *L) { | |||
| 754 | luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ | 754 | luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ |
| 755 | if (mask & LUA_MASKLINE) { | 755 | if (mask & LUA_MASKLINE) { |
| 756 | Proto *p = ci_func(ci)->p; | 756 | Proto *p = ci_func(ci)->p; |
| 757 | int npc = pcRel(ci->u.l.savedpc, p); | 757 | const Instruction *npc = ci->u.l.savedpc; |
| 758 | if (npc == 0 || /* call linehook when enter a new function, */ | 758 | int npci = pcRel(npc, p); |
| 759 | ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ | 759 | if (npci == 0 || /* call linehook when enter a new function, */ |
| 760 | changedline(p, pcRel(L->oldpc, p), npc)) { /* enter new line */ | 760 | npc <= L->oldpc || /* when jump back (loop), or when */ |
| 761 | int newline = luaG_getfuncline(p, npc); /* new line */ | 761 | changedline(p, pcRel(L->oldpc, p), npci)) { /* enter new line */ |
| 762 | int newline = luaG_getfuncline(p, npci); /* new line */ | ||
| 762 | luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ | 763 | luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ |
| 763 | } | 764 | } |
| 765 | L->oldpc = npc; | ||
| 764 | } | 766 | } |
| 765 | L->oldpc = ci->u.l.savedpc; | ||
| 766 | if (L->status == LUA_YIELD) { /* did hook yield? */ | 767 | if (L->status == LUA_YIELD) { /* did hook yield? */ |
| 767 | if (counthook) | 768 | if (counthook) |
| 768 | L->hookcount = 1; /* undo decrement to zero */ | 769 | L->hookcount = 1; /* undo decrement to zero */ |
