Merge pull request #7658 from spycrab/debugger_show

Qt/Debugger: Add Show in Code / Show in Memory
This commit is contained in:
spycrab 2018-12-29 15:08:51 +01:00 committed by GitHub
commit 75b8824c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 0 deletions

View File

@ -229,6 +229,9 @@ void CodeViewWidget::OnContextMenu()
auto* copy_line_action =
menu->addAction(tr("Copy code &line"), this, &CodeViewWidget::OnCopyCode);
auto* copy_hex_action = menu->addAction(tr("Copy &hex"), this, &CodeViewWidget::OnCopyHex);
menu->addAction(tr("Show in &memory"), this, &CodeViewWidget::OnShowInMemory);
menu->addSeparator();
auto* symbol_rename_action =
@ -272,6 +275,11 @@ void CodeViewWidget::OnCopyAddress()
QApplication::clipboard()->setText(QStringLiteral("%1").arg(addr, 8, 16, QLatin1Char('0')));
}
void CodeViewWidget::OnShowInMemory()
{
emit ShowMemory(GetContextAddress());
}
void CodeViewWidget::OnCopyCode()
{
const u32 addr = GetContextAddress();

View File

@ -34,8 +34,10 @@ public:
void ToggleBreakpoint();
void AddBreakpoint();
signals:
void RequestPPCComparison(u32 addr);
void ShowMemory(u32 address);
void SymbolsChanged();
void BreakpointsChanged();
@ -57,6 +59,7 @@ private:
void OnFollowBranch();
void OnCopyAddress();
void OnShowInMemory();
void OnCopyFunction();
void OnCopyCode();
void OnCopyHex();

View File

@ -167,6 +167,7 @@ void CodeWidget::ConnectWidgets()
connect(m_code_view, &CodeViewWidget::RequestPPCComparison, this,
&CodeWidget::RequestPPCComparison);
connect(m_code_view, &CodeViewWidget::ShowMemory, this, &CodeWidget::ShowMemory);
}
void CodeWidget::OnSearchAddress()
@ -253,6 +254,12 @@ void CodeWidget::OnSelectFunctionCallers()
void CodeWidget::SetAddress(u32 address, CodeViewWidget::SetAddressUpdate update)
{
m_code_view->SetAddress(address, update);
if (update == CodeViewWidget::SetAddressUpdate::WithUpdate)
{
raise();
m_code_view->setFocus();
}
}
void CodeWidget::Update()

View File

@ -44,6 +44,7 @@ public:
signals:
void BreakpointsChanged();
void RequestPPCComparison(u32 addr);
void ShowMemory(u32 address);
private:
void CreateWidgets();

View File

@ -367,6 +367,10 @@ void MemoryViewWidget::OnContextMenu()
menu->addSeparator();
menu->addAction(tr("Show in code"), this, [this] { emit ShowCode(GetContextAddress()); });
menu->addSeparator();
menu->addAction(tr("Toggle Breakpoint"), this, &MemoryViewWidget::ToggleBreakpoint);
menu->exec(QCursor::pos());

View File

@ -49,6 +49,7 @@ public:
signals:
void BreakpointsChanged();
void ShowCode(u32 address);
private:
void OnContextMenu();

View File

@ -220,6 +220,7 @@ void MemoryWidget::ConnectWidgets()
connect(m_bp_log_check, &QCheckBox::toggled, this, &MemoryWidget::OnBPLogChanged);
connect(m_memory_view, &MemoryViewWidget::BreakpointsChanged, this,
&MemoryWidget::BreakpointsChanged);
connect(m_memory_view, &MemoryViewWidget::ShowCode, this, &MemoryWidget::ShowCode);
}
void MemoryWidget::closeEvent(QCloseEvent*)
@ -338,6 +339,15 @@ void MemoryWidget::OnBPTypeChanged()
SaveSettings();
}
void MemoryWidget::SetAddress(u32 address)
{
m_memory_view->SetAddress(address);
Settings::Instance().SetMemoryVisible(true);
raise();
m_memory_view->setFocus();
}
void MemoryWidget::OnSearchAddress()
{
bool good;

View File

@ -25,9 +25,11 @@ public:
explicit MemoryWidget(QWidget* parent = nullptr);
~MemoryWidget();
void SetAddress(u32 address);
void Update();
signals:
void BreakpointsChanged();
void ShowCode(u32 address);
private:
void CreateWidgets();

View File

@ -361,8 +361,12 @@ void MainWindow::CreateComponents()
connect(m_code_widget, &CodeWidget::BreakpointsChanged, m_breakpoint_widget,
&BreakpointWidget::Update);
connect(m_code_widget, &CodeWidget::RequestPPCComparison, m_jit_widget, &JITWidget::Compare);
connect(m_code_widget, &CodeWidget::ShowMemory, m_memory_widget, &MemoryWidget::SetAddress);
connect(m_memory_widget, &MemoryWidget::BreakpointsChanged, m_breakpoint_widget,
&BreakpointWidget::Update);
connect(m_memory_widget, &MemoryWidget::ShowCode, m_code_widget, [this](u32 address) {
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithUpdate);
});
connect(m_breakpoint_widget, &BreakpointWidget::BreakpointsChanged, m_code_widget,
&CodeWidget::Update);