aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/ltests.c b/ltests.c
index 94b4cd31..d05fc3b1 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.225 2017/10/04 21:56:32 roberto Exp roberto $ 2** $Id: ltests.c,v 2.226 2017/11/01 18:20:48 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -309,13 +309,10 @@ static void checkLclosure (global_State *g, LClosure *cl) {
309} 309}
310 310
311 311
312static int lua_checkpc (lua_State *L, CallInfo *ci) { 312static int lua_checkpc (CallInfo *ci) {
313 if (!isLua(ci)) return 1; 313 if (!isLua(ci)) return 1;
314 else { 314 else {
315 /* if function yielded (inside a hook), real 'func' is in 'extra' field */ 315 StkId f = ci->func;
316 StkId f = (L->status != LUA_YIELD || ci != L->ci)
317 ? ci->func
318 : restorestack(L, ci->extra);
319 Proto *p = clLvalue(s2v(f))->p; 316 Proto *p = clLvalue(s2v(f))->p;
320 return p->code <= ci->u.l.savedpc && 317 return p->code <= ci->u.l.savedpc &&
321 ci->u.l.savedpc <= p->code + p->sizecode; 318 ci->u.l.savedpc <= p->code + p->sizecode;
@@ -332,7 +329,7 @@ static void checkstack (global_State *g, lua_State *L1) {
332 lua_assert(upisopen(uv)); /* must be open */ 329 lua_assert(upisopen(uv)); /* must be open */
333 for (ci = L1->ci; ci != NULL; ci = ci->previous) { 330 for (ci = L1->ci; ci != NULL; ci = ci->previous) {
334 lua_assert(ci->top <= L1->stack_last); 331 lua_assert(ci->top <= L1->stack_last);
335 lua_assert(lua_checkpc(L1, ci)); 332 lua_assert(lua_checkpc(ci));
336 } 333 }
337 if (L1->stack) { /* complete thread? */ 334 if (L1->stack) { /* complete thread? */
338 for (o = L1->stack; o < L1->stack_last + EXTRA_STACK; o++) 335 for (o = L1->stack; o < L1->stack_last + EXTRA_STACK; o++)
@@ -1411,7 +1408,8 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
1411 } 1408 }
1412 else if EQ("resume") { 1409 else if EQ("resume") {
1413 int i = getindex; 1410 int i = getindex;
1414 status = lua_resume(lua_tothread(L1, i), L, getnum); 1411 int nres;
1412 status = lua_resume(lua_tothread(L1, i), L, getnum, &nres);
1415 } 1413 }
1416 else if EQ("return") { 1414 else if EQ("return") {
1417 int n = getnum; 1415 int n = getnum;
@@ -1616,10 +1614,10 @@ static int sethook (lua_State *L) {
1616 1614
1617 1615
1618static int coresume (lua_State *L) { 1616static int coresume (lua_State *L) {
1619 int status; 1617 int status, nres;
1620 lua_State *co = lua_tothread(L, 1); 1618 lua_State *co = lua_tothread(L, 1);
1621 luaL_argcheck(L, co, 1, "coroutine expected"); 1619 luaL_argcheck(L, co, 1, "coroutine expected");
1622 status = lua_resume(co, L, 0); 1620 status = lua_resume(co, L, 0, &nres);
1623 if (status != LUA_OK && status != LUA_YIELD) { 1621 if (status != LUA_OK && status != LUA_YIELD) {
1624 lua_pushboolean(L, 0); 1622 lua_pushboolean(L, 0);
1625 lua_insert(L, -2); 1623 lua_insert(L, -2);