added missing cases for debug info about tag methods +

better error message for bitwise operators
This commit is contained in:
Roberto Ierusalimschy 2014-11-10 12:46:46 -02:00
parent ad20689feb
commit 9212175ffb
1 changed files with 20 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ldebug.c,v 2.103 2014/11/02 19:19:04 roberto Exp roberto $ ** $Id: ldebug.c,v 2.104 2014/11/02 19:33:33 roberto Exp roberto $
** Debug Interface ** Debug Interface
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -451,24 +451,26 @@ static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
return "for iterator"; return "for iterator";
} }
/* all other instructions can call only through metamethods */ /* all other instructions can call only through metamethods */
case OP_SELF: case OP_SELF: case OP_GETTABUP: case OP_GETTABLE:
case OP_GETTABUP: tm = TM_INDEX;
case OP_GETTABLE: tm = TM_INDEX; break; break;
case OP_SETTABUP: case OP_SETTABUP: case OP_SETTABLE:
case OP_SETTABLE: tm = TM_NEWINDEX; break; tm = TM_NEWINDEX;
case OP_EQ: tm = TM_EQ; break; break;
case OP_ADD: tm = TM_ADD; break; case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD:
case OP_SUB: tm = TM_SUB; break; case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND:
case OP_MUL: tm = TM_MUL; break; case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: {
case OP_DIV: tm = TM_DIV; break; int offset = cast_int(GET_OPCODE(i)) - cast_int(OP_ADD); /* ORDER OP */
case OP_IDIV: tm = TM_IDIV; break; tm = cast(TMS, offset + cast_int(TM_ADD)); /* ORDER TM */
case OP_MOD: tm = TM_MOD; break; break;
case OP_POW: tm = TM_POW; break; }
case OP_UNM: tm = TM_UNM; break; case OP_UNM: tm = TM_UNM; break;
case OP_BNOT: tm = TM_BNOT; break;
case OP_LEN: tm = TM_LEN; break; case OP_LEN: tm = TM_LEN; break;
case OP_CONCAT: tm = TM_CONCAT; break;
case OP_EQ: tm = TM_EQ; break;
case OP_LT: tm = TM_LT; break; case OP_LT: tm = TM_LT; break;
case OP_LE: tm = TM_LE; break; case OP_LE: tm = TM_LE; break;
case OP_CONCAT: tm = TM_CONCAT; break;
default: default:
return NULL; /* else no useful name can be found */ return NULL; /* else no useful name can be found */
} }
@ -532,11 +534,12 @@ l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) {
} }
l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { l_noret luaG_opinterror (lua_State *L, const TValue *p1,
const TValue *p2, const char *msg) {
lua_Number temp; lua_Number temp;
if (!tonumber(p1, &temp)) /* first operand is wrong? */ if (!tonumber(p1, &temp)) /* first operand is wrong? */
p2 = p1; /* now second is wrong */ p2 = p1; /* now second is wrong */
luaG_typeerror(L, p2, "perform arithmetic on"); luaG_typeerror(L, p2, msg);
} }