diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-11-10 12:46:46 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-11-10 12:46:46 -0200 |
commit | 9212175ffb5db7f3281a51529521dd870ce81041 (patch) | |
tree | 0bb0426b658a42ab650e8517853730cd60098270 /ldebug.c | |
parent | ad20689febfe15e20c9bce6bb74459f169499524 (diff) | |
download | lua-9212175ffb5db7f3281a51529521dd870ce81041.tar.gz lua-9212175ffb5db7f3281a51529521dd870ce81041.tar.bz2 lua-9212175ffb5db7f3281a51529521dd870ce81041.zip |
added missing cases for debug info about tag methods +
better error message for bitwise operators
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 37 |
1 files changed, 20 insertions, 17 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.103 2014/11/02 19:19:04 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.104 2014/11/02 19:33:33 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 | */ |
@@ -451,24 +451,26 @@ static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { | |||
451 | return "for iterator"; | 451 | return "for iterator"; |
452 | } | 452 | } |
453 | /* all other instructions can call only through metamethods */ | 453 | /* all other instructions can call only through metamethods */ |
454 | case OP_SELF: | 454 | case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: |
455 | case OP_GETTABUP: | 455 | tm = TM_INDEX; |
456 | case OP_GETTABLE: tm = TM_INDEX; break; | 456 | break; |
457 | case OP_SETTABUP: | 457 | case OP_SETTABUP: case OP_SETTABLE: |
458 | case OP_SETTABLE: tm = TM_NEWINDEX; break; | 458 | tm = TM_NEWINDEX; |
459 | case OP_EQ: tm = TM_EQ; break; | 459 | break; |
460 | case OP_ADD: tm = TM_ADD; break; | 460 | case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: |
461 | case OP_SUB: tm = TM_SUB; break; | 461 | case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: |
462 | case OP_MUL: tm = TM_MUL; break; | 462 | case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { |
463 | case OP_DIV: tm = TM_DIV; break; | 463 | int offset = cast_int(GET_OPCODE(i)) - cast_int(OP_ADD); /* ORDER OP */ |
464 | case OP_IDIV: tm = TM_IDIV; break; | 464 | tm = cast(TMS, offset + cast_int(TM_ADD)); /* ORDER TM */ |
465 | case OP_MOD: tm = TM_MOD; break; | 465 | break; |
466 | case OP_POW: tm = TM_POW; break; | 466 | } |
467 | case OP_UNM: tm = TM_UNM; break; | 467 | case OP_UNM: tm = TM_UNM; break; |
468 | case OP_BNOT: tm = TM_BNOT; break; | ||
468 | case OP_LEN: tm = TM_LEN; break; | 469 | case OP_LEN: tm = TM_LEN; break; |
470 | case OP_CONCAT: tm = TM_CONCAT; break; | ||
471 | case OP_EQ: tm = TM_EQ; break; | ||
469 | case OP_LT: tm = TM_LT; break; | 472 | case OP_LT: tm = TM_LT; break; |
470 | case OP_LE: tm = TM_LE; break; | 473 | case OP_LE: tm = TM_LE; break; |
471 | case OP_CONCAT: tm = TM_CONCAT; break; | ||
472 | default: | 474 | default: |
473 | return NULL; /* else no useful name can be found */ | 475 | return NULL; /* else no useful name can be found */ |
474 | } | 476 | } |
@@ -532,11 +534,12 @@ l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { | |||
532 | } | 534 | } |
533 | 535 | ||
534 | 536 | ||
535 | l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { | 537 | l_noret luaG_opinterror (lua_State *L, const TValue *p1, |
538 | const TValue *p2, const char *msg) { | ||
536 | lua_Number temp; | 539 | lua_Number temp; |
537 | if (!tonumber(p1, &temp)) /* first operand is wrong? */ | 540 | if (!tonumber(p1, &temp)) /* first operand is wrong? */ |
538 | p2 = p1; /* now second is wrong */ | 541 | p2 = p1; /* now second is wrong */ |
539 | luaG_typeerror(L, p2, "perform arithmetic on"); | 542 | luaG_typeerror(L, p2, msg); |
540 | } | 543 | } |
541 | 544 | ||
542 | 545 | ||