From 2909e671aaae3d1900e83652fff2a799e069ce59 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Mon, 7 Jul 2025 04:37:12 +0300 Subject: [PATCH] Make address input wider Co-Authored-By: liuk707 <62625900+liuk7071@users.noreply.github.com> --- include/panda_qt/cpu_debugger.hpp | 2 ++ src/panda_qt/cpu_debugger.cpp | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/panda_qt/cpu_debugger.hpp b/include/panda_qt/cpu_debugger.hpp index a0999436..7e3803cd 100644 --- a/include/panda_qt/cpu_debugger.hpp +++ b/include/panda_qt/cpu_debugger.hpp @@ -5,6 +5,7 @@ #include #include +#include "capstone.hpp" #include "emulator.hpp" #include "panda_qt/disabled_widget_overlay.hpp" @@ -22,6 +23,7 @@ class CPUDebugger : public QWidget { bool enabled = false; bool followPC = false; + Common::CapstoneDisassembler disassembler; public: CPUDebugger(Emulator* emulator, QWidget* parent = nullptr); diff --git a/src/panda_qt/cpu_debugger.cpp b/src/panda_qt/cpu_debugger.cpp index 552acc80..b5bcf81e 100644 --- a/src/panda_qt/cpu_debugger.cpp +++ b/src/panda_qt/cpu_debugger.cpp @@ -12,8 +12,6 @@ #include #include -#include "capstone.hpp" - // TODO: Make this actually thread-safe by having it only work when paused static int getLinesInViewport(QListWidget* listWidget) { auto viewportHeight = listWidget->viewport()->height(); @@ -30,7 +28,7 @@ static std::pair getVisibleLineRange(QListWidget* listWidget, QScrollB return {firstLine, lineCount}; } -CPUDebugger::CPUDebugger(Emulator* emulator, QWidget* parent) : emu(emulator), QWidget(parent, Qt::Window) { +CPUDebugger::CPUDebugger(Emulator* emulator, QWidget* parent) : emu(emulator), disassembler(CS_ARCH_ARM, CS_MODE_ARM), QWidget(parent, Qt::Window) { setWindowTitle(tr("CPU debugger")); resize(1000, 600); @@ -52,7 +50,7 @@ CPUDebugger::CPUDebugger(Emulator* emulator, QWidget* parent) : emu(emulator), Q connect(followPCCheckBox, &QCheckBox::toggled, this, [&](bool checked) { followPC = checked; }); addressInput->setPlaceholderText(tr("Address to jump to")); - addressInput->setMaximumWidth(100); + addressInput->setMaximumWidth(150); gridLayout->addLayout(horizontalLayout, 0, 0); @@ -84,7 +82,7 @@ CPUDebugger::CPUDebugger(Emulator* emulator, QWidget* parent) : emu(emulator), Q // Forward scrolling from the list widget to our scrollbar disasmListWidget->installEventFilter(this); - // Annoyingly, due to a Qt limitation we can't set it to U32_MAX + // Annoyingly, due to a Qt limitation we can't set it to U32_MAX verticalScrollBar->setRange(0, std::numeric_limits::max()); verticalScrollBar->setSingleStep(8); verticalScrollBar->setPageStep(getLinesInViewport(disasmListWidget)); @@ -157,7 +155,6 @@ void CPUDebugger::updateDisasm() { auto& mem = emu->getMemory(); u32 pc = cpu.getReg(15); - Common::CapstoneDisassembler disassembler(CS_ARCH_ARM, CS_MODE_ARM); std::string disassembly; for (u32 addr = startPC; addr < endPC; addr += sizeof(u32)) {