when quitting debug, we go to where we were before debug

This commit is contained in:
mandlebro 2018-06-13 22:36:29 +01:00 committed by xarkes
parent 40ce944381
commit b1fa37a999
3 changed files with 12 additions and 6 deletions

View File

@ -759,6 +759,7 @@ void CutterCore::setRegister(QString regName, QString regValue)
void CutterCore::startDebug()
{
offsetPriorDebugging = getOffset();
cmd("ood");
emit registersChanged();
emit changeDebugView();
@ -769,7 +770,7 @@ void CutterCore::stopDebug()
// @TODO should first obtain correct signal to send.
// Also, we do a ds since otherwise the process does not die.
cmd("dk 9; ds; e cfg.debug = false; oo");
seek(tr("main"));
seek(offsetPriorDebugging);
emit changeDefinedView();
}

View File

@ -590,9 +590,9 @@ private:
MemoryWidgetType memoryWidgetPriority;
QString notes;
RCore *core_;
AsyncTaskManager *asyncTaskManager;
RVA offsetPriorDebugging = RVA_INVALID;
QList<CutterPlugin*> plugins;
};

View File

@ -545,7 +545,8 @@ void MainWindow::restoreDocks()
addExtraWidget(stackDock);
splitDockWidget(stackDock, registersDock, Qt::Vertical);
splitDockWidget(stackDock, backtraceDock, Qt::Vertical);
splitDockWidget(stackDock, memoryMapDock, Qt::Vertical);
// MemoryMap widget goes in the center tabs
tabifyDockWidget(dashboardDock, memoryMapDock);
#ifdef CUTTER_ENABLE_JUPYTER
tabifyDockWidget(dashboardDock, jupyterDock);
#endif
@ -627,7 +628,8 @@ void MainWindow::showDebugDocks()
searchDock,
stackDock,
registersDock,
backtraceDock
backtraceDock,
memoryMapDock
};
for (auto w : dockWidgets) {
if (debugDocks.contains(w)) {
@ -682,13 +684,15 @@ void MainWindow::resetToDebugLayout()
showDebugDocks();
disassemblyDock->raise();
// ugly workaround to set the default widths of functions
// ugly workaround to set the default widths of functions/stack
// if anyone finds a way to do this cleaner that also works, feel free to change it!
auto restoreFunctionDock = qhelpers::forceWidth(functionsDock->widget(), 200);
auto restoreFunctionDock = qhelpers::forceWidth(functionsDock->widget(), 150);
auto restoreStackDock = qhelpers::forceWidth(stackDock->widget(), 350);
qApp->processEvents();
restoreFunctionDock.restoreWidth(functionsDock->widget());
restoreStackDock.restoreWidth(stackDock->widget());
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly);
}
@ -913,6 +917,7 @@ void MainWindow::changeDefinedView()
readSettings();
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
}
void MainWindow::mousePressEvent(QMouseEvent *event)