diff options
| -rw-r--r-- | ldebug.c | 13 |
1 files changed, 6 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.84 2011/08/12 20:01:44 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.85 2011/09/13 17:40:20 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 | */ |
| @@ -385,16 +385,15 @@ static const char *getobjname (Proto *p, int lastpc, int reg, | |||
| 385 | OpCode op = GET_OPCODE(i); | 385 | OpCode op = GET_OPCODE(i); |
| 386 | switch (op) { | 386 | switch (op) { |
| 387 | case OP_MOVE: { | 387 | case OP_MOVE: { |
| 388 | int a = GETARG_A(i); | ||
| 389 | int b = GETARG_B(i); /* move from 'b' to 'a' */ | 388 | int b = GETARG_B(i); /* move from 'b' to 'a' */ |
| 390 | lua_assert(reg == a); | 389 | if (b < GETARG_A(i)) |
| 391 | if (b < a) | ||
| 392 | return getobjname(p, pc, b, name); /* get name for 'b' */ | 390 | return getobjname(p, pc, b, name); /* get name for 'b' */ |
| 391 | break; | ||
| 393 | } | 392 | } |
| 394 | case OP_GETTABUP: | 393 | case OP_GETTABUP: |
| 395 | case OP_GETTABLE: { | 394 | case OP_GETTABLE: { |
| 396 | int k = GETARG_C(i); /* key index */ | 395 | int k = GETARG_C(i); /* key index */ |
| 397 | int t = GETARG_B(i); | 396 | int t = GETARG_B(i); /* table index */ |
| 398 | const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ | 397 | const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ |
| 399 | ? luaF_getlocalname(p, t + 1, pc) | 398 | ? luaF_getlocalname(p, t + 1, pc) |
| 400 | : upvalname(p, t); | 399 | : upvalname(p, t); |
| @@ -402,8 +401,7 @@ static const char *getobjname (Proto *p, int lastpc, int reg, | |||
| 402 | return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; | 401 | return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; |
| 403 | } | 402 | } |
| 404 | case OP_GETUPVAL: { | 403 | case OP_GETUPVAL: { |
| 405 | int u = GETARG_B(i); /* upvalue index */ | 404 | *name = upvalname(p, GETARG_B(i)); |
| 406 | *name = upvalname(p, u); | ||
| 407 | return "upvalue"; | 405 | return "upvalue"; |
| 408 | } | 406 | } |
| 409 | case OP_LOADK: | 407 | case OP_LOADK: |
| @@ -414,6 +412,7 @@ static const char *getobjname (Proto *p, int lastpc, int reg, | |||
| 414 | *name = svalue(&p->k[b]); | 412 | *name = svalue(&p->k[b]); |
| 415 | return "constant"; | 413 | return "constant"; |
| 416 | } | 414 | } |
| 415 | break; | ||
| 417 | } | 416 | } |
| 418 | case OP_SELF: { | 417 | case OP_SELF: { |
| 419 | int k = GETARG_C(i); /* key index */ | 418 | int k = GETARG_C(i); /* key index */ |
