Correct update after rename X used here

This commit is contained in:
Florian Märkl 2017-11-30 22:30:51 +01:00
parent a101d3508f
commit 8ca69ff5fc
5 changed files with 41 additions and 1 deletions

View File

@ -1253,6 +1253,21 @@ void CutterCore::addFlag(RVA offset, QString name, RVA size)
emit flagsChanged(); emit flagsChanged();
} }
void CutterCore::triggerFlagsChanged()
{
emit flagsChanged();
}
void CutterCore::triggerVarsChanged()
{
emit varsChanged();
}
void CutterCore::triggerFunctionRenamed(const QString &prevName, const QString &newName)
{
emit functionRenamed(prevName, newName);
}
void CutterCore::loadPDB(const QString &file) void CutterCore::loadPDB(const QString &file)
{ {
cmd("idp " + sanitizeStringForCommand(file)); cmd("idp " + sanitizeStringForCommand(file));

View File

@ -306,6 +306,10 @@ public:
QList<XrefDescription> getXRefs(RVA addr, bool to, bool whole_function, const QString &filterType = QString::null); QList<XrefDescription> getXRefs(RVA addr, bool to, bool whole_function, const QString &filterType = QString::null);
void addFlag(RVA offset, QString name, RVA size); void addFlag(RVA offset, QString name, RVA size);
void triggerFlagsChanged();
void triggerVarsChanged();
void triggerFunctionRenamed(const QString &prevName, const QString &newName);
void triggerRefreshAll(); void triggerRefreshAll();
@ -324,6 +328,7 @@ signals:
void refreshAll(); void refreshAll();
void functionRenamed(QString prev_name, QString new_name); void functionRenamed(QString prev_name, QString new_name);
void varsChanged();
void flagsChanged(); void flagsChanged();
void commentsChanged(); void commentsChanged();
void instructionChanged(RVA offset); void instructionChanged(RVA offset);

View File

@ -314,6 +314,8 @@ void DisassemblyContextMenu::on_actionRenameUsedHere_triggered()
RenameDialog *dialog = new RenameDialog(this); RenameDialog *dialog = new RenameDialog(this);
QString oldName;
if (type == "address") if (type == "address")
{ {
RVA offset = thingUsedHere["offset"].toVariant().toULongLong(); RVA offset = thingUsedHere["offset"].toVariant().toULongLong();
@ -322,7 +324,7 @@ void DisassemblyContextMenu::on_actionRenameUsedHere_triggered()
} }
else else
{ {
QString oldName = thingUsedHere.value("name").toString(); oldName = thingUsedHere.value("name").toString();
dialog->setWindowTitle(tr("Rename %1").arg(oldName)); dialog->setWindowTitle(tr("Rename %1").arg(oldName));
dialog->setName(oldName); dialog->setName(oldName);
} }
@ -333,6 +335,19 @@ void DisassemblyContextMenu::on_actionRenameUsedHere_triggered()
if (!newName.isEmpty()) if (!newName.isEmpty())
{ {
Core()->cmd("an " + newName + " @ " + QString::number(offset)); Core()->cmd("an " + newName + " @ " + QString::number(offset));
if (type == "address" || type == "flag")
{
Core()->triggerFlagsChanged();
}
else if (type == "var")
{
Core()->triggerVarsChanged();
}
else if (type == "function")
{
Core()->triggerFunctionRenamed(oldName, newName);
}
} }
} }
} }

View File

@ -77,6 +77,9 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent)
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshView())); connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshView()));
connect(Core(), SIGNAL(seekChanged(RVA)), this, SLOT(onSeekChanged(RVA))); connect(Core(), SIGNAL(seekChanged(RVA)), this, SLOT(onSeekChanged(RVA)));
connect(Core(), SIGNAL(commentsChanged()), this, SLOT(refreshView())); connect(Core(), SIGNAL(commentsChanged()), this, SLOT(refreshView()));
connect(Core(), SIGNAL(functionRenamed(QString, QString)), this, SLOT(refreshView()));
connect(Core(), SIGNAL(flagsChanged()), this, SLOT(refreshView()));
connect(Core(), SIGNAL(varsChanged()), this, SLOT(refreshView()));
connect(Core(), SIGNAL(instructionChanged(RVA)), this, SLOT(refreshView())); connect(Core(), SIGNAL(instructionChanged(RVA)), this, SLOT(refreshView()));
//connect(Bridge::getBridge(), SIGNAL(loadGraph(BridgeCFGraphList*, duint)), this, SLOT(loadGraphSlot(BridgeCFGraphList*, duint))); //connect(Bridge::getBridge(), SIGNAL(loadGraph(BridgeCFGraphList*, duint)), this, SLOT(loadGraphSlot(BridgeCFGraphList*, duint)));

View File

@ -82,6 +82,8 @@ DisassemblyWidget::DisassemblyWidget(QWidget *parent)
connect(Core(), SIGNAL(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType)), this, SLOT(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType))); connect(Core(), SIGNAL(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType)), this, SLOT(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType)));
connect(Core(), SIGNAL(commentsChanged()), this, SLOT(refreshDisasm())); connect(Core(), SIGNAL(commentsChanged()), this, SLOT(refreshDisasm()));
connect(Core(), SIGNAL(flagsChanged()), this, SLOT(refreshDisasm())); connect(Core(), SIGNAL(flagsChanged()), this, SLOT(refreshDisasm()));
connect(Core(), SIGNAL(functionRenamed(QString, QString)), this, SLOT(refreshDisasm()));
connect(Core(), SIGNAL(varsChanged()), this, SLOT(refreshDisasm()));
connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(refreshDisasm())); connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(refreshDisasm()));
connect(Core(), &CutterCore::instructionChanged, this, [this](RVA offset) { connect(Core(), &CutterCore::instructionChanged, this, [this](RVA offset) {
if (offset >= topOffset && offset <= bottomOffset) if (offset >= topOffset && offset <= bottomOffset)