mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 10:58:51 +00:00
Added register references to registerwidget tooltip
This commit is contained in:
parent
a4d160dd3d
commit
c6e1d20907
@ -772,6 +772,21 @@ QList<RegisterRefDescription> CutterCore::getRegisterRefs()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QJsonObject CutterCore::getRegisterJson()
|
||||||
|
{
|
||||||
|
QJsonArray registerRefArray = cmdj("drrj").array();
|
||||||
|
QJsonObject registerJson;
|
||||||
|
for (QJsonValue value : registerRefArray) {
|
||||||
|
QJsonObject regRefObject = value.toObject();
|
||||||
|
|
||||||
|
QJsonObject registers;
|
||||||
|
registers.insert("value", regRefObject["value"]);
|
||||||
|
registers.insert("ref", regRefObject["ref"]);
|
||||||
|
registerJson.insert(regRefObject["reg"].toString(), registers);
|
||||||
|
}
|
||||||
|
return registerJson;
|
||||||
|
}
|
||||||
|
|
||||||
QString CutterCore::getRegisterName(QString registerRole)
|
QString CutterCore::getRegisterName(QString registerRole)
|
||||||
{
|
{
|
||||||
return cmd("drn " + registerRole).trimmed();
|
return cmd("drn " + registerRole).trimmed();
|
||||||
|
@ -575,6 +575,7 @@ public:
|
|||||||
QList<BreakpointDescription> getBreakpoints();
|
QList<BreakpointDescription> getBreakpoints();
|
||||||
QList<ProcessDescription> getAllProcesses();
|
QList<ProcessDescription> getAllProcesses();
|
||||||
QList<RegisterRefDescription> getRegisterRefs();
|
QList<RegisterRefDescription> getRegisterRefs();
|
||||||
|
QJsonObject getRegisterJson();
|
||||||
|
|
||||||
QList<XrefDescription> getXRefs(RVA addr, bool to, bool whole_function,
|
QList<XrefDescription> getXRefs(RVA addr, bool to, bool whole_function,
|
||||||
const QString &filterType = QString::null);
|
const QString &filterType = QString::null);
|
||||||
|
@ -59,8 +59,9 @@ void RegistersWidget::setRegisterGrid()
|
|||||||
QLabel *registerLabel;
|
QLabel *registerLabel;
|
||||||
QLineEdit *registerEditValue;
|
QLineEdit *registerEditValue;
|
||||||
QJsonObject registerValues = Core()->getRegisterValues().object();
|
QJsonObject registerValues = Core()->getRegisterValues().object();
|
||||||
|
QJsonObject registerRefs = Core()->getRegisterJson();
|
||||||
QStringList registerNames = registerValues.keys();
|
QStringList registerNames = registerValues.keys();
|
||||||
registerLen = registerNames.size();
|
registerLen = registerValues.size();
|
||||||
for (const QString &key : registerNames) {
|
for (const QString &key : registerNames) {
|
||||||
regValue = RAddressString(registerValues[key].toVariant().toULongLong());
|
regValue = RAddressString(registerValues[key].toVariant().toULongLong());
|
||||||
// check if we already filled this grid space with label/value
|
// check if we already filled this grid space with label/value
|
||||||
@ -79,7 +80,8 @@ void RegistersWidget::setRegisterGrid()
|
|||||||
QString regNameString = registerLabel->text();
|
QString regNameString = registerLabel->text();
|
||||||
QString regValueString = registerEditValue->text();
|
QString regValueString = registerEditValue->text();
|
||||||
Core()->setRegister(regNameString, regValueString);
|
Core()->setRegister(regNameString, regValueString);
|
||||||
printf("dr %s %s\n", regNameString.toLocal8Bit().constData(), regValueString.toLocal8Bit().constData());
|
printf("dr %s %s\n", regNameString.toLocal8Bit().constData(),
|
||||||
|
regValueString.toLocal8Bit().constData());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
QWidget *regNameWidget = registerLayout->itemAtPosition(i, col)->widget();
|
QWidget *regNameWidget = registerLayout->itemAtPosition(i, col)->widget();
|
||||||
@ -96,6 +98,12 @@ void RegistersWidget::setRegisterGrid()
|
|||||||
}
|
}
|
||||||
// define register label and value
|
// define register label and value
|
||||||
registerLabel->setText(key);
|
registerLabel->setText(key);
|
||||||
|
if (registerRefs.contains(key)) {
|
||||||
|
// add register references to tooltips
|
||||||
|
QString reference = registerRefs[key].toObject()["ref"].toString();
|
||||||
|
registerLabel->setToolTip(reference);
|
||||||
|
registerEditValue->setToolTip(reference);
|
||||||
|
}
|
||||||
registerEditValue->setPlaceholderText(regValue);
|
registerEditValue->setPlaceholderText(regValue);
|
||||||
registerEditValue->setText(regValue);
|
registerEditValue->setText(regValue);
|
||||||
i++;
|
i++;
|
||||||
|
Loading…
Reference in New Issue
Block a user