diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-10-31 15:14:02 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-10-31 15:14:02 -0200 |
commit | ad5dcdcf0f1e139c8cc5b1aafd11db69f54010de (patch) | |
tree | 9a0660e3f4f911e873e164e606f75a9436d43bdf /ldebug.c | |
parent | de9128d09d55318f81d58fc8933ef180885c8850 (diff) | |
download | lua-ad5dcdcf0f1e139c8cc5b1aafd11db69f54010de.tar.gz lua-ad5dcdcf0f1e139c8cc5b1aafd11db69f54010de.tar.bz2 lua-ad5dcdcf0f1e139c8cc5b1aafd11db69f54010de.zip |
detail: in 'isinstack', check against the whole stack instead
of against the stack frame
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.131 2017/10/04 15:49:24 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.132 2017/10/04 21:56:32 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 | */ |
@@ -627,10 +627,10 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci, | |||
627 | ** not ISO C, but it should not crash a program; the subsequent | 627 | ** not ISO C, but it should not crash a program; the subsequent |
628 | ** checks are ISO C and ensure a correct result. | 628 | ** checks are ISO C and ensure a correct result. |
629 | */ | 629 | */ |
630 | static int isinstack (CallInfo *ci, const TValue *o) { | 630 | static int isinstack (lua_State *L, const TValue *o) { |
631 | StkId base = ci->func + 1; | 631 | StkId base = L->stack; |
632 | ptrdiff_t i = cast(StkId, o) - base; | 632 | ptrdiff_t i = cast(StkId, o) - base; |
633 | return (0 <= i && i < (ci->top - base) && s2v(base + i) == o); | 633 | return (0 <= i && i < (L->top - base) && s2v(base + i) == o); |
634 | } | 634 | } |
635 | 635 | ||
636 | 636 | ||
@@ -659,7 +659,7 @@ static const char *varinfo (lua_State *L, const TValue *o) { | |||
659 | const char *kind = NULL; | 659 | const char *kind = NULL; |
660 | if (isLua(ci)) { | 660 | if (isLua(ci)) { |
661 | kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ | 661 | kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ |
662 | if (!kind && isinstack(ci, o)) /* no? try a register */ | 662 | if (!kind && isinstack(L, o)) /* no? try a register */ |
663 | kind = getobjname(ci_func(ci)->p, currentpc(ci), | 663 | kind = getobjname(ci_func(ci)->p, currentpc(ci), |
664 | cast_int(cast(StkId, o) - (ci->func + 1)), &name); | 664 | cast_int(cast(StkId, o) - (ci->func + 1)), &name); |
665 | } | 665 | } |