diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-07-07 10:37:56 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-07-07 10:37:56 -0300 |
commit | f52f357a5576aad0794e4c46b86bba5c75ddcf3d (patch) | |
tree | c194594121d90269065f68e6cf08677b2d7ba3f8 /lvm.c | |
parent | 79fee990241bc29c9306d7cee655653ff88b3d0c (diff) | |
download | lua-f52f357a5576aad0794e4c46b86bba5c75ddcf3d.tar.gz lua-f52f357a5576aad0794e4c46b86bba5c75ddcf3d.tar.bz2 lua-f52f357a5576aad0794e4c46b86bba5c75ddcf3d.zip |
correct handling when a thread turns on line hooks in another thread
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.286 2003/05/13 20:15:59 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.287 2003/05/14 12:09:12 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 | */ |
@@ -76,13 +76,15 @@ static void traceexec (lua_State *L) { | |||
76 | if (mask & LUA_MASKLINE) { | 76 | if (mask & LUA_MASKLINE) { |
77 | CallInfo *ci = L->ci; | 77 | CallInfo *ci = L->ci; |
78 | Proto *p = ci_func(ci)->l.p; | 78 | Proto *p = ci_func(ci)->l.p; |
79 | int newline = getline(p, pcRel(*ci->u.l.pc, p)); | 79 | int pc = pcRel(*ci->u.l.pc, p); |
80 | int newline = getline(p, pc); | ||
80 | if (!L->hookinit) { | 81 | if (!L->hookinit) { |
81 | luaG_inithooks(L); | 82 | luaG_inithooks(L); |
82 | return; | 83 | if (pc != 0) /* not function start? */ |
84 | return; /* begin tracing on next line */ | ||
83 | } | 85 | } |
84 | lua_assert(ci->state & CI_HASFRAME); | 86 | lua_assert(ci->state & CI_HASFRAME); |
85 | if (pcRel(*ci->u.l.pc, p) == 0) /* tracing may be starting now? */ | 87 | if (pc == 0) /* function may be starting now? */ |
86 | ci->u.l.savedpc = *ci->u.l.pc; /* initialize `savedpc' */ | 88 | ci->u.l.savedpc = *ci->u.l.pc; /* initialize `savedpc' */ |
87 | /* calls linehook when enters a new line or jumps back (loop) */ | 89 | /* calls linehook when enters a new line or jumps back (loop) */ |
88 | if (*ci->u.l.pc <= ci->u.l.savedpc || | 90 | if (*ci->u.l.pc <= ci->u.l.savedpc || |