diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.223 2002/03/25 17:47:14 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.224 2002/04/09 19:47:44 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -64,15 +64,16 @@ int luaV_tostring (lua_State *L, TObject *obj) { | |||
64 | 64 | ||
65 | static void traceexec (lua_State *L) { | 65 | static void traceexec (lua_State *L) { |
66 | CallInfo *ci = L->ci; | 66 | CallInfo *ci = L->ci; |
67 | int *lineinfo = ci_func(ci)->l.p->lineinfo; | 67 | Proto *p = ci_func(ci)->l.p; |
68 | int pc = cast(int, *ci->pc - ci_func(ci)->l.p->code) - 1; | 68 | int newline = p->lineinfo[pcRel(*ci->pc, p)]; |
69 | int newline = lineinfo[pc]; | 69 | if (pcRel(*ci->pc, p) == 0) /* tracing may be starting now? */ |
70 | if (pc == 0) /* tracing may be starting now? */ | 70 | ci->savedpc = *ci->pc; /* initialize `savedpc' */ |
71 | ci->lastpc = 0; /* initialize `lastpc' */ | ||
72 | /* calls linehook when enters a new line or jumps back (loop) */ | 71 | /* calls linehook when enters a new line or jumps back (loop) */ |
73 | if (pc <= ci->lastpc || newline != lineinfo[ci->lastpc]) | 72 | if (*ci->pc <= ci->savedpc || newline != p->lineinfo[pcRel(ci->savedpc, p)]) { |
74 | luaD_lineHook(L, newline); | 73 | luaD_lineHook(L, newline); |
75 | L->ci->lastpc = pc; | 74 | ci = L->ci; /* previous call may reallocate `ci' */ |
75 | } | ||
76 | ci->savedpc = *ci->pc; | ||
76 | } | 77 | } |
77 | 78 | ||
78 | 79 | ||