From e14a02c24f22ff03bba4a0582f56d7af518339df Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 6 Oct 2014 14:06:49 -0300 Subject: [PATCH] when thread yields, real "func" is in field 'extra', not in 'func' --- ltests.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ltests.c b/ltests.c index 9057cde3..4fa105dd 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 2.185 2014/09/04 18:15:29 roberto Exp roberto $ +** $Id: ltests.c,v 2.186 2014/10/01 11:54:56 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -280,10 +280,14 @@ static void checkLclosure (global_State *g, LClosure *cl) { } -static int lua_checkpc (CallInfo *ci) { +static int lua_checkpc (lua_State *L, CallInfo *ci) { if (!isLua(ci)) return 1; else { - Proto *p = ci_func(ci)->p; + Proto *p; + if (L->status != LUA_YIELD || ci != L->ci) + p = ci_func(ci)->p; + else /* real 'func' was saved in 'extra' field */ + p = clLvalue(restorestack(L, ci->extra))->p; return p->code <= ci->u.l.savedpc && ci->u.l.savedpc <= p->code + p->sizecode; } @@ -299,7 +303,7 @@ static void checkstack (global_State *g, lua_State *L1) { lua_assert(upisopen(uv)); /* must be open */ for (ci = L1->ci; ci != NULL; ci = ci->previous) { lua_assert(ci->top <= L1->stack_last); - lua_assert(lua_checkpc(ci)); + lua_assert(lua_checkpc(L1, ci)); } if (L1->stack) { for (o = L1->stack; o < L1->top; o++)