aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldebug.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/ldebug.c b/ldebug.c
index 8a36e2f8..ead16794 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.122 2017/04/26 17:46:52 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.123 2017/04/28 20:57:45 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*/
@@ -398,39 +398,37 @@ static int findsetreg (Proto *p, int lastpc, int reg) {
398 Instruction i = p->code[pc]; 398 Instruction i = p->code[pc];
399 OpCode op = GET_OPCODE(i); 399 OpCode op = GET_OPCODE(i);
400 int a = GETARG_A(i); 400 int a = GETARG_A(i);
401 int change; /* true if current instruction changed 'reg' */
401 switch (op) { 402 switch (op) {
402 case OP_LOADNIL: { 403 case OP_LOADNIL: { /* set registers from 'a' to 'a+b' */
403 int b = GETARG_B(i); 404 int b = GETARG_B(i);
404 if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ 405 change = (a <= reg && reg <= a + b);
405 setreg = filterpc(pc, jmptarget);
406 break; 406 break;
407 } 407 }
408 case OP_TFORCALL: { 408 case OP_TFORCALL: { /* affect all regs above its base */
409 if (reg >= a + 2) /* affect all regs above its base */ 409 change = (reg >= a + 2);
410 setreg = filterpc(pc, jmptarget);
411 break; 410 break;
412 } 411 }
413 case OP_CALL: 412 case OP_CALL:
414 case OP_TAILCALL: { 413 case OP_TAILCALL: { /* affect all registers above base */
415 if (reg >= a) /* affect all registers above base */ 414 change = (reg >= a);
416 setreg = filterpc(pc, jmptarget);
417 break; 415 break;
418 } 416 }
419 case OP_JMP: { 417 case OP_JMP: { /* doesn't change registers, but changes 'jmptarget' */
420 int b = GETARG_sBx(i); 418 int b = GETARG_sBx(i);
421 int dest = pc + 1 + b; 419 int dest = pc + 1 + b;
422 /* jump is forward and do not skip 'lastpc'? */ 420 /* jump does not skip 'lastpc' and is larger than current one? */
423 if (pc < dest && dest <= lastpc) { 421 if (dest <= lastpc && dest > jmptarget)
424 if (dest > jmptarget) 422 jmptarget = dest; /* update 'jmptarget' */
425 jmptarget = dest; /* update 'jmptarget' */ 423 change = 0;
426 }
427 break; 424 break;
428 } 425 }
429 default: 426 default: /* any instruction that sets A */
430 if (testAMode(op) && reg == a) /* any instruction that set A */ 427 change = (testAMode(op) && reg == a);
431 setreg = filterpc(pc, jmptarget);
432 break; 428 break;
433 } 429 }
430 if (change)
431 setreg = filterpc(pc, jmptarget);
434 } 432 }
435 return setreg; 433 return setreg;
436} 434}