aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-05-13 10:54:47 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-05-13 10:54:47 -0300
commit6d95de83c644da5f720cf468c38df9782f1c890d (patch)
tree734170c5082ae1e44ad9fe69d85b167fd4d07207 /ldebug.c
parent5c8770f8969a73cf4ca503f54c2217f76de62e04 (diff)
downloadlua-6d95de83c644da5f720cf468c38df9782f1c890d.tar.gz
lua-6d95de83c644da5f720cf468c38df9782f1c890d.tar.bz2
lua-6d95de83c644da5f720cf468c38df9782f1c890d.zip
no more field 'base' in CallInfo (base is always equal to 'func + 1',
with old/new vararg implementation)
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ldebug.c b/ldebug.c
index 776b05eb..4193cda8 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.124 2017/04/29 15:28:38 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.125 2017/05/13 13:04:33 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -136,7 +136,7 @@ static const char *findlocal (lua_State *L, CallInfo *ci, int n,
136 const char *name = NULL; 136 const char *name = NULL;
137 StkId base; 137 StkId base;
138 if (isLua(ci)) { 138 if (isLua(ci)) {
139 base = ci->u.l.base; 139 base = ci->func + 1;
140 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); 140 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
141 } 141 }
142 else 142 else
@@ -562,8 +562,9 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
562** checks are ISO C and ensure a correct result. 562** checks are ISO C and ensure a correct result.
563*/ 563*/
564static int isinstack (CallInfo *ci, const TValue *o) { 564static int isinstack (CallInfo *ci, const TValue *o) {
565 ptrdiff_t i = o - ci->u.l.base; 565 StkId base = ci->func + 1;
566 return (0 <= i && i < (ci->top - ci->u.l.base) && ci->u.l.base + i == o); 566 ptrdiff_t i = o - base;
567 return (0 <= i && i < (ci->top - base) && base + i == o);
567} 568}
568 569
569 570
@@ -594,7 +595,7 @@ static const char *varinfo (lua_State *L, const TValue *o) {
594 kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ 595 kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */
595 if (!kind && isinstack(ci, o)) /* no? try a register */ 596 if (!kind && isinstack(ci, o)) /* no? try a register */
596 kind = getobjname(ci_func(ci)->p, currentpc(ci), 597 kind = getobjname(ci_func(ci)->p, currentpc(ci),
597 cast_int(o - ci->u.l.base), &name); 598 cast_int(o - (ci->func + 1)), &name);
598 } 599 }
599 return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; 600 return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : "";
600} 601}