diff options
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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 | */ |
564 | static int isinstack (CallInfo *ci, const TValue *o) { | 564 | static 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 | } |