Fix #69 (xref name resolving)

This commit is contained in:
xarkes 2017-11-27 17:05:10 +01:00
parent e5859a8422
commit d8d4de9625
4 changed files with 12 additions and 15 deletions

View File

@ -1219,6 +1219,7 @@ QList<XrefDescription> CutterCore::getXRefs(RVA addr, bool to, bool whole_functi
continue;
xref.from = xrefObject["from"].toVariant().toULongLong();
xref.from_str = Core()->cmd("fd " + xrefObject["from"].toString()).trimmed();
if (!whole_function && !to && xref.from != addr)
continue;
@ -1227,6 +1228,7 @@ QList<XrefDescription> CutterCore::getXRefs(RVA addr, bool to, bool whole_functi
xref.to = addr;
else
xref.to = xrefObject["to"].toVariant().toULongLong();
xref.to_str = Core()->cmd("fd " + xrefObject["to"].toString()).trimmed();
ret << xref;
}

View File

@ -153,7 +153,9 @@ struct EntrypointDescription
struct XrefDescription
{
RVA from;
QString from_str;
RVA to;
QString to_str;
QString type;
};

View File

@ -42,12 +42,9 @@ void XrefsDialog::fillRefs(QList<XrefDescription> refs, QList<XrefDescription> x
XrefDescription xref = refs[i];
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, RAddressString(xref.to));
tempItem->setText(0, xref.to_str);
tempItem->setText(1, core->disassembleSingleInstruction(xref.from));
tempItem->setText(2, xrefTypeString(xref.type));
tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref));
//tempItem->setToolTip( 0, this->core->cmd("pdi 10 @ " + refs.at(i).at(0)) );
//tempItem->setToolTip( 1, this->core->cmd("pdi 10 @ " + refs.at(i).at(0)) );
ui->fromTreeWidget->insertTopLevelItem(0, tempItem);
}
// Adjust columns to content
@ -64,12 +61,9 @@ void XrefsDialog::fillRefs(QList<XrefDescription> refs, QList<XrefDescription> x
XrefDescription xref = xrefs[i];
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, RAddressString(xref.from));
tempItem->setText(0, xref.from_str);
tempItem->setText(1, core->disassembleSingleInstruction(xref.from));
tempItem->setText(2, xrefTypeString(xref.type));
tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref));
//tempItem->setToolTip( 0, this->core->cmd("pdi 10 @ " + xrefs.at(i).at(0)) );
//tempItem->setToolTip( 1, this->core->cmd("pdi 10 @ " + xrefs.at(i).at(0)) );
ui->toTreeWidget->insertTopLevelItem(0, tempItem);
}
// Adjust columns to content
@ -78,7 +72,6 @@ void XrefsDialog::fillRefs(QList<XrefDescription> refs, QList<XrefDescription> x
{
ui->toTreeWidget->resizeColumnToContents(i);
}
}
void XrefsDialog::on_fromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
@ -193,8 +186,8 @@ void XrefsDialog::updatePreview(RVA addr)
void XrefsDialog::updateLabels(QString name)
{
ui->label_2->setText(tr("X-Refs to %1:").arg(name));
ui->label_3->setText(tr("X-Refs from %1:").arg(name));
ui->label_xTo->setText(tr("X-Refs to %1:").arg(name));
ui->label_xFrom->setText(tr("X-Refs from %1:").arg(name));
}
void XrefsDialog::fillRefsForAddress(RVA addr, QString name, bool whole_function)

View File

@ -38,12 +38,12 @@
<number>5</number>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="xrefLayout">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_xTo">
<property name="text">
<string notr="true">X-Refs to: </string>
</property>
@ -81,7 +81,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="label_xFrom">
<property name="text">
<string notr="true">X-Refs from: </string>
</property>
@ -121,7 +121,7 @@
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="previewLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">