lua

A copy of the Lua development repository
Log | Files | Refs | README

commit ad5dcdcf0f1e139c8cc5b1aafd11db69f54010de
parent de9128d09d55318f81d58fc8933ef180885c8850
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 31 Oct 2017 15:13:35 -0200

detail: in 'isinstack', check against the whole stack instead
of against the stack frame

Diffstat:
Mldebug.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ldebug.c b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 2.131 2017/10/04 15:49:24 roberto Exp roberto $ +** $Id: ldebug.c,v 2.132 2017/10/04 21:56:32 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -627,10 +627,10 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci, ** not ISO C, but it should not crash a program; the subsequent ** checks are ISO C and ensure a correct result. */ -static int isinstack (CallInfo *ci, const TValue *o) { - StkId base = ci->func + 1; +static int isinstack (lua_State *L, const TValue *o) { + StkId base = L->stack; ptrdiff_t i = cast(StkId, o) - base; - return (0 <= i && i < (ci->top - base) && s2v(base + i) == o); + return (0 <= i && i < (L->top - base) && s2v(base + i) == o); } @@ -659,7 +659,7 @@ static const char *varinfo (lua_State *L, const TValue *o) { const char *kind = NULL; if (isLua(ci)) { kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ - if (!kind && isinstack(ci, o)) /* no? try a register */ + if (!kind && isinstack(L, o)) /* no? try a register */ kind = getobjname(ci_func(ci)->p, currentpc(ci), cast_int(cast(StkId, o) - (ci->func + 1)), &name); }