diff --git a/CHANGES b/CHANGES index 2bca38dd5..aa509d1db 100644 --- a/CHANGES +++ b/CHANGES @@ -4,7 +4,7 @@ Features: - GBA: Better cheat type autodetection - GB: Tile viewer - Sprite viewer - - Debugging REPL + - Debugging console Bugfixes: - LR35902: Fix core never exiting with certain event patterns - GB Timer: Improve DIV reset behavior diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index f5485f089..beca53db4 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -118,7 +118,7 @@ set(UI_FILES ArchiveInspector.ui AssetTile.ui CheatsView.ui - DebuggerREPL.ui + DebuggerConsole.ui GIFView.ui IOViewer.ui LoadSaveState.ui @@ -181,8 +181,8 @@ endif() if(USE_DEBUGGERS) list(APPEND SOURCE_FILES DebuggerController.cpp - DebuggerREPL.cpp - DebuggerREPLController.cpp) + DebuggerConsole.cpp + DebuggerConsoleController.cpp) endif() if(USE_GDB_STUB) diff --git a/src/platform/qt/DebuggerREPL.cpp b/src/platform/qt/DebuggerConsole.cpp similarity index 71% rename from src/platform/qt/DebuggerREPL.cpp rename to src/platform/qt/DebuggerConsole.cpp index 3980189cf..d2aacd6dd 100644 --- a/src/platform/qt/DebuggerREPL.cpp +++ b/src/platform/qt/DebuggerConsole.cpp @@ -3,17 +3,17 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "DebuggerREPL.h" +#include "DebuggerConsole.h" -#include "DebuggerREPLController.h" +#include "DebuggerConsoleController.h" #include using namespace QGBA; -DebuggerREPL::DebuggerREPL(DebuggerREPLController* controller, QWidget* parent) +DebuggerConsole::DebuggerConsole(DebuggerConsoleController* controller, QWidget* parent) : QWidget(parent) - , m_replController(controller) + , m_consoleController(controller) { m_ui.setupUi(this); @@ -24,19 +24,19 @@ DebuggerREPL::DebuggerREPL(DebuggerREPLController* controller, QWidget* parent) controller->attach(); } -void DebuggerREPL::log(const QString& line) { +void DebuggerConsole::log(const QString& line) { m_ui.log->moveCursor(QTextCursor::End); m_ui.log->insertPlainText(line); m_ui.log->verticalScrollBar()->setValue(m_ui.log->verticalScrollBar()->maximum()); } -void DebuggerREPL::postLine() { +void DebuggerConsole::postLine() { QString line = m_ui.prompt->text(); m_ui.prompt->clear(); if (line.isEmpty()) { - m_replController->enterLine(QString("\n")); + m_consoleController->enterLine(QString("\n")); } else { log(QString("> %1\n").arg(line)); - m_replController->enterLine(line); + m_consoleController->enterLine(line); } } diff --git a/src/platform/qt/DebuggerREPL.h b/src/platform/qt/DebuggerConsole.h similarity index 53% rename from src/platform/qt/DebuggerREPL.h rename to src/platform/qt/DebuggerConsole.h index 26b8ea796..7616b665f 100644 --- a/src/platform/qt/DebuggerREPL.h +++ b/src/platform/qt/DebuggerConsole.h @@ -3,29 +3,29 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef QGBA_DEBUGGER_REPL -#define QGBA_DEBUGGER_REPL +#ifndef QGBA_DEBUGGER_CONSOLE +#define QGBA_DEBUGGER_CONSOLE -#include "ui_DebuggerREPL.h" +#include "ui_DebuggerConsole.h" namespace QGBA { -class DebuggerREPLController; +class DebuggerConsoleController; -class DebuggerREPL : public QWidget { +class DebuggerConsole : public QWidget { Q_OBJECT public: - DebuggerREPL(DebuggerREPLController* controller, QWidget* parent = nullptr); + DebuggerConsole(DebuggerConsoleController* controller, QWidget* parent = nullptr); private slots: void log(const QString&); void postLine(); private: - Ui::DebuggerREPL m_ui; + Ui::DebuggerConsole m_ui; - DebuggerREPLController* m_replController; + DebuggerConsoleController* m_consoleController; }; } diff --git a/src/platform/qt/DebuggerREPL.ui b/src/platform/qt/DebuggerConsole.ui similarity index 93% rename from src/platform/qt/DebuggerREPL.ui rename to src/platform/qt/DebuggerConsole.ui index 77ea2e9d3..7374afd89 100644 --- a/src/platform/qt/DebuggerREPL.ui +++ b/src/platform/qt/DebuggerConsole.ui @@ -1,7 +1,7 @@ - DebuggerREPL - + DebuggerConsole + 0 diff --git a/src/platform/qt/DebuggerREPLController.cpp b/src/platform/qt/DebuggerConsoleController.cpp similarity index 56% rename from src/platform/qt/DebuggerREPLController.cpp rename to src/platform/qt/DebuggerConsoleController.cpp index 7b4629848..22cc9b3ff 100644 --- a/src/platform/qt/DebuggerREPLController.cpp +++ b/src/platform/qt/DebuggerConsoleController.cpp @@ -3,7 +3,7 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "DebuggerREPLController.h" +#include "DebuggerConsoleController.h" #include "GameController.h" @@ -15,7 +15,7 @@ extern "C" { using namespace QGBA; -DebuggerREPLController::DebuggerREPLController(GameController* controller, QObject* parent) +DebuggerConsoleController::DebuggerConsoleController(GameController* controller, QObject* parent) : DebuggerController(controller, &m_cliDebugger.d, parent) { m_backend.d.printf = printf; @@ -31,7 +31,7 @@ DebuggerREPLController::DebuggerREPLController(GameController* controller, QObje CLIDebuggerAttachBackend(&m_cliDebugger, &m_backend.d); } -void DebuggerREPLController::enterLine(const QString& line) { +void DebuggerConsoleController::enterLine(const QString& line) { QMutexLocker lock(&m_mutex); m_lines.append(line); if (m_cliDebugger.d.state == DEBUGGER_RUNNING) { @@ -40,33 +40,33 @@ void DebuggerREPLController::enterLine(const QString& line) { m_cond.wakeOne(); } -void DebuggerREPLController::attachInternal() { +void DebuggerConsoleController::attachInternal() { mCore* core = m_gameController->thread()->core; CLIDebuggerAttachSystem(&m_cliDebugger, core->cliDebuggerSystem(core)); } -void DebuggerREPLController::printf(struct CLIDebuggerBackend* be, const char* fmt, ...) { - Backend* replBe = reinterpret_cast(be); - DebuggerREPLController* self = replBe->self; +void DebuggerConsoleController::printf(struct CLIDebuggerBackend* be, const char* fmt, ...) { + Backend* consoleBe = reinterpret_cast(be); + DebuggerConsoleController* self = consoleBe->self; va_list args; va_start(args, fmt); self->log(QString().vsprintf(fmt, args)); va_end(args); } -void DebuggerREPLController::init(struct CLIDebuggerBackend* be) { - Backend* replBe = reinterpret_cast(be); - DebuggerREPLController* self = replBe->self; +void DebuggerConsoleController::init(struct CLIDebuggerBackend* be) { + Backend* consoleBe = reinterpret_cast(be); + DebuggerConsoleController* self = consoleBe->self; } -void DebuggerREPLController::deinit(struct CLIDebuggerBackend* be) { - Backend* replBe = reinterpret_cast(be); - DebuggerREPLController* self = replBe->self; +void DebuggerConsoleController::deinit(struct CLIDebuggerBackend* be) { + Backend* consoleBe = reinterpret_cast(be); + DebuggerConsoleController* self = consoleBe->self; } -const char* DebuggerREPLController::readLine(struct CLIDebuggerBackend* be, size_t* len) { - Backend* replBe = reinterpret_cast(be); - DebuggerREPLController* self = replBe->self; +const char* DebuggerConsoleController::readLine(struct CLIDebuggerBackend* be, size_t* len) { + Backend* consoleBe = reinterpret_cast(be); + DebuggerConsoleController* self = consoleBe->self; GameController::Interrupter interrupter(self->m_gameController, true); QMutexLocker lock(&self->m_mutex); while (self->m_lines.isEmpty()) { @@ -78,24 +78,24 @@ const char* DebuggerREPLController::readLine(struct CLIDebuggerBackend* be, size } -void DebuggerREPLController::lineAppend(struct CLIDebuggerBackend* be, const char* line) { - Backend* replBe = reinterpret_cast(be); - DebuggerREPLController* self = replBe->self; +void DebuggerConsoleController::lineAppend(struct CLIDebuggerBackend* be, const char* line) { + Backend* consoleBe = reinterpret_cast(be); + DebuggerConsoleController* self = consoleBe->self; self->lineAppend(QString::fromUtf8(line)); } -const char* DebuggerREPLController::historyLast(struct CLIDebuggerBackend* be, size_t* len) { - Backend* replBe = reinterpret_cast(be); - DebuggerREPLController* self = replBe->self; +const char* DebuggerConsoleController::historyLast(struct CLIDebuggerBackend* be, size_t* len) { + Backend* consoleBe = reinterpret_cast(be); + DebuggerConsoleController* self = consoleBe->self; GameController::Interrupter interrupter(self->m_gameController, true); QMutexLocker lock(&self->m_mutex); self->m_last = self->m_history.last().toUtf8(); return self->m_last.constData(); } -void DebuggerREPLController::historyAppend(struct CLIDebuggerBackend* be, const char* line) { - Backend* replBe = reinterpret_cast(be); - DebuggerREPLController* self = replBe->self; +void DebuggerConsoleController::historyAppend(struct CLIDebuggerBackend* be, const char* line) { + Backend* consoleBe = reinterpret_cast(be); + DebuggerConsoleController* self = consoleBe->self; GameController::Interrupter interrupter(self->m_gameController, true); QMutexLocker lock(&self->m_mutex); self->m_history.append(QString::fromUtf8(line)); diff --git a/src/platform/qt/DebuggerREPLController.h b/src/platform/qt/DebuggerConsoleController.h similarity index 83% rename from src/platform/qt/DebuggerREPLController.h rename to src/platform/qt/DebuggerConsoleController.h index 51d983563..1128aabca 100644 --- a/src/platform/qt/DebuggerREPLController.h +++ b/src/platform/qt/DebuggerConsoleController.h @@ -3,8 +3,8 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef QGBA_DEBUGGER_REPL_CONTROLLER -#define QGBA_DEBUGGER_REPL_CONTROLLER +#ifndef QGBA_DEBUGGER_CONSOLE_CONTROLLER +#define QGBA_DEBUGGER_CONSOLE_CONTROLLER #include "DebuggerController.h" @@ -20,11 +20,11 @@ namespace QGBA { class GameController; -class DebuggerREPLController : public DebuggerController { +class DebuggerConsoleController : public DebuggerController { Q_OBJECT public: - DebuggerREPLController(GameController* controller, QObject* parent = nullptr); + DebuggerConsoleController(GameController* controller, QObject* parent = nullptr); signals: void log(const QString&); @@ -55,7 +55,7 @@ private: struct Backend { CLIDebuggerBackend d; - DebuggerREPLController* self; + DebuggerConsoleController* self; } m_backend; }; diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index b8a387601..ff5f7dd7e 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -18,8 +18,8 @@ #include "ArchiveInspector.h" #include "CheatsView.h" #include "ConfigController.h" -#include "DebuggerREPL.h" -#include "DebuggerREPLController.h" +#include "DebuggerConsole.h" +#include "DebuggerConsoleController.h" #include "Display.h" #include "GameController.h" #include "GBAApp.h" @@ -73,7 +73,7 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent) , m_gdbController(nullptr) #endif #ifdef USE_DEBUGGERS - , m_repl(nullptr) + , m_console(nullptr) #endif , m_mruMenu(nullptr) , m_shortcutController(new ShortcutController(this)) @@ -519,11 +519,11 @@ void Window::gdbOpen() { #endif #ifdef USE_DEBUGGERS -void Window::replOpen() { - if (!m_repl) { - m_repl = new DebuggerREPLController(m_controller, this); +void Window::consoleOpen() { + if (!m_console) { + m_console = new DebuggerConsoleController(m_controller, this); } - DebuggerREPL* window = new DebuggerREPL(m_repl); + DebuggerConsole* window = new DebuggerConsole(m_console); openView(window); } #endif @@ -1353,9 +1353,9 @@ void Window::setupMenu(QMenuBar* menubar) { toolsMenu->addSeparator(); #ifdef USE_DEBUGGERS - QAction* replWindow = new QAction(tr("Open debugger REPL..."), toolsMenu); - connect(replWindow, SIGNAL(triggered()), this, SLOT(replOpen())); - addControlledAction(toolsMenu, replWindow, "debuggerWindow"); + QAction* consoleWindow = new QAction(tr("Open debugger console..."), toolsMenu); + connect(consoleWindow, SIGNAL(triggered()), this, SLOT(consoleOpen())); + addControlledAction(toolsMenu, consoleWindow, "debuggerWindow"); #endif #ifdef USE_GDB_STUB diff --git a/src/platform/qt/Window.h b/src/platform/qt/Window.h index 9e20efc41..cb3b384b6 100644 --- a/src/platform/qt/Window.h +++ b/src/platform/qt/Window.h @@ -26,7 +26,7 @@ struct mArguments; namespace QGBA { class ConfigController; -class DebuggerREPLController; +class DebuggerConsoleController; class Display; class GameController; class GDBController; @@ -82,7 +82,7 @@ public slots: void openAboutScreen(); #ifdef USE_DEBUGGERS - void replOpen(); + void consoleOpen(); #endif #ifdef USE_FFMPEG @@ -162,7 +162,7 @@ private: LogController m_log; LogView* m_logView; #ifdef USE_DEBUGGERS - DebuggerREPLController* m_repl; + DebuggerConsoleController* m_console; #endif LoadSaveState* m_stateWindow; WindowBackground* m_screenWidget;