Merge pull request #6304 from container1234/qt-debugger
Qt/Debugger: Minor fixes
This commit is contained in:
commit
973bd154b9
|
@ -74,6 +74,12 @@ void RegisterColumn::SetValue()
|
||||||
std::memcpy(&value, &f, sizeof(u32));
|
std::memcpy(&value, &f, sizeof(u32));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case RegisterDisplay::Double:
|
||||||
|
{
|
||||||
|
double f = text().toDouble(&valid);
|
||||||
|
std::memcpy(&value, &f, sizeof(u64));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!valid)
|
if (!valid)
|
||||||
|
@ -117,6 +123,13 @@ void RegisterColumn::Update()
|
||||||
text = QString::number(tmp);
|
text = QString::number(tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case RegisterDisplay::Double:
|
||||||
|
{
|
||||||
|
double tmp;
|
||||||
|
std::memcpy(&tmp, &m_value, sizeof(double));
|
||||||
|
text = QString::number(tmp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(text);
|
setText(text);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
enum class RegisterType
|
enum class RegisterType
|
||||||
{
|
{
|
||||||
gpr, // General purpose registers, int (r0-r31)
|
gpr, // General purpose registers, int (r0-r31)
|
||||||
fpr, // General purpose registers, float (f0-f31)
|
fpr, // Floating point registers, double (f0-f31)
|
||||||
ibat, // Instruction BATs (IBAT0-IBAT7)
|
ibat, // Instruction BATs (IBAT0-IBAT7)
|
||||||
dbat, // Data BATs (DBAT0-DBAT7)
|
dbat, // Data BATs (DBAT0-DBAT7)
|
||||||
tb, // Time base register
|
tb, // Time base register
|
||||||
|
@ -40,7 +40,8 @@ enum class RegisterDisplay
|
||||||
Hex,
|
Hex,
|
||||||
SInt32,
|
SInt32,
|
||||||
UInt32,
|
UInt32,
|
||||||
Float
|
Float,
|
||||||
|
Double
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr int DATA_TYPE = Qt::UserRole;
|
constexpr int DATA_TYPE = Qt::UserRole;
|
||||||
|
|
|
@ -131,8 +131,9 @@ void RegisterWidget::ShowContextMenu()
|
||||||
auto* view_int = menu->addAction(tr("Signed Integer"));
|
auto* view_int = menu->addAction(tr("Signed Integer"));
|
||||||
auto* view_uint = menu->addAction(tr("Unsigned Integer"));
|
auto* view_uint = menu->addAction(tr("Unsigned Integer"));
|
||||||
auto* view_float = menu->addAction(tr("Float"));
|
auto* view_float = menu->addAction(tr("Float"));
|
||||||
|
auto* view_double = menu->addAction(tr("Double"));
|
||||||
|
|
||||||
for (auto* action : {view_hex, view_int, view_uint, view_float})
|
for (auto* action : {view_hex, view_int, view_uint, view_float, view_double})
|
||||||
{
|
{
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setVisible(false);
|
action->setVisible(false);
|
||||||
|
@ -153,6 +154,9 @@ void RegisterWidget::ShowContextMenu()
|
||||||
case RegisterDisplay::Float:
|
case RegisterDisplay::Float:
|
||||||
view_float->setChecked(true);
|
view_float->setChecked(true);
|
||||||
break;
|
break;
|
||||||
|
case RegisterDisplay::Double:
|
||||||
|
view_double->setChecked(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -165,7 +169,7 @@ void RegisterWidget::ShowContextMenu()
|
||||||
break;
|
break;
|
||||||
case RegisterType::fpr:
|
case RegisterType::fpr:
|
||||||
view_hex->setVisible(true);
|
view_hex->setVisible(true);
|
||||||
view_float->setVisible(true);
|
view_double->setVisible(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -195,6 +199,12 @@ void RegisterWidget::ShowContextMenu()
|
||||||
m_updating = false;
|
m_updating = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(view_double, &QAction::triggered, [this, item] {
|
||||||
|
m_updating = true;
|
||||||
|
item->SetDisplay(RegisterDisplay::Double);
|
||||||
|
m_updating = false;
|
||||||
|
});
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +222,7 @@ void RegisterWidget::PopulateTable()
|
||||||
AddRegister(i, 0, RegisterType::gpr, "r" + std::to_string(i), [i] { return GPR(i); },
|
AddRegister(i, 0, RegisterType::gpr, "r" + std::to_string(i), [i] { return GPR(i); },
|
||||||
[i](u64 value) { GPR(i) = value; });
|
[i](u64 value) { GPR(i) = value; });
|
||||||
|
|
||||||
// General purpose registers (float)
|
// Floating point registers (double)
|
||||||
AddRegister(i, 2, RegisterType::fpr, "f" + std::to_string(i), [i] { return riPS0(i); },
|
AddRegister(i, 2, RegisterType::fpr, "f" + std::to_string(i), [i] { return riPS0(i); },
|
||||||
[i](u64 value) { riPS0(i) = value; });
|
[i](u64 value) { riPS0(i) = value; });
|
||||||
|
|
||||||
|
@ -323,7 +333,7 @@ void RegisterWidget::PopulateTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::string register_name,
|
void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::string register_name,
|
||||||
std::function<u32()> get_reg, std::function<void(u32)> set_reg)
|
std::function<u64()> get_reg, std::function<void(u64)> set_reg)
|
||||||
{
|
{
|
||||||
auto* value = new RegisterColumn(type, get_reg, set_reg);
|
auto* value = new RegisterColumn(type, get_reg, set_reg);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ private:
|
||||||
void OnItemChanged(QTableWidgetItem* item);
|
void OnItemChanged(QTableWidgetItem* item);
|
||||||
|
|
||||||
void AddRegister(int row, int column, RegisterType type, std::string register_name,
|
void AddRegister(int row, int column, RegisterType type, std::string register_name,
|
||||||
std::function<u32()> get_reg, std::function<void(u32)> set_reg);
|
std::function<u64()> get_reg, std::function<void(u64)> set_reg);
|
||||||
|
|
||||||
QTableWidget* m_table;
|
QTableWidget* m_table;
|
||||||
bool m_updating = false;
|
bool m_updating = false;
|
||||||
|
|
Loading…
Reference in New Issue