diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-06-05 16:36:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-06-05 16:36:45 -0300 |
commit | a62fca1ebb0798676a11c5bda2406e36de654b6e (patch) | |
tree | c0825f2fbbb9a58b5ff204f976bbe36756d15fff /bugs | |
parent | 2b5c1f99e52fd725b3c3c58d80596dbb4a342da2 (diff) | |
download | lua-a62fca1ebb0798676a11c5bda2406e36de654b6e.tar.gz lua-a62fca1ebb0798676a11c5bda2406e36de654b6e.tar.bz2 lua-a62fca1ebb0798676a11c5bda2406e36de654b6e.zip |
BUG: debug hooks may get wrong when mixed with coroutines
Diffstat (limited to 'bugs')
-rw-r--r-- | bugs | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -974,3 +974,42 @@ lgc.c: | |||
974 | + g->estimate -= GCFINALIZECOST; | 974 | + g->estimate -= GCFINALIZECOST; |
975 | ]] | 975 | ]] |
976 | } | 976 | } |
977 | |||
978 | |||
979 | But{ | ||
980 | |||
981 | what = [[debug hooks may get wrong when mixed with coroutines]], | ||
982 | |||
983 | report = [[by Ivko Stanilov, 03/06/2006]], | ||
984 | |||
985 | example = [[ | ||
986 | co = coroutine.create(function (a,b) | ||
987 | coroutine.yield(a, b) | ||
988 | return b, "end" | ||
989 | end) | ||
990 | |||
991 | debug.sethook(co, function() end, "lcr") | ||
992 | coroutine.resume(co, 100, 2000) | ||
993 | coroutine.resume(co, 100, 2000) | ||
994 | ]], | ||
995 | |||
996 | patch = [[ | ||
997 | * ldo.c: | ||
998 | @@ -389,6 +389,7 @@ | ||
999 | return; | ||
1000 | } | ||
1001 | else { /* resuming from previous yield */ | ||
1002 | + L->status = 0; | ||
1003 | if (!f_isLua(ci)) { /* `common' yield? */ | ||
1004 | /* finish interrupted execution of `OP_CALL' */ | ||
1005 | lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || | ||
1006 | @@ -399,7 +400,6 @@ | ||
1007 | else /* yielded inside a hook: just continue its execution */ | ||
1008 | L->base = L->ci->base; | ||
1009 | } | ||
1010 | - L->status = 0; | ||
1011 | luaV_execute(L, cast_int(L->ci - L->base_ci)); | ||
1012 | } | ||
1013 | ]], | ||
1014 | |||
1015 | } | ||