From c55140ee1bbbbfa2699163389b65b916fa683fc4 Mon Sep 17 00:00:00 2001 From: smf- Date: Tue, 25 Jul 2017 16:16:35 +0100 Subject: stop hotspot from crashing when you start running. (nw) --- src/emu/debug/debugcpu.cpp | 59 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 43f1f60cd5c..46ad9e04683 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -2794,41 +2794,42 @@ void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t addre m_wpdata = value_to_write; // see if we match - for (device_debug::watchpoint *wp = wplist[space.spacenum()]; wp != nullptr; wp = wp->next()) - if (wp->hit(type, address, size)) - { - // halt in the debugger by default - m_execution_state = EXECUTION_STATE_STOPPED; - - // if we hit, evaluate the action - if (!wp->action().empty()) - m_machine.debugger().console().execute_command(wp->action(), false); - - // print a notification, unless the action made us go again - if (m_execution_state == EXECUTION_STATE_STOPPED) + if (space.spacenum() < int(wplist.size())) + for (device_debug::watchpoint *wp = wplist[space.spacenum()]; wp != nullptr; wp = wp->next()) + if (wp->hit(type, address, size)) { - static const char *const sizes[] = - { - "0bytes", "byte", "word", "3bytes", "dword", "5bytes", "6bytes", "7bytes", "qword" - }; - offs_t pc = space.device().safe_pcbase(); - std::string buffer; + // halt in the debugger by default + m_execution_state = EXECUTION_STATE_STOPPED; + + // if we hit, evaluate the action + if (!wp->action().empty()) + m_machine.debugger().console().execute_command(wp->action(), false); - if (type & WATCHPOINT_WRITE) + // print a notification, unless the action made us go again + if (m_execution_state == EXECUTION_STATE_STOPPED) { - buffer = string_format("Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); - if (value_to_write >> 32) - buffer.append(string_format(" (data=%X%08X)", u32(value_to_write >> 32), u32(value_to_write))); + static const char *const sizes[] = + { + "0bytes", "byte", "word", "3bytes", "dword", "5bytes", "6bytes", "7bytes", "qword" + }; + offs_t pc = space.device().safe_pcbase(); + std::string buffer; + + if (type & WATCHPOINT_WRITE) + { + buffer = string_format("Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); + if (value_to_write >> 32) + buffer.append(string_format(" (data=%X%08X)", u32(value_to_write >> 32), u32(value_to_write))); + else + buffer.append(string_format(" (data=%X)", u32(value_to_write))); + } else - buffer.append(string_format(" (data=%X)", u32(value_to_write))); + buffer = string_format("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); + m_machine.debugger().console().printf("%s\n", buffer.c_str()); + space.device().debug()->compute_debug_flags(); } - else - buffer = string_format("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); - m_machine.debugger().console().printf("%s\n", buffer.c_str()); - space.device().debug()->compute_debug_flags(); + break; } - break; - } m_within_instruction_hook = false; } -- cgit v1.2.3