mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-03 06:39:33 +00:00
[DEBUGGER] Disassembler copy whole line option
This commit is contained in:
parent
1981f22228
commit
fdda9fdcc5
2 changed files with 33 additions and 2 deletions
|
@ -579,7 +579,8 @@ void CodeViewWidget::OnContextMenu()
|
||||||
auto* copy_line_action =
|
auto* copy_line_action =
|
||||||
menu->addAction(tr("Copy Code &Line"), this, &CodeViewWidget::OnCopyCode);
|
menu->addAction(tr("Copy Code &Line"), this, &CodeViewWidget::OnCopyCode);
|
||||||
auto* copy_hex_action = menu->addAction(tr("Copy &Hex"), this, &CodeViewWidget::OnCopyHex);
|
auto* copy_hex_action = menu->addAction(tr("Copy &Hex"), this, &CodeViewWidget::OnCopyHex);
|
||||||
|
auto* copy_whole_line_action =
|
||||||
|
menu->addAction(tr("Copy &Whole Line"), this, &CodeViewWidget::OnCopyWholeLine);
|
||||||
menu->addAction(tr("Show in &Memory"), this, &CodeViewWidget::OnShowInMemory);
|
menu->addAction(tr("Show in &Memory"), this, &CodeViewWidget::OnShowInMemory);
|
||||||
auto* show_target_memory =
|
auto* show_target_memory =
|
||||||
menu->addAction(tr("Show Target in Memor&y"), this, &CodeViewWidget::OnShowTargetInMemory);
|
menu->addAction(tr("Show Target in Memor&y"), this, &CodeViewWidget::OnShowTargetInMemory);
|
||||||
|
@ -646,7 +647,7 @@ void CodeViewWidget::OnContextMenu()
|
||||||
follow_branch_action->setEnabled(follow_branch_enabled);
|
follow_branch_action->setEnabled(follow_branch_enabled);
|
||||||
|
|
||||||
for (auto* action :
|
for (auto* action :
|
||||||
{copy_address_action, copy_line_action, copy_hex_action, function_action, run_to_action,
|
{copy_address_action, copy_line_action, copy_whole_line_action, copy_hex_action, function_action, run_to_action,
|
||||||
ppc_action, insert_blr_action, insert_nop_action, replace_action, assemble_action})
|
ppc_action, insert_blr_action, insert_nop_action, replace_action, assemble_action})
|
||||||
{
|
{
|
||||||
action->setEnabled(running);
|
action->setEnabled(running);
|
||||||
|
@ -826,6 +827,35 @@ void CodeViewWidget::OnCopyCode()
|
||||||
QApplication::clipboard()->setText(QString::fromStdString(text));
|
QApplication::clipboard()->setText(QString::fromStdString(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeViewWidget::OnCopyWholeLine()
|
||||||
|
{
|
||||||
|
const u32 addr = GetContextAddress();
|
||||||
|
|
||||||
|
const QString textAddress = QStringLiteral("%1").arg(addr, 8, 16, QLatin1Char('0'));
|
||||||
|
|
||||||
|
const std::string textCode = [this, addr] {
|
||||||
|
Core::CPUThreadGuard guard(m_system);
|
||||||
|
return m_system.GetPowerPC().GetDebugInterface().Disassemble(&guard, addr);
|
||||||
|
}();
|
||||||
|
|
||||||
|
QString textTarget = QStringLiteral("");
|
||||||
|
|
||||||
|
if (IsInstructionLoadStore(textCode))
|
||||||
|
{
|
||||||
|
const std::optional<u32> target_addr =
|
||||||
|
m_system.GetPowerPC().GetDebugInterface().GetMemoryAddressFromInstruction(textCode);
|
||||||
|
|
||||||
|
if (target_addr)
|
||||||
|
{
|
||||||
|
textTarget = QStringLiteral(" targetting ") +
|
||||||
|
QStringLiteral("%1").arg(*target_addr, 8, 16, QLatin1Char('0'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QApplication::clipboard()->setText(textAddress + QString::fromStdString(std::string(" ")) +
|
||||||
|
QString::fromStdString(textCode) + textTarget);
|
||||||
|
}
|
||||||
|
|
||||||
void CodeViewWidget::OnCopyFunction()
|
void CodeViewWidget::OnCopyFunction()
|
||||||
{
|
{
|
||||||
const u32 address = GetContextAddress();
|
const u32 address = GetContextAddress();
|
||||||
|
|
|
@ -85,6 +85,7 @@ private:
|
||||||
void OnShowTargetInMemory();
|
void OnShowTargetInMemory();
|
||||||
void OnCopyFunction();
|
void OnCopyFunction();
|
||||||
void OnCopyCode();
|
void OnCopyCode();
|
||||||
|
void OnCopyWholeLine();
|
||||||
void OnCopyHex();
|
void OnCopyHex();
|
||||||
void OnRenameSymbol();
|
void OnRenameSymbol();
|
||||||
void OnSelectionChanged();
|
void OnSelectionChanged();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue