diff options
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -182,7 +182,7 @@ static const char *upvalname (const Proto *p, int uv) { | |||
182 | 182 | ||
183 | 183 | ||
184 | static const char *findvararg (CallInfo *ci, int n, StkId *pos) { | 184 | static const char *findvararg (CallInfo *ci, int n, StkId *pos) { |
185 | if (clLvalue(s2v(ci->func.p))->p->is_vararg) { | 185 | if (clLvalue(s2v(ci->func.p))->p->flag & PF_ISVARARG) { |
186 | int nextra = ci->u.l.nextraargs; | 186 | int nextra = ci->u.l.nextraargs; |
187 | if (n >= -nextra) { /* 'n' is negative */ | 187 | if (n >= -nextra) { /* 'n' is negative */ |
188 | *pos = ci->func.p - nextra - (n + 1); | 188 | *pos = ci->func.p - nextra - (n + 1); |
@@ -264,8 +264,7 @@ static void funcinfo (lua_Debug *ar, Closure *cl) { | |||
264 | else { | 264 | else { |
265 | const Proto *p = cl->l.p; | 265 | const Proto *p = cl->l.p; |
266 | if (p->source) { | 266 | if (p->source) { |
267 | ar->source = getstr(p->source); | 267 | ar->source = getlstr(p->source, ar->srclen); |
268 | ar->srclen = tsslen(p->source); | ||
269 | } | 268 | } |
270 | else { | 269 | else { |
271 | ar->source = "=?"; | 270 | ar->source = "=?"; |
@@ -301,7 +300,7 @@ static void collectvalidlines (lua_State *L, Closure *f) { | |||
301 | sethvalue2s(L, L->top.p, t); /* push it on stack */ | 300 | sethvalue2s(L, L->top.p, t); /* push it on stack */ |
302 | api_incr_top(L); | 301 | api_incr_top(L); |
303 | setbtvalue(&v); /* boolean 'true' to be the value of all indices */ | 302 | setbtvalue(&v); /* boolean 'true' to be the value of all indices */ |
304 | if (!p->is_vararg) /* regular function? */ | 303 | if (!(p->flag & PF_ISVARARG)) /* regular function? */ |
305 | i = 0; /* consider all instructions */ | 304 | i = 0; /* consider all instructions */ |
306 | else { /* vararg function */ | 305 | else { /* vararg function */ |
307 | lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP); | 306 | lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP); |
@@ -344,7 +343,7 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, | |||
344 | ar->nparams = 0; | 343 | ar->nparams = 0; |
345 | } | 344 | } |
346 | else { | 345 | else { |
347 | ar->isvararg = f->l.p->is_vararg; | 346 | ar->isvararg = f->l.p->flag & PF_ISVARARG; |
348 | ar->nparams = f->l.p->numparams; | 347 | ar->nparams = f->l.p->numparams; |
349 | } | 348 | } |
350 | break; | 349 | break; |
@@ -812,8 +811,11 @@ l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { | |||
812 | const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, | 811 | const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, |
813 | int line) { | 812 | int line) { |
814 | char buff[LUA_IDSIZE]; | 813 | char buff[LUA_IDSIZE]; |
815 | if (src) | 814 | if (src) { |
816 | luaO_chunkid(buff, getstr(src), tsslen(src)); | 815 | size_t idlen; |
816 | const char *id = getlstr(src, idlen); | ||
817 | luaO_chunkid(buff, id, idlen); | ||
818 | } | ||
817 | else { /* no source available; use "?" instead */ | 819 | else { /* no source available; use "?" instead */ |
818 | buff[0] = '?'; buff[1] = '\0'; | 820 | buff[0] = '?'; buff[1] = '\0'; |
819 | } | 821 | } |
@@ -893,7 +895,7 @@ int luaG_tracecall (lua_State *L) { | |||
893 | Proto *p = ci_func(ci)->p; | 895 | Proto *p = ci_func(ci)->p; |
894 | ci->u.l.trap = 1; /* ensure hooks will be checked */ | 896 | ci->u.l.trap = 1; /* ensure hooks will be checked */ |
895 | if (ci->u.l.savedpc == p->code) { /* first instruction (not resuming)? */ | 897 | if (ci->u.l.savedpc == p->code) { /* first instruction (not resuming)? */ |
896 | if (p->is_vararg) | 898 | if (p->flag & PF_ISVARARG) |
897 | return 0; /* hooks will start at VARARGPREP instruction */ | 899 | return 0; /* hooks will start at VARARGPREP instruction */ |
898 | else if (!(ci->callstatus & CIST_HOOKYIELD)) /* not yieded? */ | 900 | else if (!(ci->callstatus & CIST_HOOKYIELD)) /* not yieded? */ |
899 | luaD_hookcall(L, ci); /* check 'call' hook */ | 901 | luaD_hookcall(L, ci); /* check 'call' hook */ |