Add a signal for widget rebasing and switch to oodf for remote debug rebasing (#1913)

* Add codeRebased to sync widgets after debug starts
* Switch attachDebug to oodf to enable rebasing
This commit is contained in:
yossizap 2019-12-11 22:18:40 +00:00 committed by Itay Cohen
parent 519cd5dabd
commit a8bc37f0de
17 changed files with 42 additions and 19 deletions

View File

@ -1265,9 +1265,10 @@ void CutterCore::startDebug()
setConfig("asm.flags", false);
currentlyDebugging = true;
emit changeDebugView();
emit flagsChanged();
emit refreshCodeViews();
}
emit codeRebased();
emit stackChanged();
emit debugTaskStateChanged();
});
@ -1306,10 +1307,11 @@ void CutterCore::startEmulation()
currentlyDebugging = true;
currentlyEmulating = true;
emit changeDebugView();
emit flagsChanged();
}
emit registersChanged();
emit stackChanged();
emit codeRebased();
emit refreshCodeViews();
emit debugTaskStateChanged();
});
@ -1330,7 +1332,7 @@ void CutterCore::attachRemote(const QString &uri)
}
// connect to a debugger with the given plugin
asyncCmd("o-*; e cfg.debug = true; o+ " + uri, debugTask);
asyncCmd("e cfg.debug = true; oodf " + uri, debugTask);
emit debugTaskStateChanged();
connect(debugTask.data(), &R2Task::finished, this, [this, uri] () {
@ -1361,10 +1363,10 @@ void CutterCore::attachRemote(const QString &uri)
// prevent register flags from appearing during debug/emul
setConfig("asm.flags", false);
currentlyDebugging = true;
emit flagsChanged();
emit changeDebugView();
}
emit codeRebased();
emit attachedRemote(true);
emit debugTaskStateChanged();
});
@ -1385,7 +1387,7 @@ void CutterCore::attachDebug(int pid)
}
// attach to process with dbg plugin
asyncCmd("o-*; e cfg.debug = true; o+ dbg://" + QString::number(pid), debugTask);
asyncCmd("e cfg.debug = true; oodf dbg://" + QString::number(pid), debugTask);
emit debugTaskStateChanged();
connect(debugTask.data(), &R2Task::finished, this, [this, pid] () {
@ -1401,9 +1403,11 @@ void CutterCore::attachDebug(int pid)
currentlyDebugging = true;
currentlyOpenFile = getConfig("file.path");
currentlyAttachedToPID = pid;
emit flagsChanged();
emit changeDebugView();
}
emit codeRebased();
emit debugTaskStateChanged();
});
debugTaskDialog = new R2TaskDialog(debugTask);
@ -1457,7 +1461,7 @@ void CutterCore::stopDebug()
syncAndSeekProgramCounter();
setConfig("asm.flags", true);
setConfig("io.cache", false);
emit flagsChanged();
emit codeRebased();
emit changeDefinedView();
offsetPriorDebugging = getOffset();
emit debugTaskStateChanged();

View File

@ -491,6 +491,10 @@ signals:
void breakpointsChanged();
void refreshCodeViews();
void stackChanged();
/**
* @brief update all the widgets that are affected by rebasing in debug mode
*/
void codeRebased();
void switchedThread();
void switchedProcess();

View File

@ -142,6 +142,7 @@ BreakpointWidget::BreakpointWidget(MainWindow *main, QAction *action) :
connect(Core(), &CutterCore::refreshAll, this, &BreakpointWidget::refreshBreakpoint);
connect(Core(), &CutterCore::breakpointsChanged, this, &BreakpointWidget::refreshBreakpoint);
connect(Core(), &CutterCore::codeRebased, this, &BreakpointWidget::refreshBreakpoint);
connect(Core(), &CutterCore::refreshCodeViews, this, &BreakpointWidget::refreshBreakpoint);
connect(ui->addBreakpoint, &QAbstractButton::clicked, this, &BreakpointWidget::addBreakpointDialog);
connect(ui->delBreakpoint, &QAbstractButton::clicked, this, &BreakpointWidget::delBreakpoint);

View File

@ -219,6 +219,7 @@ AnalClassesModel::AnalClassesModel(CutterDockWidget *parent)
});
connect(Core(), &CutterCore::refreshAll, this, &AnalClassesModel::refreshAll);
connect(Core(), &CutterCore::codeRebased, this, &AnalClassesModel::refreshAll);
connect(Core(), &CutterCore::classNew, this, &AnalClassesModel::classNew);
connect(Core(), &CutterCore::classDeleted, this, &AnalClassesModel::classDeleted);
connect(Core(), &CutterCore::classRenamed, this, &AnalClassesModel::classRenamed);

View File

@ -259,8 +259,9 @@ CommentsWidget::CommentsWidget(MainWindow *main, QAction *action) :
connect(this, &QWidget::customContextMenuRequested,
this, &CommentsWidget::showTitleContextMenu);
connect(Core(), SIGNAL(commentsChanged()), this, SLOT(refreshTree()));
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshTree()));
connect(Core(), &CutterCore::codeRebased, this, &CommentsWidget::refreshTree);
connect(Core(), &CutterCore::commentsChanged, this, &CommentsWidget::refreshTree);
connect(Core(), &CutterCore::refreshAll, this, &CommentsWidget::refreshTree);
}
CommentsWidget::~CommentsWidget() {}

View File

@ -20,7 +20,8 @@ EntrypointWidget::EntrypointWidget(MainWindow *main, QAction *action) :
setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(fillEntrypoint()));
connect(Core(), &CutterCore::codeRebased, this, &EntrypointWidget::fillEntrypoint);
connect(Core(), &CutterCore::refreshAll, this, &EntrypointWidget::fillEntrypoint);
}
EntrypointWidget::~EntrypointWidget() {}

