diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index 659efc50..2c6867d1 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -633,32 +633,36 @@ bool inDebugger = false; void FCEUD_DebugBreakpoint(int bp_num) { // log the Breakpoint Hit into Trace Logger log if needed - if (logging && (logging_options & LOG_MESSAGES)) + if (logging) { - char str_temp[500]; - if (bp_num >= 0) + log_old_emu_paused = false; // force Trace Logger update + if (logging_options & LOG_MESSAGES) { - // normal breakpoint - sprintf(str_temp, "Breakpoint %u Hit at $%04X: ", bp_num, X.PC); - strcat(str_temp, BreakToText(bp_num)); - //watchpoint[num].condText - OutputLogLine(str_temp); - } else if (bp_num == BREAK_TYPE_BADOP) - { - sprintf(str_temp, "Bad Opcode Breakpoint Hit at $%04X", X.PC); - OutputLogLine(str_temp); - } else if (bp_num == BREAK_TYPE_CYCLES_EXCEED) - { - sprintf(str_temp, "Breakpoint Hit at $%04X: cycles count %lu exceeds %lu", X.PC, (long)(timestampbase + timestamp - total_cycles_base), (long)break_cycles_limit); - OutputLogLine(str_temp); - } else if (bp_num == BREAK_TYPE_INSTRUCTIONS_EXCEED) - { - sprintf(str_temp, "Breakpoint Hit at $%04X: instructions count %lu exceeds %lu", X.PC, (long)total_instructions, (long)break_instructions_limit); - OutputLogLine(str_temp); + char str_temp[500]; + if (bp_num >= 0) + { + // normal breakpoint + sprintf(str_temp, "Breakpoint %u Hit at $%04X: ", bp_num, X.PC); + strcat(str_temp, BreakToText(bp_num)); + //watchpoint[num].condText + OutputLogLine(str_temp); + } else if (bp_num == BREAK_TYPE_BADOP) + { + sprintf(str_temp, "Bad Opcode Breakpoint Hit at $%04X", X.PC); + OutputLogLine(str_temp); + } else if (bp_num == BREAK_TYPE_CYCLES_EXCEED) + { + sprintf(str_temp, "Breakpoint Hit at $%04X: cycles count %lu exceeds %lu", X.PC, (long)(timestampbase + timestamp - total_cycles_base), (long)break_cycles_limit); + OutputLogLine(str_temp); + } else if (bp_num == BREAK_TYPE_INSTRUCTIONS_EXCEED) + { + sprintf(str_temp, "Breakpoint Hit at $%04X: instructions count %lu exceeds %lu", X.PC, (long)total_instructions, (long)break_instructions_limit); + OutputLogLine(str_temp); + } } } - UpdateDebugger(true); + DoDebug(0); UpdateOtherDebuggingDialogs(); // Keeps the debugging windows updating smoothly when stepping if (bp_num >= 0) diff --git a/src/drivers/win/tracer.cpp b/src/drivers/win/tracer.cpp index 201ccb6e..beb42754 100644 --- a/src/drivers/win/tracer.cpp +++ b/src/drivers/win/tracer.cpp @@ -455,23 +455,22 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size) } } - if (size == 1 && GetMem(addr - 1) == 0x60) + if (size == 1 && GetMem(addr) == 0x60) { // special case: an RTS opcode // add "----------" to emphasize the end of subroutine strcat(str_disassembly, " "); - for (int i = strlen(str_disassembly); i < (LOG_DISASSEMBLY_MAX_LEN - 1); ++i) + int i = strlen(str_disassembly); + for (; i < (LOG_DISASSEMBLY_MAX_LEN - 2); ++i) str_disassembly[i] = '-'; - str_disassembly[LOG_DISASSEMBLY_MAX_LEN - 1] = 0; - } else + str_disassembly[i] = 0; + } + // stretch the disassembly string out if we have to output other stuff. + if ((logging_options & (LOG_REGISTERS|LOG_PROCESSOR_STATUS)) && !(logging_options & LOG_TO_THE_LEFT)) { - // stretch the disassembly string out if we have to output other stuff. - if ((logging_options & (LOG_REGISTERS|LOG_PROCESSOR_STATUS)) && !(logging_options & LOG_TO_THE_LEFT)) - { - for (int i = strlen(str_disassembly); i < (LOG_DISASSEMBLY_MAX_LEN - 1); ++i) - str_disassembly[i] = ' '; - str_disassembly[LOG_DISASSEMBLY_MAX_LEN - 1] = 0; - } + for (int i = strlen(str_disassembly); i < (LOG_DISASSEMBLY_MAX_LEN - 1); ++i) + str_disassembly[i] = ' '; + str_disassembly[LOG_DISASSEMBLY_MAX_LEN - 1] = 0; } // Start filling the str_temp line: Frame number, AXYS state, Processor status, Tabs, Address, Data, Disassembly