diff options
| -rw-r--r-- | bugs | 73 |
1 files changed, 71 insertions, 2 deletions
| @@ -1880,8 +1880,8 @@ patch = [[ | |||
| 1880 | +++ lundump.c 2008/04/04 19:51:41 2.7.1.4 | 1880 | +++ lundump.c 2008/04/04 19:51:41 2.7.1.4 |
| 1881 | @@ -1,5 +1,5 @@ | 1881 | @@ -1,5 +1,5 @@ |
| 1882 | /* | 1882 | /* |
| 1883 | -** $Id: bugs,v 1.122 2013/05/06 17:21:28 roberto Exp roberto $ | 1883 | -** $Id: bugs,v 1.123 2013/05/13 16:17:47 roberto Exp roberto $ |
| 1884 | +** $Id: bugs,v 1.122 2013/05/06 17:21:28 roberto Exp roberto $ | 1884 | +** $Id: bugs,v 1.123 2013/05/13 16:17:47 roberto Exp roberto $ |
| 1885 | ** load precompiled Lua chunks | 1885 | ** load precompiled Lua chunks |
| 1886 | ** See Copyright Notice in lua.h | 1886 | ** See Copyright Notice in lua.h |
| 1887 | */ | 1887 | */ |
| @@ -2953,6 +2953,75 @@ stdin:1: attempt to call a boolean value (global 'c') | |||
| 2953 | (It should be global 'b' instead of 'c'.) | 2953 | (It should be global 'b' instead of 'c'.) |
| 2954 | ]], | 2954 | ]], |
| 2955 | patch = [[ | 2955 | patch = [[ |
| 2956 | --- ldebug.c 2013/05/06 17:20:22 2.90.1.2 | ||
| 2957 | +++ ldebug.c 2013/05/14 19:52:48 | ||
| 2958 | @@ -327,12 +327,20 @@ | ||
| 2959 | } | ||
| 2960 | |||
| 2961 | |||
| 2962 | +static int filterpc (int pc, int jmptarget) { | ||
| 2963 | + if (pc < jmptarget) /* is code conditional (inside a jump)? */ | ||
| 2964 | + return -1; /* cannot know who sets that register */ | ||
| 2965 | + else return pc; /* current position sets that register */ | ||
| 2966 | +} | ||
| 2967 | + | ||
| 2968 | + | ||
| 2969 | /* | ||
| 2970 | ** try to find last instruction before 'lastpc' that modified register 'reg' | ||
| 2971 | */ | ||
| 2972 | static int findsetreg (Proto *p, int lastpc, int reg) { | ||
| 2973 | int pc; | ||
| 2974 | int setreg = -1; /* keep last instruction that changed 'reg' */ | ||
| 2975 | + int jmptarget = 0; /* any code before this address is conditional */ | ||
| 2976 | for (pc = 0; pc < lastpc; pc++) { | ||
| 2977 | Instruction i = p->code[pc]; | ||
| 2978 | OpCode op = GET_OPCODE(i); | ||
| 2979 | @@ -341,33 +349,38 @@ | ||
| 2980 | case OP_LOADNIL: { | ||
| 2981 | int b = GETARG_B(i); | ||
| 2982 | if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ | ||
| 2983 | - setreg = pc; | ||
| 2984 | + setreg = filterpc(pc, jmptarget); | ||
| 2985 | break; | ||
| 2986 | } | ||
| 2987 | case OP_TFORCALL: { | ||
| 2988 | - if (reg >= a + 2) setreg = pc; /* affect all regs above its base */ | ||
| 2989 | + if (reg >= a + 2) /* affect all regs above its base */ | ||
| 2990 | + setreg = filterpc(pc, jmptarget); | ||
| 2991 | break; | ||
| 2992 | } | ||
| 2993 | case OP_CALL: | ||
| 2994 | case OP_TAILCALL: { | ||
| 2995 | - if (reg >= a) setreg = pc; /* affect all registers above base */ | ||
| 2996 | + if (reg >= a) /* affect all registers above base */ | ||
| 2997 | + setreg = filterpc(pc, jmptarget); | ||
| 2998 | break; | ||
| 2999 | } | ||
| 3000 | case OP_JMP: { | ||
| 3001 | int b = GETARG_sBx(i); | ||
| 3002 | int dest = pc + 1 + b; | ||
| 3003 | /* jump is forward and do not skip `lastpc'? */ | ||
| 3004 | - if (pc < dest && dest <= lastpc) | ||
| 3005 | - pc += b; /* do the jump */ | ||
| 3006 | + if (pc < dest && dest <= lastpc) { | ||
| 3007 | + if (dest > jmptarget) | ||
| 3008 | + jmptarget = dest; /* update 'jmptarget' */ | ||
| 3009 | + } | ||
| 3010 | break; | ||
| 3011 | } | ||
| 3012 | case OP_TEST: { | ||
| 3013 | - if (reg == a) setreg = pc; /* jumped code can change 'a' */ | ||
| 3014 | + if (reg == a) /* jumped code can change 'a' */ | ||
| 3015 | + setreg = filterpc(pc, jmptarget); | ||
| 3016 | break; | ||
| 3017 | } | ||
| 3018 | default: | ||
| 3019 | if (testAMode(op) && reg == a) /* any instruction that set A */ | ||
| 3020 | - setreg = pc; | ||
| 3021 | + setreg = filterpc(pc, jmptarget); | ||
| 3022 | break; | ||
| 3023 | } | ||
| 3024 | } | ||
| 2956 | ]] | 3025 | ]] |
| 2957 | } | 3026 | } |
| 2958 | 3027 | ||
