mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
Fix XrefsDialog, X-Refs in Sidebar from JSON
This commit is contained in:
parent
132cebf8a1
commit
f35ce99495
@ -3,10 +3,15 @@
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
|
||||
XrefsDialog::XrefsDialog(MainWindow *main, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::XrefsDialog)
|
||||
{
|
||||
addr = 0;
|
||||
func_name = QString::null;
|
||||
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
this->main = main;
|
||||
@ -27,12 +32,12 @@ XrefsDialog::~XrefsDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void XrefsDialog::fillRefs(QList<XRefDescription> refs, QList<XRefDescription> xrefs)
|
||||
void XrefsDialog::fillRefs(QList<XrefDescription> refs, QList<XrefDescription> xrefs)
|
||||
{
|
||||
ui->fromTreeWidget->clear();
|
||||
for (int i = 0; i < refs.size(); ++i)
|
||||
{
|
||||
XRefDescription xref = refs[i];
|
||||
XrefDescription xref = refs[i];
|
||||
|
||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, RAddressString(xref.to));
|
||||
@ -53,7 +58,7 @@ void XrefsDialog::fillRefs(QList<XRefDescription> refs, QList<XRefDescription> x
|
||||
ui->toTreeWidget->clear();
|
||||
for (int i = 0; i < xrefs.size(); ++i)
|
||||
{
|
||||
XRefDescription xref = xrefs[i];
|
||||
XrefDescription xref = xrefs[i];
|
||||
|
||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, RAddressString(xref.from));
|
||||
@ -77,10 +82,10 @@ void XrefsDialog::on_fromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
QString offset = item->text(0);
|
||||
RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16));
|
||||
//this->add_debug_output( fcn->name );
|
||||
this->main->seek(offset, fcn->name);
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
RAnalFunction *fcn = this->main->core->functionAt(xref.to);
|
||||
this->main->seek(xref.to, fcn ? QString::fromUtf8(fcn->name) : QString::null, true);
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
@ -88,10 +93,10 @@ void XrefsDialog::on_toTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int c
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
QString offset = item->text(0);
|
||||
RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16));
|
||||
//this->add_debug_output( fcn->name );
|
||||
this->main->seek(offset, fcn->name);
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
RAnalFunction *fcn = this->main->core->functionAt(xref.from);
|
||||
this->main->seek(xref.from, fcn ? QString::fromUtf8(fcn->name) : QString::null, true);
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
@ -135,24 +140,39 @@ void XrefsDialog::highlightCurrentLine()
|
||||
|
||||
void XrefsDialog::on_fromTreeWidget_itemSelectionChanged()
|
||||
{
|
||||
if (ui->fromTreeWidget->selectedItems().isEmpty())
|
||||
return;
|
||||
ui->toTreeWidget->clearSelection();
|
||||
QTreeWidgetItem *item = ui->fromTreeWidget->currentItem();
|
||||
QString offset = item->text(0);
|
||||
ui->previewTextEdit->setPlainText(this->main->core->cmd("pdf @ " + offset).trimmed());
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::End);
|
||||
// Does it make any sense?
|
||||
ui->previewTextEdit->find(this->normalizeAddr(offset), QTextDocument::FindBackward);
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
updatePreview(xref.to);
|
||||
}
|
||||
|
||||
void XrefsDialog::on_toTreeWidget_itemSelectionChanged()
|
||||
{
|
||||
if (ui->toTreeWidget->selectedItems().isEmpty())
|
||||
return;
|
||||
ui->fromTreeWidget->clearSelection();
|
||||
QTreeWidgetItem *item = ui->toTreeWidget->currentItem();
|
||||
QString offset = item->text(0);
|
||||
ui->previewTextEdit->setPlainText(this->main->core->cmd("pdf @ " + offset).trimmed());
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
updatePreview(xref.from);
|
||||
}
|
||||
|
||||
void XrefsDialog::updatePreview(RVA addr)
|
||||
{
|
||||
QString disass;
|
||||
|
||||
// is the address part of a function, so we can use pdf?
|
||||
if (!main->core->cmdj("afij@" + QString::number(addr)).array().isEmpty())
|
||||
disass = main->core->cmd("pdf @ " + QString::number(addr));
|
||||
else
|
||||
disass = main->core->cmd("pd 10 @ " + QString::number(addr));
|
||||
|
||||
ui->previewTextEdit->setPlainText(disass.trimmed());
|
||||
|
||||
// Does it make any sense?
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::End);
|
||||
// Again, does it make any sense?
|
||||
// Also, this code should be refactored and shared instead of copied & pasted
|
||||
ui->previewTextEdit->find(this->normalizeAddr(offset), QTextDocument::FindBackward);
|
||||
ui->previewTextEdit->find(this->normalizeAddr(RAddressString(addr)), QTextDocument::FindBackward);
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
||||
}
|
||||
|
||||
@ -164,15 +184,18 @@ void XrefsDialog::updateLabels(QString name)
|
||||
|
||||
void XrefsDialog::fillRefsForFunction(RVA addr, QString name)
|
||||
{
|
||||
this->addr = addr;
|
||||
this->func_name = func_name;
|
||||
|
||||
setWindowTitle(tr("X-Refs for function %1").arg(name));
|
||||
updateLabels(name);
|
||||
// Get Refs and Xrefs
|
||||
|
||||
// refs = calls q hace esa funcion
|
||||
QList<XRefDescription> refs = main->core->getXRefs(addr, false, "C");
|
||||
QList<XrefDescription> refs = main->core->getXRefs(addr, false, "C");
|
||||
|
||||
// xrefs = calls a esa funcion
|
||||
QList<XRefDescription> xrefs = main->core->getXRefs(addr, true);
|
||||
QList<XrefDescription> xrefs = main->core->getXRefs(addr, true);
|
||||
|
||||
fillRefs(refs, xrefs);
|
||||
}
|
@ -38,13 +38,17 @@ private slots:
|
||||
void on_toTreeWidget_itemSelectionChanged();
|
||||
|
||||
private:
|
||||
RVA addr;
|
||||
QString func_name;
|
||||
|
||||
Ui::XrefsDialog *ui;
|
||||
MainWindow *main;
|
||||
|
||||
Highlighter *highlighter;
|
||||
|
||||
void fillRefs(QList<XRefDescription> refs, QList<XRefDescription> xrefs);
|
||||
void fillRefs(QList<XrefDescription> refs, QList<XrefDescription> xrefs);
|
||||
void updateLabels(QString name);
|
||||
void updatePreview(RVA addr);
|
||||
|
||||
};
|
||||
|
||||
|
@ -327,7 +327,6 @@ void MainWindow::finalizeOpen()
|
||||
core->cmd("fs sections");
|
||||
updateFrames();
|
||||
|
||||
get_refs(core->cmd("?v entry0"));
|
||||
memoryDock->selectHexPreview();
|
||||
|
||||
// Restore project notes
|
||||
@ -770,7 +769,7 @@ void MainWindow::seek(const RVA offset, const QString &name, bool raise_memory_d
|
||||
core->seek(offset);
|
||||
setCursorAddress(offset);
|
||||
|
||||
refreshMem(offset);
|
||||
refreshMem();
|
||||
this->memoryDock->disasTextEdit->setFocus();
|
||||
|
||||
// Rise and shine baby!
|
||||
@ -781,22 +780,8 @@ void MainWindow::seek(const RVA offset, const QString &name, bool raise_memory_d
|
||||
void MainWindow::refreshMem()
|
||||
{
|
||||
this->memoryDock->updateViews();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::refreshMem(RVA offset)
|
||||
{
|
||||
//add_debug_output("Refreshing to: " + off);
|
||||
//graphicsBar->refreshColorBar();
|
||||
/*
|
||||
this->memoryDock->refreshDisasm(off);
|
||||
this->memoryDock->refreshHexdump(off);
|
||||
this->memoryDock->create_graph(off);
|
||||
*/
|
||||
refreshMem();
|
||||
this->memoryDock->get_refs_data(RAddressString(offset));
|
||||
//this->memoryDock->setFcnName(offset);
|
||||
}
|
||||
|
||||
void MainWindow::on_backButton_clicked()
|
||||
{
|
||||
@ -922,11 +907,6 @@ void MainWindow::on_actionFunctionsRename_triggered()
|
||||
r->open();
|
||||
}
|
||||
|
||||
void MainWindow::get_refs(const QString &offset)
|
||||
{
|
||||
this->memoryDock->get_refs_data(offset);
|
||||
}
|
||||
|
||||
void MainWindow::addOutput(const QString &msg)
|
||||
{
|
||||
consoleWidget->addOutput(msg);
|
||||
|
@ -71,7 +71,6 @@ public:
|
||||
void updateFrames();
|
||||
void refreshFunctions();
|
||||
void refreshComments();
|
||||
void get_refs(const QString &offset);
|
||||
void addOutput(const QString &msg);
|
||||
void addDebugOutput(const QString &msg);
|
||||
void sendToNotepad(const QString &txt);
|
||||
@ -180,7 +179,6 @@ private:
|
||||
|
||||
bool doLock;
|
||||
void refreshMem();
|
||||
void refreshMem(RVA offset);
|
||||
ut64 hexdumpTopOffset;
|
||||
ut64 hexdumpBottomOffset;
|
||||
QString filename;
|
||||
|
@ -463,15 +463,13 @@ int QRCore::fcnBasicBlockCount(ut64 addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QRCore::fcnEndBbs(QString addr)
|
||||
int QRCore::fcnEndBbs(RVA addr)
|
||||
{
|
||||
CORE_LOCK();
|
||||
bool ok;
|
||||
int offset = addr.toLong(&ok, 16);
|
||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, offset, 0);
|
||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
||||
if (fcn)
|
||||
{
|
||||
QString tmp = this->cmd("afi @ " + addr + " ~end-bbs").split("\n")[0];
|
||||
QString tmp = this->cmd("afi @ " + QString::number(addr) + " ~end-bbs").split("\n")[0];
|
||||
if (tmp.contains(":"))
|
||||
{
|
||||
QString endbbs = tmp.split(": ")[1];
|
||||
@ -1092,52 +1090,9 @@ QList<SectionDescription> QRCore::getAllSections()
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QList<QString> QRCore::getFunctionXrefs(ut64 addr)
|
||||
QList<XrefDescription> QRCore::getXRefs(RVA addr, bool to, const QString &filterType)
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<QString> ret = QList<QString>();
|
||||
RList *list = r_anal_xrefs_get(core_->anal, addr);
|
||||
RAnalRef *ref;
|
||||
RListIter *it;
|
||||
QRListForeach(list, it, RAnalRef, ref)
|
||||
{
|
||||
ret << QString("%1,0x%2,0x%3").arg(
|
||||
QString(ref->type),
|
||||
QString::number(ref->addr, 16),
|
||||
QString::number(ref->at, 16));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<QString> QRCore::getFunctionRefs(ut64 addr, char type)
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<QString> ret = QList<QString>();
|
||||
//RAnalFunction *fcn = r_anal_get_fcn_at(core_->anal, addr, addr);
|
||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
||||
if (!fcn)
|
||||
{
|
||||
eprintf("qcore->getFunctionRefs: No function found\n");
|
||||
return ret;
|
||||
}
|
||||
//eprintf(fcn->name);
|
||||
RAnalRef *ref;
|
||||
RListIter *it;
|
||||
QRListForeach(fcn->refs, it, RAnalRef, ref)
|
||||
{
|
||||
if (type == ref->type || type == 0)
|
||||
ret << QString("%1,0x%2,0x%3").arg(
|
||||
QString(ref->type),
|
||||
QString::number(ref->addr, 16),
|
||||
QString::number(ref->at, 16));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<XRefDescription> QRCore::getXRefs(RVA addr, bool to, const QString &filterType)
|
||||
{
|
||||
QList<XRefDescription> ret = QList<XRefDescription>();
|
||||
QList<XrefDescription> ret = QList<XrefDescription>();
|
||||
|
||||
QJsonArray xrefsArray;
|
||||
|
||||
@ -1150,7 +1105,7 @@ QList<XRefDescription> QRCore::getXRefs(RVA addr, bool to, const QString &filter
|
||||
{
|
||||
QJsonObject xrefObject = value.toObject();
|
||||
|
||||
XRefDescription xref;
|
||||
XrefDescription xref;
|
||||
xref.type = xrefObject["type"].toString();
|
||||
|
||||
if (!filterType.isNull() && filterType != xref.type)
|
||||
|
11
src/qrcore.h
11
src/qrcore.h
@ -134,7 +134,7 @@ struct SectionDescription
|
||||
QString flags;
|
||||
};
|
||||
|
||||
struct XRefDescription
|
||||
struct XrefDescription
|
||||
{
|
||||
RVA from;
|
||||
RVA to;
|
||||
@ -150,7 +150,7 @@ Q_DECLARE_METATYPE(RelocDescription)
|
||||
Q_DECLARE_METATYPE(StringDescription)
|
||||
Q_DECLARE_METATYPE(FlagspaceDescription)
|
||||
Q_DECLARE_METATYPE(FlagDescription)
|
||||
Q_DECLARE_METATYPE(XRefDescription)
|
||||
Q_DECLARE_METATYPE(XrefDescription)
|
||||
|
||||
class QRCore : public QObject
|
||||
{
|
||||
@ -167,7 +167,7 @@ public:
|
||||
int getFcnSize(ut64 addr);
|
||||
int fcnCyclomaticComplexity(ut64 addr);
|
||||
int fcnBasicBlockCount(ut64 addr);
|
||||
int fcnEndBbs(QString addr);
|
||||
int fcnEndBbs(RVA addr);
|
||||
QString cmd(const QString &str);
|
||||
QJsonDocument cmdj(const QString &str);
|
||||
void renameFunction(QString prev_name, QString new_name);
|
||||
@ -234,10 +234,7 @@ public:
|
||||
QList<FlagDescription> getAllFlags(QString flagspace = NULL);
|
||||
QList<SectionDescription> getAllSections();
|
||||
|
||||
|
||||
QList<QString> getFunctionXrefs(ut64 addr);
|
||||
QList<QString> getFunctionRefs(ut64 addr, char type);
|
||||
QList<XRefDescription> getXRefs(RVA addr, bool to, const QString &filterType = QString::null);
|
||||
QList<XrefDescription> getXRefs(RVA addr, bool to, const QString &filterType = QString::null);
|
||||
|
||||
RCoreLocked core() const;
|
||||
|
||||
|
@ -202,6 +202,7 @@ MemoryWidget::MemoryWidget(MainWindow *main) :
|
||||
void MemoryWidget::on_cursorAddressChanged(RVA addr)
|
||||
{
|
||||
setFcnName(addr);
|
||||
get_refs_data(addr);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -404,7 +405,7 @@ void MemoryWidget::setup()
|
||||
refreshDisasm(off);
|
||||
refreshHexdump(off);
|
||||
create_graph(off);
|
||||
get_refs_data(off);
|
||||
get_refs_data(off.toLongLong(0, 16));
|
||||
//setFcnName(off);
|
||||
}
|
||||
|
||||
@ -1296,7 +1297,6 @@ void MemoryWidget::on_actionFunctionsRename_triggered()
|
||||
this->main->core->renameFunction(fcn->name, new_name);
|
||||
// Seek to new renamed function
|
||||
this->main->seek(new_name);
|
||||
// TODO: Refresh functions tree widget
|
||||
}
|
||||
}
|
||||
this->main->refreshFunctions();
|
||||
@ -1346,18 +1346,16 @@ void MemoryWidget::on_action1column_triggered()
|
||||
|
||||
void MemoryWidget::on_xreFromTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||
{
|
||||
QString offset = item->text(0);
|
||||
RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16));
|
||||
//this->add_debug_output( fcn->name );
|
||||
this->main->seek(offset, fcn->name);
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
RAnalFunction *fcn = this->main->core->functionAt(xref.to);
|
||||
this->main->seek(xref.to, fcn ? QString::fromUtf8(fcn->name) : QString::null, true);
|
||||
}
|
||||
|
||||
void MemoryWidget::on_xrefToTreeWidget_2_itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||
{
|
||||
QString offset = item->text(0);
|
||||
RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16));
|
||||
//this->add_debug_output( fcn->name );
|
||||
this->main->seek(offset, fcn->name);
|
||||
XrefDescription xref = item->data(0, Qt::UserRole).value<XrefDescription>();
|
||||
RAnalFunction *fcn = this->main->core->functionAt(xref.from);
|
||||
this->main->seek(xref.from, fcn ? QString::fromUtf8(fcn->name) : QString::null, true);
|
||||
}
|
||||
|
||||
void MemoryWidget::on_xrefFromToolButton_2_clicked()
|
||||
@ -1402,47 +1400,13 @@ void MemoryWidget::on_codeCombo_2_currentTextChanged(const QString &arg1)
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryWidget::get_refs_data(const QString &offset)
|
||||
void MemoryWidget::get_refs_data(RVA addr)
|
||||
{
|
||||
// Get Refs and Xrefs
|
||||
bool ok;
|
||||
QList<QStringList> ret_refs;
|
||||
QList<QStringList> ret_xrefs;
|
||||
|
||||
// refs = calls q hace esa funcion
|
||||
QList<QString> refs = this->main->core->getFunctionRefs(offset.toLong(&ok, 16), 'C');
|
||||
if (refs.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < refs.size(); ++i)
|
||||
{
|
||||
//this->add_debug_output(refs.at(i));
|
||||
QStringList retlist = refs.at(i).split(",");
|
||||
QStringList temp;
|
||||
QString addr = retlist.at(2);
|
||||
temp << addr;
|
||||
QString op = this->main->core->cmd("pi 1 @ " + addr);
|
||||
temp << op.simplified();
|
||||
ret_refs << temp;
|
||||
}
|
||||
}
|
||||
QList<XrefDescription> refs = main->core->getXRefs(addr, false, "C");
|
||||
|
||||
// xrefs = calls a esa funcion
|
||||
//qDebug() << this->main->core->getFunctionXrefs(offset.toLong(&ok, 16));
|
||||
QList<QString> xrefs = this->main->core->getFunctionXrefs(offset.toLong(&ok, 16));
|
||||
if (xrefs.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < xrefs.size(); ++i)
|
||||
{
|
||||
//this->add_debug_output(xrefs.at(i));
|
||||
QStringList retlist = xrefs.at(i).split(",");
|
||||
QStringList temp;
|
||||
QString addr = retlist.at(1);
|
||||
temp << addr;
|
||||
QString op = this->main->core->cmd("pi 1 @ " + addr);
|
||||
temp << op.simplified();
|
||||
ret_xrefs << temp;
|
||||
}
|
||||
}
|
||||
QList<XrefDescription> xrefs = main->core->getXRefs(addr, true);
|
||||
|
||||
// Data for the disasm side graph
|
||||
QList<int> data;
|
||||
@ -1452,27 +1416,29 @@ void MemoryWidget::get_refs_data(const QString &offset)
|
||||
data << xrefs.size();
|
||||
//qDebug() << "CC: " << this->main->core->fcnCyclomaticComplexity(offset.toLong(&ok, 16));
|
||||
//data << this->main->core->fcnCyclomaticComplexity(offset.toLong(&ok, 16));
|
||||
data << this->main->core->getCycloComplex(offset.toLong(&ok, 16));
|
||||
data << this->main->core->getCycloComplex(addr);
|
||||
//qDebug() << "BB: " << this->main->core->fcnBasicBlockCount(offset.toLong(&ok, 16));
|
||||
data << this->main->core->fcnBasicBlockCount(offset.toLong(&ok, 16));
|
||||
data << this->main->core->fcnEndBbs(offset);
|
||||
data << this->main->core->fcnBasicBlockCount(addr);
|
||||
data << this->main->core->fcnEndBbs(addr);
|
||||
//qDebug() << "MEOW: " + this->main->core->fcnEndBbs(offset);
|
||||
|
||||
// Update disasm side bar
|
||||
this->fill_refs(ret_refs, ret_xrefs, data);
|
||||
this->fill_refs(refs, xrefs, data);
|
||||
}
|
||||
|
||||
void MemoryWidget::fill_refs(QList<QStringList> refs, QList<QStringList> xrefs, QList<int> graph_data)
|
||||
void MemoryWidget::fill_refs(QList<XrefDescription> refs, QList<XrefDescription> xrefs, QList<int> graph_data)
|
||||
{
|
||||
this->xreFromTreeWidget_2->clear();
|
||||
for (int i = 0; i < refs.size(); ++i)
|
||||
{
|
||||
//this->add_debug_output(refs.at(i).at(0) + " " + refs.at(i).at(1));
|
||||
XrefDescription xref = refs[i];
|
||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, refs.at(i).at(0));
|
||||
tempItem->setText(1, refs.at(i).at(1));
|
||||
tempItem->setToolTip(0, this->main->core->cmd("pdi 10 @ " + refs.at(i).at(0)).trimmed());
|
||||
tempItem->setToolTip(1, this->main->core->cmd("pdi 10 @ " + refs.at(i).at(0)).trimmed());
|
||||
tempItem->setText(0, RAddressString(xref.to));
|
||||
tempItem->setText(1, main->core->disassembleSingleInstruction(xref.from));
|
||||
tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref));
|
||||
QString tooltip = this->main->core->cmd("pdi 10 @ " + QString::number(xref.to)).trimmed();
|
||||
tempItem->setToolTip(0, tooltip);
|
||||
tempItem->setToolTip(1, tooltip);
|
||||
this->xreFromTreeWidget_2->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
// Adjust columns to content
|
||||
@ -1485,12 +1451,15 @@ void MemoryWidget::fill_refs(QList<QStringList> refs, QList<QStringList> xrefs,
|
||||
this->xrefToTreeWidget_2->clear();
|
||||
for (int i = 0; i < xrefs.size(); ++i)
|
||||
{
|
||||
//this->add_debug_output(xrefs.at(i).at(0) + " " + xrefs.at(i).at(1));
|
||||
XrefDescription xref = xrefs[i];
|
||||
|
||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, xrefs.at(i).at(0));
|
||||
tempItem->setText(1, xrefs.at(i).at(1));
|
||||
tempItem->setToolTip(0, this->main->core->cmd("pdi 10 @ " + xrefs.at(i).at(0)).trimmed());
|
||||
tempItem->setToolTip(1, this->main->core->cmd("pdi 10 @ " + xrefs.at(i).at(0)).trimmed());
|
||||
tempItem->setText(0, RAddressString(xref.from));
|
||||
tempItem->setText(1, main->core->disassembleSingleInstruction(xref.from));
|
||||
tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref));
|
||||
QString tooltip = this->main->core->cmd("pdi 10 @ " + QString::number(xref.from)).trimmed();
|
||||
tempItem->setToolTip(0, this->main->core->cmd("pdi 10 @ " + tooltip).trimmed());
|
||||
tempItem->setToolTip(1, this->main->core->cmd("pdi 10 @ " + tooltip).trimmed());
|
||||
this->xrefToTreeWidget_2->insertTopLevelItem(0, tempItem);
|
||||
}
|
||||
// Adjust columns to content
|
||||
@ -1670,7 +1639,6 @@ void MemoryWidget::on_disasTextEdit_2_cursorPositionChanged()
|
||||
// Refresh function information at sidebar
|
||||
ui->fcnNameEdit->setText(at);
|
||||
this->main->memoryDock->setWindowTitle(at);
|
||||
this->main->memoryDock->get_refs_data(ele);
|
||||
//this->main->memoryDock->create_graph(ele);
|
||||
this->setMiniGraph(at);
|
||||
}
|
||||
|
@ -70,12 +70,10 @@ public slots:
|
||||
|
||||
void refreshHexdump(const QString &where = QString());
|
||||
|
||||
void fill_refs(QList<QStringList> refs, QList<QStringList> xrefs, QList<int> graph_data);
|
||||
void fill_refs(QList<XrefDescription> refs, QList<XrefDescription> xrefs, QList<int> graph_data);
|
||||
|
||||
void fillOffsetInfo(QString off);
|
||||
|
||||
void get_refs_data(const QString &offset);
|
||||
|
||||
void seek_to(const QString &offset);
|
||||
|
||||
void create_graph(QString off);
|
||||
@ -112,6 +110,7 @@ private:
|
||||
RVA last_hexdump_fcn;
|
||||
|
||||
void setFcnName(RVA addr);
|
||||
void get_refs_data(RVA addr);
|
||||
|
||||
void setScrollMode();
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>990</width>
|
||||
<height>767</height>
|
||||
<width>1078</width>
|
||||
<height>815</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -1325,7 +1325,7 @@ border-top: 0px;
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-175</y>
|
||||
<y>-127</y>
|
||||
<width>256</width>
|
||||
<height>887</height>
|
||||
</rect>
|
||||
@ -1866,20 +1866,17 @@ color: rgb(0, 0, 0);</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="xrefFromToolButton_2">
|
||||
<widget class="QToolButton" name="xrefToToolButton_2">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@ -1899,16 +1896,22 @@ color: rgb(0, 0, 0);</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="xrefFromLabel_2">
|
||||
<widget class="QLabel" name="xrefToLabel_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><b>Xrefs from:</b></string>
|
||||
<string>X-Refs to current address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="xreFromTreeWidget_2">
|
||||
<widget class="QTreeWidget" name="xrefToTreeWidget_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -1974,17 +1977,20 @@ QToolTip {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="xrefToToolButton_2">
|
||||
<widget class="QToolButton" name="xrefFromToolButton_2">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@ -2004,16 +2010,22 @@ QToolTip {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="xrefToLabel_2">
|
||||
<widget class="QLabel" name="xrefFromLabel_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><b>Xrefs To:</b></string>
|
||||
<string>X-Refs from current address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="xrefToTreeWidget_2">
|
||||
<widget class="QTreeWidget" name="xreFromTreeWidget_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -3031,8 +3043,8 @@ QToolTip {
|
||||
</resources>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup_2"/>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
<buttongroup name="buttonGroup_3"/>
|
||||
<buttongroup name="buttonGroup_2"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user