fires a breakpoint
| 676 | |
| 677 | ///fires a breakpoint |
| 678 | static void breakpoint(uint8 *opcode, uint16 A, int size) { |
| 679 | int i, romAddrPC; |
| 680 | unsigned int j; |
| 681 | uint8 brk_type; |
| 682 | uint8 stackop=0; |
| 683 | uint8 stackopstartaddr=0,stackopendaddr=0; |
| 684 | |
| 685 | debugLastAddress = A; |
| 686 | debugLastOpcode = opcode[0]; |
| 687 | |
| 688 | if (break_asap) |
| 689 | { |
| 690 | break_asap = false; |
| 691 | BreakHit(BREAK_TYPE_LUA); |
| 692 | } |
| 693 | |
| 694 | if (break_on_cycles && ((timestampbase + (uint64)timestamp - total_cycles_base) > break_cycles_limit)) |
| 695 | BreakHit(BREAK_TYPE_CYCLES_EXCEED); |
| 696 | if (break_on_instructions && (total_instructions > break_instructions_limit)) |
| 697 | BreakHit(BREAK_TYPE_INSTRUCTIONS_EXCEED); |
| 698 | |
| 699 | //if the current instruction is bad, and we are breaking on bad opcodes, then hit the breakpoint |
| 700 | if(dbgstate.badopbreak && (size == 0)) |
| 701 | BreakHit(BREAK_TYPE_BADOP); |
| 702 | |
| 703 | //if we're stepping out, track the nest level |
| 704 | if (dbgstate.stepout) { |
| 705 | if (opcode[0] == 0x20) dbgstate.jsrcount++; |
| 706 | else if (opcode[0] == 0x60) { |
| 707 | if (dbgstate.jsrcount) |
| 708 | dbgstate.jsrcount--; |
| 709 | else { |
| 710 | dbgstate.stepout = false; |
| 711 | dbgstate.step = true; |
| 712 | return; |
| 713 | } |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | //if we're stepping, then we'll always want to break |
| 718 | if (dbgstate.step) { |
| 719 | dbgstate.step = false; |
| 720 | BreakHit(BREAK_TYPE_STEP); |
| 721 | return; |
| 722 | } |
| 723 | |
| 724 | //if we're running for a scanline, we want to check if we've hit the cycle limit |
| 725 | if (dbgstate.runline) { |
| 726 | uint64 ts = timestampbase; |
| 727 | ts+=timestamp; |
| 728 | int diff = dbgstate.runline_end_time-ts; |
| 729 | if (diff<=0) |
| 730 | { |
| 731 | dbgstate.runline=false; |
| 732 | BreakHit(BREAK_TYPE_STEP); |
| 733 | return; |
| 734 | } |
| 735 | } |
no test coverage detected