forked from qt-creator/qt-creator
Debugger: Get rid of DebuggerRunTool
Task-number: QTCREATORBUG-29168 Change-Id: If663b684825ae63f11bd6025be7382cf07a067a7 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -135,7 +135,7 @@ namespace Internal {
|
|||||||
|
|
||||||
static const char localsPrefixC[] = "local.";
|
static const char localsPrefixC[] = "local.";
|
||||||
|
|
||||||
// Accessed by DebuggerRunTool
|
// Accessed by debuggerRecipe()
|
||||||
DebuggerEngine *createCdbEngine()
|
DebuggerEngine *createCdbEngine()
|
||||||
{
|
{
|
||||||
return new CdbEngine;
|
return new CdbEngine;
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include <solutions/tasking/barrier.h>
|
#include <solutions/tasking/barrier.h>
|
||||||
#include <solutions/tasking/conditional.h>
|
#include <solutions/tasking/conditional.h>
|
||||||
#include <solutions/tasking/tasktreerunner.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/checkablemessagebox.h>
|
#include <utils/checkablemessagebox.h>
|
||||||
@@ -125,16 +124,6 @@ private:
|
|||||||
int m_snapshotCounter = 0;
|
int m_snapshotCounter = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DebuggerRunToolPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DebuggerRunTool *q = nullptr;
|
|
||||||
DebuggerRunParameters m_runParameters;
|
|
||||||
|
|
||||||
// TaskTree
|
|
||||||
Tasking::TaskTreeRunner m_taskTreeRunner = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
ExecutableItem coreFileRecipe(RunControl *runControl,
|
ExecutableItem coreFileRecipe(RunControl *runControl,
|
||||||
@@ -727,65 +716,6 @@ void EnginesDriver::showMessage(const QString &msg, int channel, int timeout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunTool::start()
|
|
||||||
{
|
|
||||||
const Storage<DebuggerRunParameters> parametersStorage;
|
|
||||||
const Storage<EnginesDriver> driverStorage;
|
|
||||||
const Storage<FilePath> tempCoreFileStorage;
|
|
||||||
const Storage<std::unique_ptr<Process>> terminalStorage;
|
|
||||||
|
|
||||||
const auto onSetup = [this, parametersStorage] {
|
|
||||||
RunInterface *iface = runStorage().activeStorage();
|
|
||||||
connect(this, &DebuggerRunTool::canceled, iface, &RunInterface::canceled);
|
|
||||||
connect(iface, &RunInterface::started, this, &RunWorker::reportStarted);
|
|
||||||
*parametersStorage = d->m_runParameters;
|
|
||||||
parametersStorage->setAttachPid(runControl()->attachPid());
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto terminalKicker = [parametersStorage, driverStorage, terminalStorage]
|
|
||||||
(const SingleBarrier &barrier) {
|
|
||||||
return terminalRecipe(parametersStorage, driverStorage, terminalStorage, barrier);
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto debugServerKicker = [runControl = runControl(), parametersStorage](const SingleBarrier &barrier) {
|
|
||||||
return debugServerRecipe(runControl, parametersStorage, barrier);
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto onDone = [parametersStorage, tempCoreFileStorage] {
|
|
||||||
if (tempCoreFileStorage->exists())
|
|
||||||
tempCoreFileStorage->removeFile();
|
|
||||||
if (parametersStorage->isSnapshot() && !parametersStorage->coreFile().isEmpty())
|
|
||||||
parametersStorage->coreFile().removeFile();
|
|
||||||
};
|
|
||||||
|
|
||||||
const Group recipe {
|
|
||||||
runStorage(),
|
|
||||||
parametersStorage,
|
|
||||||
driverStorage,
|
|
||||||
terminalStorage,
|
|
||||||
tempCoreFileStorage,
|
|
||||||
continueOnError,
|
|
||||||
onGroupSetup(onSetup),
|
|
||||||
Group {
|
|
||||||
coreFileRecipe(runControl(), parametersStorage, tempCoreFileStorage),
|
|
||||||
When (terminalKicker) >> Do {
|
|
||||||
fixupParamsRecipe(runControl(), parametersStorage),
|
|
||||||
When (debugServerKicker) >> Do {
|
|
||||||
startEnginesRecipe(runControl(), parametersStorage, driverStorage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.withCancel(canceler()),
|
|
||||||
finalizeRecipe(driverStorage, terminalStorage),
|
|
||||||
onGroupDone(onDone)
|
|
||||||
};
|
|
||||||
d->m_taskTreeRunner.start(recipe, {}, [this](DoneWith result) {
|
|
||||||
if (result == DoneWith::Success)
|
|
||||||
reportStopped();
|
|
||||||
else
|
|
||||||
reportFailure();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Group debuggerRecipe(RunControl *runControl, const DebuggerRunParameters &initialParameters,
|
Group debuggerRecipe(RunControl *runControl, const DebuggerRunParameters &initialParameters,
|
||||||
const std::function<void(DebuggerRunParameters &)> ¶metersModifier)
|
const std::function<void(DebuggerRunParameters &)> ¶metersModifier)
|
||||||
{
|
{
|
||||||
@@ -843,41 +773,6 @@ RunWorker *createDebuggerWorker(RunControl *runControl, const DebuggerRunParamet
|
|||||||
debuggerRecipe(runControl, initialParameters, parametersModifier));
|
debuggerRecipe(runControl, initialParameters, parametersModifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunTool::stop()
|
|
||||||
{
|
|
||||||
if (!d->m_taskTreeRunner.isRunning())
|
|
||||||
return;
|
|
||||||
|
|
||||||
emit canceled();
|
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerRunParameters &DebuggerRunTool::runParameters()
|
|
||||||
{
|
|
||||||
return d->m_runParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerRunTool::DebuggerRunTool(RunControl *runControl)
|
|
||||||
: RunWorker(runControl)
|
|
||||||
, d(new DebuggerRunToolPrivate{this, DebuggerRunParameters::fromRunControl(runControl)})
|
|
||||||
{
|
|
||||||
setId("DebuggerRunTool");
|
|
||||||
runControl->setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR);
|
|
||||||
runControl->setPromptToStop([](bool *optionalPrompt) {
|
|
||||||
return RunControl::showPromptToStopDialog(
|
|
||||||
Tr::tr("Close Debugging Session"),
|
|
||||||
Tr::tr("A debugging session is still in progress. "
|
|
||||||
"Terminating the session in the current"
|
|
||||||
" state can leave the target in an inconsistent state."
|
|
||||||
" Would you still like to terminate it?"),
|
|
||||||
QString(), QString(), optionalPrompt);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerRunTool::~DebuggerRunTool()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
class DebuggerRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
class DebuggerRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
namespace Internal { class DebuggerRunToolPrivate; }
|
|
||||||
|
|
||||||
DEBUGGER_EXPORT Tasking::Group debuggerRecipe(
|
DEBUGGER_EXPORT Tasking::Group debuggerRecipe(
|
||||||
ProjectExplorer::RunControl *runControl,
|
ProjectExplorer::RunControl *runControl,
|
||||||
const DebuggerRunParameters &initialParameters,
|
const DebuggerRunParameters &initialParameters,
|
||||||
@@ -24,26 +22,6 @@ DEBUGGER_EXPORT ProjectExplorer::RunWorker *createDebuggerWorker(
|
|||||||
const DebuggerRunParameters &initialParameters,
|
const DebuggerRunParameters &initialParameters,
|
||||||
const std::function<void(DebuggerRunParameters &)> ¶metersModifier = {});
|
const std::function<void(DebuggerRunParameters &)> ¶metersModifier = {});
|
||||||
|
|
||||||
class DEBUGGER_EXPORT DebuggerRunTool final : public ProjectExplorer::RunWorker
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit DebuggerRunTool(ProjectExplorer::RunControl *runControl);
|
|
||||||
~DebuggerRunTool() override;
|
|
||||||
|
|
||||||
void start() final;
|
|
||||||
void stop() final;
|
|
||||||
|
|
||||||
DebuggerRunParameters &runParameters();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void canceled();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Internal::DebuggerRunToolPrivate *d;
|
|
||||||
};
|
|
||||||
|
|
||||||
void setupDebuggerRunWorker();
|
void setupDebuggerRunWorker();
|
||||||
|
|
||||||
class SimpleDebugRunnerFactory final : public ProjectExplorer::RunWorkerFactory
|
class SimpleDebugRunnerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||||
|
@@ -58,7 +58,7 @@ static void allowRootLocals(const FilePath &projectFile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessed by DebuggerRunTool.
|
// Accessed by debuggerRecipe()
|
||||||
DebuggerEngine *createUvscEngine()
|
DebuggerEngine *createUvscEngine()
|
||||||
{
|
{
|
||||||
return new UvscEngine;
|
return new UvscEngine;
|
||||||
|
@@ -858,10 +858,10 @@ static RunWorker *createWorker(RunControl *runControl)
|
|||||||
QTC_ASSERT(isIosDeviceInstance == isIosDeviceType,
|
QTC_ASSERT(isIosDeviceInstance == isIosDeviceType,
|
||||||
runControl->postMessage(Tr::tr("Internal error."), ErrorMessageFormat); return nullptr);
|
runControl->postMessage(Tr::tr("Internal error."), ErrorMessageFormat); return nullptr);
|
||||||
DebuggerRunParameters rp = DebuggerRunParameters::fromRunControl(runControl);
|
DebuggerRunParameters rp = DebuggerRunParameters::fromRunControl(runControl);
|
||||||
// TODO cannot use setupPortsGatherer() from DebuggerRunTool, because that also requests
|
// TODO cannot use setupPortsGatherer(), because that also requests
|
||||||
// the "debugChannel", which then results in runControl trying to retrieve ports&URL for that
|
// the "debugChannel", which then results in runControl trying to retrieve ports&URL for that
|
||||||
// via IDevice, which doesn't really work with the iOS setup, and also completely changes
|
// via IDevice, which doesn't really work with the iOS setup, and also completely changes
|
||||||
// how the DebuggerRunTool works, breaking debugging on iOS <= 16 devices.
|
// how the debuggerRecipe() works, breaking debugging on iOS <= 16 devices.
|
||||||
if (rp.isQmlDebugging())
|
if (rp.isQmlDebugging())
|
||||||
runControl->requestQmlChannel();
|
runControl->requestQmlChannel();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user