mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Set reverse icons to invisible when not in a trace session instead of disabled
This commit is contained in:
parent
c6ed2c0a06
commit
a6876dc3f2
@ -1832,6 +1832,7 @@ void CutterCore::stopDebug()
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentlyDebugging = false;
|
currentlyDebugging = false;
|
||||||
|
currentlyTracing = false;
|
||||||
emit debugTaskStateChanged();
|
emit debugTaskStateChanged();
|
||||||
|
|
||||||
if (currentlyEmulating) {
|
if (currentlyEmulating) {
|
||||||
@ -2135,30 +2136,9 @@ void CutterCore::setDebugPlugin(QString plugin)
|
|||||||
setConfig("dbg.backend", plugin);
|
setConfig("dbg.backend", plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CutterCore::isTraceSessionInProgress() {
|
|
||||||
CORE_LOCK();
|
|
||||||
if (!currentlyDebugging) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentlyEmulating) {
|
|
||||||
if (core->analysis->esil->trace) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (core->dbg->session) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CutterCore::startTraceSession()
|
void CutterCore::startTraceSession()
|
||||||
{
|
{
|
||||||
if (!currentlyDebugging) {
|
if (!currentlyDebugging || currentlyTracing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2179,6 +2159,7 @@ void CutterCore::startTraceSession()
|
|||||||
}
|
}
|
||||||
debugTask.clear();
|
debugTask.clear();
|
||||||
|
|
||||||
|
currentlyTracing = true;
|
||||||
emit debugTaskStateChanged();
|
emit debugTaskStateChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2193,7 +2174,7 @@ void CutterCore::startTraceSession()
|
|||||||
|
|
||||||
void CutterCore::stopTraceSession()
|
void CutterCore::stopTraceSession()
|
||||||
{
|
{
|
||||||
if (!currentlyDebugging) {
|
if (!currentlyDebugging || !currentlyTracing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2214,6 +2195,7 @@ void CutterCore::stopTraceSession()
|
|||||||
}
|
}
|
||||||
debugTask.clear();
|
debugTask.clear();
|
||||||
|
|
||||||
|
currentlyTracing = false;
|
||||||
emit debugTaskStateChanged();
|
emit debugTaskStateChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -403,7 +403,6 @@ public:
|
|||||||
void stepOutDebug();
|
void stepOutDebug();
|
||||||
void stepBackDebug();
|
void stepBackDebug();
|
||||||
|
|
||||||
bool isTraceSessionInProgress();
|
|
||||||
void startTraceSession();
|
void startTraceSession();
|
||||||
void stopTraceSession();
|
void stopTraceSession();
|
||||||
|
|
||||||
@ -440,6 +439,7 @@ public:
|
|||||||
bool isRedirectableDebugee();
|
bool isRedirectableDebugee();
|
||||||
bool currentlyDebugging = false;
|
bool currentlyDebugging = false;
|
||||||
bool currentlyEmulating = false;
|
bool currentlyEmulating = false;
|
||||||
|
bool currentlyTracing = false;
|
||||||
int currentlyAttachedToPID = -1;
|
int currentlyAttachedToPID = -1;
|
||||||
QString currentlyOpenFile;
|
QString currentlyOpenFile;
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
|
|||||||
QIcon startRemoteIcon = QIcon(":/img/icons/play_light_remote.svg");
|
QIcon startRemoteIcon = QIcon(":/img/icons/play_light_remote.svg");
|
||||||
QIcon continueBackIcon = QIcon(":/img/icons/reverse_continue.svg");
|
QIcon continueBackIcon = QIcon(":/img/icons/reverse_continue.svg");
|
||||||
QIcon stepBackIcon = QIcon(":/img/icons/reverse_step.svg");
|
QIcon stepBackIcon = QIcon(":/img/icons/reverse_step.svg");
|
||||||
QIcon startTraceIcon = QIcon(":/img/icons/start_trace.svg");
|
startTraceIcon = QIcon(":/img/icons/start_trace.svg");
|
||||||
QIcon stopTraceIcon = QIcon(":/img/icons/stop_trace.svg");
|
stopTraceIcon = QIcon(":/img/icons/stop_trace.svg");
|
||||||
stopIcon = QIcon(":/img/icons/media-stop_light.svg");
|
stopIcon = QIcon(":/img/icons/media-stop_light.svg");
|
||||||
restartIcon = QIcon(":/img/icons/spin_light.svg");
|
restartIcon = QIcon(":/img/icons/spin_light.svg");
|
||||||
detachIcon = QIcon(":/img/icons/detach_debugger.svg");
|
detachIcon = QIcon(":/img/icons/detach_debugger.svg");
|
||||||
@ -50,8 +50,8 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
|
|||||||
QString stepOverLabel = tr("Step over");
|
QString stepOverLabel = tr("Step over");
|
||||||
QString stepOutLabel = tr("Step out");
|
QString stepOutLabel = tr("Step out");
|
||||||
QString stepBackLabel = tr("Step backwards");
|
QString stepBackLabel = tr("Step backwards");
|
||||||
QString startTraceLabel = tr("Start trace session");
|
startTraceLabel = tr("Start trace session");
|
||||||
QString stopTraceLabel = tr("Stop trace session");
|
stopTraceLabel = tr("Stop trace session");
|
||||||
suspendLabel = tr("Suspend the process");
|
suspendLabel = tr("Suspend the process");
|
||||||
continueLabel = tr("Continue");
|
continueLabel = tr("Continue");
|
||||||
restartDebugLabel = tr("Restart program");
|
restartDebugLabel = tr("Restart program");
|
||||||
@ -150,12 +150,10 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
|
|||||||
actionContinue->setText(continueLabel);
|
actionContinue->setText(continueLabel);
|
||||||
actionContinue->setIcon(continueIcon);
|
actionContinue->setIcon(continueIcon);
|
||||||
}
|
}
|
||||||
// Reverse actions should only be toggled if we are tracing
|
|
||||||
if (Core()->isTraceSessionInProgress()) {
|
|
||||||
for (QAction *a : reverseActions) {
|
for (QAction *a : reverseActions) {
|
||||||
|
a->setVisible(Core()->currentlyTracing);
|
||||||
a->setDisabled(disableToolbar);
|
a->setDisabled(disableToolbar);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
for (QAction *a : toggleConnectionActions) {
|
for (QAction *a : toggleConnectionActions) {
|
||||||
a->setDisabled(disableToolbar);
|
a->setDisabled(disableToolbar);
|
||||||
@ -199,9 +197,9 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
|
|||||||
actionStartEmul->setText(restartEmulLabel);
|
actionStartEmul->setText(restartEmulLabel);
|
||||||
actionStartEmul->setIcon(restartIcon);
|
actionStartEmul->setIcon(restartIcon);
|
||||||
actionStop->setText(stopEmulLabel);
|
actionStop->setText(stopEmulLabel);
|
||||||
// Reverse debug actions are disabled until we start tracing
|
// Reverse debug actions aren't visible until we start tracing
|
||||||
for (QAction *a : reverseActions) {
|
for (QAction *a : reverseActions) {
|
||||||
a->setDisabled(true);
|
a->setVisible(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(actionStepOver, &QAction::triggered, Core(), &CutterCore::stepOverDebug);
|
connect(actionStepOver, &QAction::triggered, Core(), &CutterCore::stepOverDebug);
|
||||||
@ -221,7 +219,7 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
|
|||||||
|
|
||||||
connect(actionTrace, &QAction::triggered, Core(), [=]() {
|
connect(actionTrace, &QAction::triggered, Core(), [=]() {
|
||||||
// Check if a debug session was created to switch between start and stop
|
// Check if a debug session was created to switch between start and stop
|
||||||
if (!Core()->isTraceSessionInProgress()) {
|
if (!Core()->currentlyTracing) {
|
||||||
Core()->startTraceSession();
|
Core()->startTraceSession();
|
||||||
actionTrace->setText(stopTraceLabel);
|
actionTrace->setText(stopTraceLabel);
|
||||||
actionTrace->setIcon(stopTraceIcon);
|
actionTrace->setIcon(stopTraceIcon);
|
||||||
@ -389,10 +387,12 @@ void DebugActions::startDebug()
|
|||||||
actionStart->setIcon(restartIcon);
|
actionStart->setIcon(restartIcon);
|
||||||
setButtonVisibleIfMainExists();
|
setButtonVisibleIfMainExists();
|
||||||
|
|
||||||
// Reverse debug actions are disabled until we start tracing
|
// Reverse debug actions aren't visible until we start tracing
|
||||||
for (QAction *a : reverseActions) {
|
for (QAction *a : reverseActions) {
|
||||||
a->setDisabled(true);
|
a->setVisible(false);
|
||||||
}
|
}
|
||||||
|
actionTrace->setText(startTraceLabel);
|
||||||
|
actionTrace->setIcon(startTraceIcon);
|
||||||
|
|
||||||
Core()->startDebug();
|
Core()->startDebug();
|
||||||
}
|
}
|
||||||
|
@ -40,10 +40,14 @@ public:
|
|||||||
QIcon suspendIcon;
|
QIcon suspendIcon;
|
||||||
QIcon restartIcon;
|
QIcon restartIcon;
|
||||||
QIcon startDebugIcon;
|
QIcon startDebugIcon;
|
||||||
QString suspendLabel;
|
QIcon startTraceIcon;
|
||||||
|
QIcon stopTraceIcon;
|
||||||
QString continueLabel;
|
QString continueLabel;
|
||||||
|
QString suspendLabel;
|
||||||
QString restartDebugLabel;
|
QString restartDebugLabel;
|
||||||
QString startDebugLabel;
|
QString startDebugLabel;
|
||||||
|
QString startTraceLabel;
|
||||||
|
QString stopTraceLabel;
|
||||||
|
|
||||||
// Stop and Detach interchange during runtime
|
// Stop and Detach interchange during runtime
|
||||||
QIcon detachIcon;
|
QIcon detachIcon;
|
||||||
|
Loading…
Reference in New Issue
Block a user