Merge pull request #8940 from RenaKunisaki/master

add Break On Hit and Log On Hit for instruction breakpoints
This commit is contained in:
Tilka
2020-08-08 19:46:10 +01:00
committed by GitHub
7 changed files with 71 additions and 19 deletions

View File

@ -188,7 +188,15 @@ void BreakpointWidget::Update()
m_table->setItem(i, 3,
create_item(QStringLiteral("%1").arg(bp.address, 8, 16, QLatin1Char('0'))));
m_table->setItem(i, 4, create_item());
QString flags;
if (bp.break_on_hit)
flags.append(QLatin1Char{'b'});
if (bp.log_on_hit)
flags.append(QLatin1Char{'l'});
m_table->setItem(i, 4, create_item(flags));
i++;
}
@ -308,7 +316,12 @@ void BreakpointWidget::OnSave()
void BreakpointWidget::AddBP(u32 addr)
{
PowerPC::breakpoints.Add(addr);
AddBP(addr, false, true, true);
}
void BreakpointWidget::AddBP(u32 addr, bool temp, bool break_on_hit, bool log_on_hit)
{
PowerPC::breakpoints.Add(addr, temp, break_on_hit, log_on_hit);
Update();
}

View File

@ -22,6 +22,7 @@ public:
~BreakpointWidget();
void AddBP(u32 addr);
void AddBP(u32 addr, bool temp, bool break_on_hit, bool log_on_hit);
void AddAddressMBP(u32 addr, bool on_read = true, bool on_write = true, bool do_log = true,
bool do_break = true);
void AddRangedMBP(u32 from, u32 to, bool do_read = true, bool do_write = true, bool do_log = true,

View File

@ -62,12 +62,12 @@ void NewBreakpointDialog::CreateWidgets()
m_memory_on_read_and_write = new QRadioButton(tr("Read or Write"));
m_memory_on_write->setChecked(true);
// i18n: This is a selectable action when adding a breakpoint
m_memory_do_log = new QRadioButton(tr("Write to Log"));
m_do_log = new QRadioButton(tr("Write to Log"));
// i18n: This is a selectable action when adding a breakpoint
m_memory_do_break = new QRadioButton(tr("Break"));
m_do_break = new QRadioButton(tr("Break"));
// i18n: This is a selectable action when adding a breakpoint
m_memory_do_log_and_break = new QRadioButton(tr("Write to Log and Break"));
m_memory_do_log_and_break->setChecked(true);
m_do_log_and_break = new QRadioButton(tr("Write to Log and Break"));
m_do_log_and_break->setChecked(true);
auto* memory_layout = new QGridLayout;
m_memory_box->setLayout(memory_layout);
@ -89,10 +89,9 @@ void NewBreakpointDialog::CreateWidgets()
QGroupBox* action_box = new QGroupBox(tr("Action"));
auto* action_layout = new QHBoxLayout;
action_box->setLayout(action_layout);
memory_layout->addWidget(action_box, 3, 0, 1, -1);
action_layout->addWidget(m_memory_do_log);
action_layout->addWidget(m_memory_do_break);
action_layout->addWidget(m_memory_do_log_and_break);
action_layout->addWidget(m_do_log);
action_layout->addWidget(m_do_break);
action_layout->addWidget(m_do_log_and_break);
auto* layout = new QVBoxLayout;
@ -100,6 +99,7 @@ void NewBreakpointDialog::CreateWidgets()
layout->addWidget(m_instruction_box);
layout->addWidget(m_memory_bp);
layout->addWidget(m_memory_box);
layout->addWidget(action_box);
layout->addWidget(m_buttons);
setLayout(layout);
@ -150,8 +150,8 @@ void NewBreakpointDialog::accept()
bool on_write = m_memory_on_write->isChecked() || m_memory_on_read_and_write->isChecked();
// Actions
bool do_log = m_memory_do_log->isChecked() || m_memory_do_log_and_break->isChecked();
bool do_break = m_memory_do_break->isChecked() || m_memory_do_log_and_break->isChecked();
bool do_log = m_do_log->isChecked() || m_do_log_and_break->isChecked();
bool do_break = m_do_break->isChecked() || m_do_log_and_break->isChecked();
bool good;
@ -165,7 +165,7 @@ void NewBreakpointDialog::accept()
return;
}
m_parent->AddBP(address);
m_parent->AddBP(address, false, do_break, do_log);
}
else
{

View File

@ -48,9 +48,11 @@ private:
QRadioButton* m_memory_on_read;
QRadioButton* m_memory_on_read_and_write;
QRadioButton* m_memory_on_write;
QRadioButton* m_memory_do_log;
QRadioButton* m_memory_do_break;
QRadioButton* m_memory_do_log_and_break;
// Action
QRadioButton* m_do_log;
QRadioButton* m_do_break;
QRadioButton* m_do_log_and_break;
QDialogButtonBox* m_buttons;
BreakpointWidget* m_parent;