this code enters the debugger when a breakpoint was hit
| 905 | |
| 906 | //this code enters the debugger when a breakpoint was hit |
| 907 | void FCEUD_DebugBreakpoint(int bp_num) |
| 908 | { |
| 909 | // log the Breakpoint Hit into Trace Logger log if needed |
| 910 | if (logging) |
| 911 | { |
| 912 | log_old_emu_paused = false; // force Trace Logger update |
| 913 | if (logging_options & LOG_MESSAGES) |
| 914 | { |
| 915 | char str_temp[500]; |
| 916 | if (bp_num >= 0) |
| 917 | { |
| 918 | // normal breakpoint |
| 919 | sprintf(str_temp, "Breakpoint %u Hit at $%04X: ", bp_num, X.PC); |
| 920 | strcat(str_temp, BreakToText(bp_num)); |
| 921 | //watchpoint[num].condText |
| 922 | OutputLogLine(str_temp); |
| 923 | } else if (bp_num == BREAK_TYPE_BADOP) |
| 924 | { |
| 925 | sprintf(str_temp, "Bad Opcode Breakpoint Hit at $%04X", X.PC); |
| 926 | OutputLogLine(str_temp); |
| 927 | } else if (bp_num == BREAK_TYPE_CYCLES_EXCEED) |
| 928 | { |
| 929 | sprintf(str_temp, "Breakpoint Hit at $%04X: cycles count %lu exceeds %lu", X.PC, (long)(timestampbase + timestamp - total_cycles_base), (long)break_cycles_limit); |
| 930 | OutputLogLine(str_temp); |
| 931 | } else if (bp_num == BREAK_TYPE_INSTRUCTIONS_EXCEED) |
| 932 | { |
| 933 | sprintf(str_temp, "Breakpoint Hit at $%04X: instructions count %lu exceeds %lu", X.PC, (long)total_instructions, (long)break_instructions_limit); |
| 934 | OutputLogLine(str_temp); |
| 935 | } |
| 936 | } |
| 937 | } |
| 938 | |
| 939 | DoDebug(0); |
| 940 | UpdateOtherDebuggingDialogs(); // Keeps the debugging windows updating smoothly when stepping |
| 941 | |
| 942 | // highlight the ">" line |
| 943 | if (bp_num != BREAK_TYPE_STEP) |
| 944 | if (beginningOfPCPointerLine >= 0) |
| 945 | SendMessage(GetDlgItem(hDebug, IDC_DEBUGGER_DISASSEMBLY), EM_SETSEL, beginningOfPCPointerLine + 1, beginningOfPCPointerLine + 8); |
| 946 | |
| 947 | // highlight breakpoint |
| 948 | if (bp_num >= 0) |
| 949 | { |
| 950 | // highlight bp_num item in IDC_DEBUGGER_BP_LIST |
| 951 | SendDlgItemMessage(hDebug, IDC_DEBUGGER_BP_LIST, LB_SETCURSEL, (WPARAM)bp_num, 0); |
| 952 | EnableWindow(GetDlgItem(hDebug, IDC_DEBUGGER_BP_DEL), TRUE); |
| 953 | EnableWindow(GetDlgItem(hDebug, IDC_DEBUGGER_BP_EDIT), TRUE); |
| 954 | } else |
| 955 | { |
| 956 | // remove any selection from IDC_DEBUGGER_BP_LIST |
| 957 | SendDlgItemMessage(hDebug, IDC_DEBUGGER_BP_LIST, LB_SETCURSEL, (WPARAM)(-1), 0); |
| 958 | EnableWindow(GetDlgItem(hDebug, IDC_DEBUGGER_BP_DEL), FALSE); |
| 959 | EnableWindow(GetDlgItem(hDebug, IDC_DEBUGGER_BP_EDIT), FALSE); |
| 960 | // highlight IDC_DEBUGGER_VAL_CYCLES_COUNT or IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT if needed |
| 961 | if (bp_num == BREAK_TYPE_CYCLES_EXCEED) |
| 962 | SendMessage(GetDlgItem(hDebug, IDC_DEBUGGER_VAL_CYCLES_COUNT), EM_SETSEL, 0, -1); |
| 963 | else if (bp_num == BREAK_TYPE_INSTRUCTIONS_EXCEED) |
| 964 | SendMessage(GetDlgItem(hDebug, IDC_DEBUGGER_VAL_INSTRUCTIONS_COUNT), EM_SETSEL, 0, -1); |
nothing calls this directly
no test coverage detected