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

View File

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

View File

@ -545,7 +545,8 @@ void MainWindow::restoreDocks()
addExtraWidget(stackDock); addExtraWidget(stackDock);
splitDockWidget(stackDock, registersDock, Qt::Vertical); splitDockWidget(stackDock, registersDock, Qt::Vertical);
splitDockWidget(stackDock, backtraceDock, 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 #ifdef CUTTER_ENABLE_JUPYTER
tabifyDockWidget(dashboardDock, jupyterDock); tabifyDockWidget(dashboardDock, jupyterDock);
#endif #endif
@ -627,7 +628,8 @@ void MainWindow::showDebugDocks()
searchDock, searchDock,
stackDock, stackDock,
registersDock, registersDock,
backtraceDock backtraceDock,
memoryMapDock
}; };
for (auto w : dockWidgets) { for (auto w : dockWidgets) {
if (debugDocks.contains(w)) { if (debugDocks.contains(w)) {
@ -682,13 +684,15 @@ void MainWindow::resetToDebugLayout()
showDebugDocks(); showDebugDocks();
disassemblyDock->raise(); 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! // 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(); qApp->processEvents();
restoreFunctionDock.restoreWidth(functionsDock->widget()); restoreFunctionDock.restoreWidth(functionsDock->widget());
restoreStackDock.restoreWidth(stackDock->widget());
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly); Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly);
} }
@ -913,6 +917,7 @@ void MainWindow::changeDefinedView()
readSettings(); readSettings();
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
} }
void MainWindow::mousePressEvent(QMouseEvent *event) void MainWindow::mousePressEvent(QMouseEvent *event)