Debugger: Use a somewhat less intrusive hack for 'start at main'

Change-Id: Ie649a4a11c88f3686cd6ed1e73f34c7c78fd0e13
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-07-07 19:11:32 +02:00
parent 5868c1e53b
commit 9e67a9453a
11 changed files with 26 additions and 34 deletions

View File

@@ -73,9 +73,6 @@ enum { debug = 0 };
namespace Debugger {
namespace Internal {
const auto DebugRunMode = ProjectExplorer::Constants::DEBUG_RUN_MODE;
const auto DebugRunModeWithBreakOnMain = ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN;
DebuggerEngine *createCdbEngine(QStringList *error, DebuggerStartMode sm);
DebuggerEngine *createGdbEngine(bool useTerminal, DebuggerStartMode sm);
DebuggerEngine *createPdbEngine();
@@ -86,6 +83,13 @@ DebuggerEngine *createLldbEngine();
} // namespace Internal
static bool breakOnMainNextTime = false;
void DebuggerRunTool::setBreakOnMainNextTime()
{
breakOnMainNextTime = true;
}
static QLatin1String engineTypeName(DebuggerEngineType et)
{
switch (et) {
@@ -272,7 +276,6 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
RunConfiguration *runConfig = runControl->runConfiguration();
if (!runConfig)
return false;
Core::Id runMode = runControl->runMode();
const Kit *kit = runConfig->target()->kit();
QTC_ASSERT(kit, return false);
@@ -449,8 +452,10 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
if (rp.startMode == NoStartMode)
rp.startMode = StartInternal;
if (runMode == DebugRunModeWithBreakOnMain)
if (breakOnMainNextTime) {
rp.breakOnMain = true;
breakOnMainNextTime = false;
}
return true;
}
@@ -634,7 +639,7 @@ RunControl *createAndScheduleRun(const DebuggerRunParameters &rp, Kit *kit)
{
RunConfiguration *runConfig = dummyRunConfigForKit(kit);
QTC_ASSERT(runConfig, return nullptr);
auto runControl = new RunControl(runConfig, DebugRunMode);
auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
(void) new DebuggerRunTool(runControl, rp);
ProjectExplorerPlugin::startRunControl(runControl);
return runControl;