CMDERR debug_console_execute_command(running_machine &machine, const char *command, int echo) { CMDERR result; /* echo if requested */ if (echo) debug_console_printf(machine, ">%s\n", command); /* parse and execute */ result = internal_parse_command(machine, command, TRUE); /* display errors */ if (result != CMDERR_NONE) { if (!echo) debug_console_printf(machine, ">%s\n", command); debug_console_printf(machine, " %*s^\n", CMDERR_ERROR_OFFSET(result), ""); debug_console_printf(machine, "%s\n", debug_cmderr_to_string(result)); } /* update all views */ if (echo) { machine.debug_view().update_all(); debugger_refresh_display(machine); } return result; }
void DasmWindow::toggleBreakpointAtCursor(bool changedTo) { if (m_dasmView->view()->cursor_visible()) { offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address(); device_t *const device = m_dasmView->view()->source()->device(); device_debug *const cpuinfo = device->debug(); // Find an existing breakpoint at this address INT32 bpindex = -1; for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); bp != NULL; bp = bp->next()) { if (address == bp->address()) { bpindex = bp->index(); break; } } // If none exists, add a new one if (bpindex == -1) { bpindex = cpuinfo->breakpoint_set(address, NULL, NULL); debug_console_printf(*m_machine, "Breakpoint %X set\n", bpindex); } else { cpuinfo->breakpoint_clear(bpindex); debug_console_printf(*m_machine, "Breakpoint %X cleared\n", bpindex); } m_machine->debug_view().update_all(); debugger_refresh_display(*m_machine); } refreshAll(); }
void DasmWindow::enableBreakpointAtCursor(bool changedTo) { if (m_dasmView->view()->cursor_visible()) { offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address(); device_t *const device = m_dasmView->view()->source()->device(); device_debug *const cpuinfo = device->debug(); // Find an existing breakpoint at this address device_debug::breakpoint* bp = cpuinfo->breakpoint_first(); while ((bp != NULL) && (bp->address() != address)) bp = bp->next(); if (bp != NULL) { cpuinfo->breakpoint_enable(bp->index(), !bp->enabled()); debug_console_printf(*m_machine, "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled"); m_machine->debug_view().update_all(); debugger_refresh_display(*m_machine); } } refreshAll(); }
bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) { disasmview_info *const dasmview = downcast<disasmview_info *>(m_views[0].get()); switch (HIWORD(wparam)) { // menu selections case 0: switch (LOWORD(wparam)) { case ID_TOGGLE_BREAKPOINT: if (dasmview->cursor_visible()) { offs_t const address = dasmview->selected_address(); device_debug *const debug = dasmview->source_device()->debug(); INT32 bpindex = -1; // first find an existing breakpoint at this address for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next()) { if (address == bp->address()) { bpindex = bp->index(); break; } } // if it doesn't exist, add a new one if (!is_main_console()) { if (bpindex == -1) { bpindex = debug->breakpoint_set(address, NULL, NULL); debug_console_printf(machine(), "Breakpoint %X set\n", bpindex); } else { debug->breakpoint_clear(bpindex); debug_console_printf(machine(), "Breakpoint %X cleared\n", bpindex); } machine().debug_view().update_all(); debugger_refresh_display(machine()); } else if (dasmview->source_is_visible_cpu()) { astring command; if (bpindex == -1) command.printf("bpset 0x%X", address); else command.printf("bpclear 0x%X", bpindex); debug_console_execute_command(machine(), command, 1); } } return true; case ID_DISABLE_BREAKPOINT: if (dasmview->cursor_visible()) { offs_t const address = dasmview->selected_address(); device_debug *const debug = dasmview->source_device()->debug(); // first find an existing breakpoint at this address device_debug::breakpoint *bp = debug->breakpoint_first(); while ((bp != NULL) && (bp->address() != address)) bp = bp->next(); // if it doesn't exist, add a new one if (bp != NULL) { if (!is_main_console()) { debug->breakpoint_enable(bp->index(), !bp->enabled()); debug_console_printf(machine(), "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled"); machine().debug_view().update_all(); debugger_refresh_display(machine()); } else if (dasmview->source_is_visible_cpu()) { astring command; command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index()); debug_console_execute_command(machine(), command, 1); } } } return true; case ID_RUN_TO_CURSOR: if (dasmview->cursor_visible()) { offs_t const address = dasmview->selected_address(); if (dasmview->source_is_visible_cpu()) { astring command; command.printf("go 0x%X", address); debug_console_execute_command(machine(), command, 1); } else { dasmview->source_device()->debug()->go(address); } } return true; case ID_SHOW_RAW: dasmview->set_right_column(DASM_RIGHTCOL_RAW); recompute_children(); return true; case ID_SHOW_ENCRYPTED: dasmview->set_right_column(DASM_RIGHTCOL_ENCRYPTED); recompute_children(); return true; case ID_SHOW_COMMENTS: dasmview->set_right_column(DASM_RIGHTCOL_COMMENTS); recompute_children(); return true; } break; } return editwin_info::handle_command(wparam, lparam); }