diff options
author | 2016-06-08 08:10:55 +1000 | |
---|---|---|
committer | 2016-06-08 08:10:55 +1000 | |
commit | 56bd36c5ef3960874628bc08cbfcedf4c6057a19 (patch) | |
tree | 3cce04b8c27b773befde51785210bc83673f9fd0 /src/osd/modules/debugger/qt/mainwindow.cpp | |
parent | bf281b3cad1d05c6ef863fa179d3d6ab442a163c (diff) |
Major refactoring of debugger core [Ryan Holtz]
* Eliminate globals/file statics
* Remove lots of stuff from global scope
* Use std::function for custom command registration
* Eliminate some trampolines
* Build fixes from Vas Crabb and balr0g
Diffstat (limited to 'src/osd/modules/debugger/qt/mainwindow.cpp')
-rw-r--r-- | src/osd/modules/debugger/qt/mainwindow.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index e366ba77247..4020578635d 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -213,7 +213,7 @@ bool MainWindow::eventFilter(QObject* obj, QEvent* event) void MainWindow::toggleBreakpointAtCursor(bool changedTo) { debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view()); - if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())) + if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device())) { offs_t const address = downcast<debug_view_disasm *>(dasmView)->selected_address(); device_debug *const cpuinfo = dasmView->source()->device()->debug(); @@ -241,7 +241,7 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo) { command = string_format("bpclear 0x%X", bpindex); } - debug_console_execute_command(*m_machine, command.c_str(), 1); + m_machine->debugger().console().execute_command(command.c_str(), true); } refreshAll(); @@ -251,7 +251,7 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo) void MainWindow::enableBreakpointAtCursor(bool changedTo) { debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view()); - if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())) + if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device())) { offs_t const address = dasmView->selected_address(); device_debug *const cpuinfo = dasmView->source()->device()->debug(); @@ -265,7 +265,7 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo) { INT32 const bpindex = bp->index(); std::string command = string_format(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex); - debug_console_execute_command(*m_machine, command.c_str(), 1); + m_machine->debugger().console().execute_command(command.c_str(), true); } } @@ -276,11 +276,11 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo) void MainWindow::runToCursor(bool changedTo) { debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view()); - if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())) + if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device())) { offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address(); std::string command = string_format("go 0x%X", address); - debug_console_execute_command(*m_machine, command.c_str(), 1); + m_machine->debugger().console().execute_command(command.c_str(), true); } } @@ -315,14 +315,12 @@ void MainWindow::executeCommand(bool withClear) // A blank command is a "silent step" if (command == "") { - debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step(); + m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step(); return; } // Send along the command - debug_console_execute_command(*m_machine, - command.toLocal8Bit().data(), - true); + m_machine->debugger().console().execute_command(command.toLocal8Bit().data(), true); // Add history & set the index to be the top of the stack addToHistory(command); @@ -348,7 +346,7 @@ void MainWindow::mountImage(bool changedTo) device_image_interface *img = iter.byindex(imageIndex); if (img == nullptr) { - debug_console_printf(*m_machine, "Something is wrong with the mount menu.\n"); + m_machine->debugger().console().printf("Something is wrong with the mount menu.\n"); refreshAll(); return; } @@ -361,7 +359,7 @@ void MainWindow::mountImage(bool changedTo) if (img->load(filename.toUtf8().data()) != IMAGE_INIT_PASS) { - debug_console_printf(*m_machine, "Image could not be mounted.\n"); + m_machine->debugger().console().printf("Image could not be mounted.\n"); refreshAll(); return; } @@ -377,7 +375,7 @@ void MainWindow::mountImage(bool changedTo) const QString newTitle = baseString + QString(" : ") + QString(img->filename()); parentMenuItem->setTitle(newTitle); - debug_console_printf(*m_machine, "Image %s mounted successfully.\n", filename.toUtf8().data()); + m_machine->debugger().console().printf("Image %s mounted successfully.\n", filename.toUtf8().data()); refreshAll(); } @@ -401,7 +399,7 @@ void MainWindow::unmountImage(bool changedTo) const QString newTitle = baseString + QString(" : ") + QString("[empty slot]"); parentMenuItem->setTitle(newTitle); - debug_console_printf(*m_machine, "Image successfully unmounted.\n"); + m_machine->debugger().console().printf("Image successfully unmounted.\n"); refreshAll(); } @@ -409,7 +407,7 @@ void MainWindow::unmountImage(bool changedTo) void MainWindow::dasmViewUpdated() { debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view()); - bool const haveCursor = dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device()); + bool const haveCursor = dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device()); bool haveBreakpoint = false; bool breakpointEnabled = false; if (haveCursor) |