View File

@ -142,7 +142,8 @@ ExportsWidget::ExportsWidget(MainWindow *main, QAction *action) :
main->updateDockActionChecked(action);
} );
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshExports()));
connect(Core(), &CutterCore::codeRebased, this, &ExportsWidget::refreshExports);
connect(Core(), &CutterCore::refreshAll, this, &ExportsWidget::refreshExports);
}
ExportsWidget::~ExportsWidget() {}

View File

@ -160,8 +160,9 @@ FlagsWidget::FlagsWidget(MainWindow *main, QAction *action) :
setScrollMode();
connect(Core(), SIGNAL(flagsChanged()), this, SLOT(flagsChanged()));
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshFlagspaces()));
connect(Core(), &CutterCore::flagsChanged, this, &FlagsWidget::flagsChanged);
connect(Core(), &CutterCore::codeRebased, this, &FlagsWidget::flagsChanged);
connect(Core(), &CutterCore::refreshAll, this, &FlagsWidget::refreshFlagspaces);
auto menu = ui->flagsTreeView->getItemContextMenu();
menu->addSeparator();

View File

@ -480,8 +480,9 @@ FunctionsWidget::FunctionsWidget(MainWindow *main, QAction *action) :
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showTitleContextMenu(const QPoint &)));
connect(Core(), SIGNAL(functionsChanged()), this, SLOT(refreshTree()));
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshTree()));
connect(Core(), &CutterCore::functionsChanged, this, &FunctionsWidget::refreshTree);
connect(Core(), &CutterCore::codeRebased, this, &FunctionsWidget::refreshTree);
connect(Core(), &CutterCore::refreshAll, this, &FunctionsWidget::refreshTree);
}
FunctionsWidget::~FunctionsWidget() {}

View File

@ -123,6 +123,7 @@ HeadersWidget::HeadersWidget(MainWindow *main, QAction *action) :
ui->quickFilterView->closeFilter();
showCount(false);
connect(Core(), &CutterCore::codeRebased, this, &HeadersWidget::refreshHeaders);
connect(Core(), &CutterCore::refreshAll, this, &HeadersWidget::refreshHeaders);
}

View File

@ -155,7 +155,8 @@ ImportsWidget::ImportsWidget(MainWindow *main, QAction *action) :
main->updateDockActionChecked(action);
} );
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshImports()));
connect(Core(), &CutterCore::codeRebased, this, &ImportsWidget::refreshImports);
connect(Core(), &CutterCore::refreshAll, this, &ImportsWidget::refreshImports);
}
ImportsWidget::~ImportsWidget() {}

View File

@ -124,6 +124,7 @@ RelocsWidget::RelocsWidget(MainWindow *main, QAction *action) :
setModels(relocsProxyModel);
ui->treeView->sortByColumn(RelocsModel::NameColumn, Qt::AscendingOrder);
connect(Core(), &CutterCore::codeRebased, this, &RelocsWidget::refreshRelocs);
connect(Core(), &CutterCore::refreshAll, this, &RelocsWidget::refreshRelocs);
}

View File

@ -215,6 +215,7 @@ void SectionsWidget::initAddrMapDocks()
void SectionsWidget::initConnects()
{
connect(Core(), &CutterCore::refreshAll, this, &SectionsWidget::refreshSections);
connect(Core(), &CutterCore::codeRebased, this, &SectionsWidget::refreshSections);
connect(this, &QDockWidget::visibilityChanged, this, [ = ](bool visibility) {
if (visibility) {
refreshSections();

View File

@ -145,7 +145,8 @@ SegmentsWidget::SegmentsWidget(MainWindow *main, QAction *action) :
ui->quickFilterView->closeFilter();
showCount(false);
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshSegments()));
connect(Core(), &CutterCore::refreshAll, this, &SegmentsWidget::refreshSegments);
connect(Core(), &CutterCore::codeRebased, this, &SegmentsWidget::refreshSegments);
}
SegmentsWidget::~SegmentsWidget() {}

View File

@ -186,7 +186,8 @@ StringsWidget::StringsWidget(MainWindow *main, QAction *action) :
});
clearShortcut->setContext(Qt::WidgetWithChildrenShortcut);
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshStrings()));
connect(Core(), &CutterCore::refreshAll, this, &StringsWidget::refreshStrings);
connect(Core(), &CutterCore::codeRebased, this, &StringsWidget::refreshStrings);
connect(
ui->quickFilterView->comboBox(), &QComboBox::currentTextChanged, this,

View File

@ -124,6 +124,7 @@ SymbolsWidget::SymbolsWidget(MainWindow *main, QAction *action) :
setModels(symbolsProxyModel);
ui->treeView->sortByColumn(SymbolsModel::AddressColumn, Qt::AscendingOrder);
connect(Core(), &CutterCore::codeRebased, this, &SymbolsWidget::refreshSymbols);
connect(Core(), &CutterCore::refreshAll, this, &SymbolsWidget::refreshSymbols);
}

View File

@ -161,7 +161,8 @@ VTablesWidget::VTablesWidget(MainWindow *main, QAction *action) :
tree->showItemsNumber(proxy->rowCount());
});
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshVTables()));
connect(Core(), &CutterCore::codeRebased, this, &VTablesWidget::refreshVTables);
connect(Core(), &CutterCore::refreshAll, this, &VTablesWidget::refreshVTables);
}
VTablesWidget::~VTablesWidget()