aboutsummaryrefslogtreecommitdiff
path: root/src/lj_err.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_err.c')
-rw-r--r--src/lj_err.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/lj_err.c b/src/lj_err.c
index b0143c5a..2b021d28 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -129,7 +129,7 @@ static BCLine currentline(lua_State *L, GCfunc *fn, cTValue *nextframe)
129 if (pc != ~(BCPos)0) { 129 if (pc != ~(BCPos)0) {
130 GCproto *pt = funcproto(fn); 130 GCproto *pt = funcproto(fn);
131 lua_assert(pc < pt->sizebc); 131 lua_assert(pc < pt->sizebc);
132 return proto_lineinfo(pt) ? proto_line(pt, pc) : 0; 132 return proto_line(pt, pc);
133 } else { 133 } else {
134 return -1; 134 return -1;
135 } 135 }
@@ -138,9 +138,10 @@ static BCLine currentline(lua_State *L, GCfunc *fn, cTValue *nextframe)
138static const char *getvarname(const GCproto *pt, BCPos pc, BCReg slot) 138static const char *getvarname(const GCproto *pt, BCPos pc, BCReg slot)
139{ 139{
140 MSize i; 140 MSize i;
141 for (i = 0; i < pt->sizevarinfo && proto_varinfo(pt)[i].startpc <= pc; i++) 141 VarInfo *vi = proto_varinfo(pt);
142 if (pc < proto_varinfo(pt)[i].endpc && slot-- == 0) 142 for (i = 0; i < pt->sizevarinfo && vi[i].startpc <= pc; i++)
143 return strdata(gco2str(gcref(proto_varinfo(pt)[i].name))); 143 if (pc < vi[i].endpc && slot-- == 0)
144 return strdata(gco2str(gcref(vi[i].name)));
144 return NULL; 145 return NULL;
145} 146}
146 147
@@ -176,8 +177,7 @@ restart:
176 } 177 }
177 return "field"; 178 return "field";
178 case BC_UGET: 179 case BC_UGET:
179 *name = mref(pt->uvname, GCRef) ? 180 *name = strdata(proto_uvname(pt, bc_d(ins)));
180 strdata(gco2str(proto_uvname(pt,bc_d(ins)))) : "?";
181 return "upvalue"; 181 return "upvalue";
182 default: 182 default:
183 return NULL; 183 return NULL;
@@ -224,7 +224,7 @@ void lj_err_pushloc(lua_State *L, GCproto *pt, BCPos pc)
224 MSize i, len = name->len; 224 MSize i, len = name->len;
225 BCLine line; 225 BCLine line;
226 if (pc) 226 if (pc)
227 line = proto_lineinfo(pt) ? proto_line(pt, pc-1) : 0; 227 line = proto_line(pt, pc-1);
228 else 228 else
229 line = pt->linedefined; 229 line = pt->linedefined;
230 if (*s == '@') { 230 if (*s == '@') {
@@ -377,12 +377,11 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
377 case 'L': 377 case 'L':
378 if (isluafunc(fn)) { 378 if (isluafunc(fn)) {
379 GCtab *t = lj_tab_new(L, 0, 0); 379 GCtab *t = lj_tab_new(L, 0, 0);
380 BCLine *lineinfo = proto_lineinfo(funcproto(fn)); 380 GCproto *pt = funcproto(fn);
381 if (lineinfo) { 381 BCLine *lineinfo = proto_lineinfo(pt);
382 uint32_t i, szl = funcproto(fn)->sizelineinfo; 382 MSize i, szl = pt->sizebc;
383 for (i = 0; i < szl; i++) 383 for (i = 0; i < szl; i++)
384 setboolV(lj_tab_setint(L, t, lineinfo[i]), 1); 384 setboolV(lj_tab_setint(L, t, lineinfo[i]), 1);
385 }
386 settabV(L, L->top, t); 385 settabV(L, L->top, t);
387 } else { 386 } else {
388 setnilV(L->top); 387 setnilV(L->top);