* Tracer: fixed RTS padding

* Tracer: always force Trace Logger update when a breakpoint is hit
* Debugger: always open Debugger window when a breakpoint is hit
This commit is contained in:
ansstuff 2013-01-17 15:32:09 +00:00
parent f22dc51e71
commit 7b99bfc321
2 changed files with 35 additions and 32 deletions

View File

@ -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)

View File

@ -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