diff options
Diffstat (limited to 'src/lj_err.c')
-rw-r--r-- | src/lj_err.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lj_err.c b/src/lj_err.c index 2b021d28..fdc06001 100644 --- a/src/lj_err.c +++ b/src/lj_err.c | |||
@@ -152,7 +152,7 @@ static const char *getobjname(GCproto *pt, const BCIns *ip, BCReg slot, | |||
152 | restart: | 152 | restart: |
153 | lname = getvarname(pt, proto_bcpos(pt, ip), slot); | 153 | lname = getvarname(pt, proto_bcpos(pt, ip), slot); |
154 | if (lname != NULL) { *name = lname; return "local"; } | 154 | if (lname != NULL) { *name = lname; return "local"; } |
155 | while (--ip >= proto_bc(pt)) { | 155 | while (--ip > proto_bc(pt)) { |
156 | BCIns ins = *ip; | 156 | BCIns ins = *ip; |
157 | BCOp op = bc_op(ins); | 157 | BCOp op = bc_op(ins); |
158 | BCReg ra = bc_a(ins); | 158 | BCReg ra = bc_a(ins); |
@@ -222,11 +222,7 @@ void lj_err_pushloc(lua_State *L, GCproto *pt, BCPos pc) | |||
222 | if (name) { | 222 | if (name) { |
223 | const char *s = strdata(name); | 223 | const char *s = strdata(name); |
224 | MSize i, len = name->len; | 224 | MSize i, len = name->len; |
225 | BCLine line; | 225 | BCLine line = pc < pt->sizebc ? proto_line(pt, pc) : 0; |
226 | if (pc) | ||
227 | line = proto_line(pt, pc-1); | ||
228 | else | ||
229 | line = pt->linedefined; | ||
230 | if (*s == '@') { | 226 | if (*s == '@') { |
231 | s++; len--; | 227 | s++; len--; |
232 | for (i = len; i > 0; i--) | 228 | for (i = len; i > 0; i--) |
@@ -345,9 +341,10 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar) | |||
345 | switch (*what) { | 341 | switch (*what) { |
346 | case 'S': | 342 | case 'S': |
347 | if (isluafunc(fn)) { | 343 | if (isluafunc(fn)) { |
348 | ar->source = strdata(proto_chunkname(funcproto(fn))); | 344 | GCproto *pt = funcproto(fn); |
349 | ar->linedefined = cast_int(funcproto(fn)->linedefined); | 345 | ar->source = strdata(proto_chunkname(pt)); |
350 | ar->lastlinedefined = cast_int(funcproto(fn)->lastlinedefined); | 346 | ar->linedefined = (int)proto_line(pt, 0); |
347 | ar->lastlinedefined = (int)pt->lastlinedefined; | ||
351 | ar->what = (ar->linedefined == 0) ? "main" : "Lua"; | 348 | ar->what = (ar->linedefined == 0) ? "main" : "Lua"; |
352 | } else { | 349 | } else { |
353 | ar->source = "=[C]"; | 350 | ar->source = "=[C]"; |
@@ -380,7 +377,7 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar) | |||
380 | GCproto *pt = funcproto(fn); | 377 | GCproto *pt = funcproto(fn); |
381 | BCLine *lineinfo = proto_lineinfo(pt); | 378 | BCLine *lineinfo = proto_lineinfo(pt); |
382 | MSize i, szl = pt->sizebc; | 379 | MSize i, szl = pt->sizebc; |
383 | for (i = 0; i < szl; i++) | 380 | for (i = 1; i < szl; i++) |
384 | setboolV(lj_tab_setint(L, t, lineinfo[i]), 1); | 381 | setboolV(lj_tab_setint(L, t, lineinfo[i]), 1); |
385 | settabV(L, L->top, t); | 382 | settabV(L, L->top, t); |
386 | } else { | 383 | } else { |