Commit ceb9533f authored by Robert Loehning's avatar Robert Loehning

Debugger: Clean out fixupParameters

Change-Id: I01b1308f4d438b7e0cb4ae643b79abd285ea9db7
Reviewed-by: default avatarhjk <hjk@qt.io>
parent ae806511
......@@ -288,13 +288,15 @@ DebuggerEngine *createEngine(DebuggerEngineType cppEngineType,
static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, QStringList &m_errors)
{
RunConfiguration *runConfig = runControl->runConfiguration();
if (!runConfig)
return false;
Core::Id runMode = runControl->runMode();
const Kit *kit = runConfig->target()->kit();
QTC_ASSERT(kit, return false);
// Extract as much as possible from available RunConfiguration.
if (runConfig && runConfig->runnable().is<StandardRunnable>()) {
if (runConfig->runnable().is<StandardRunnable>()) {
rp.inferior = runConfig->runnable().as<StandardRunnable>();
rp.useTerminal = rp.inferior.runMode == ApplicationLauncher::Console;
// Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...)
......@@ -320,33 +322,22 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
if (!envBinary.isEmpty())
rp.debugger.executable = QString::fromLocal8Bit(envBinary);
if (runConfig) {
if (auto envAspect = runConfig->extraAspect<EnvironmentAspect>()) {
rp.inferior.environment = envAspect->environment(); // Correct.
rp.stubEnvironment = rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
if (auto envAspect = runConfig->extraAspect<EnvironmentAspect>()) {
rp.inferior.environment = envAspect->environment(); // Correct.
rp.stubEnvironment = rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
// Copy over DYLD_IMAGE_SUFFIX etc
for (auto var : QStringList({"DYLD_IMAGE_SUFFIX", "DYLD_LIBRARY_PATH", "DYLD_FRAMEWORK_PATH"}))
if (rp.inferior.environment.hasKey(var))
rp.debugger.environment.set(var, rp.inferior.environment.value(var));
}
if (Project *project = runConfig->target()->project()) {
rp.projectSourceDirectory = project->projectDirectory().toString();
rp.projectSourceFiles = project->files(Project::SourceFiles);
}
} else {
// "special" starts like Start and Debug External Application.
rp.inferior.environment = Environment::systemEnvironment();
rp.inferior.environment.modify(EnvironmentKitInformation::environmentChanges(kit));
// Copy over DYLD_IMAGE_SUFFIX etc
for (auto var : QStringList({"DYLD_IMAGE_SUFFIX", "DYLD_LIBRARY_PATH", "DYLD_FRAMEWORK_PATH"}))
if (rp.inferior.environment.hasKey(var))
rp.debugger.environment.set(var, rp.inferior.environment.value(var));
}
if (Project *project = runConfig->target()->project()) {
rp.projectSourceDirectory = project->projectDirectory().toString();
rp.projectSourceFiles = project->files(Project::SourceFiles);
}
rp.toolChainAbi = ToolChainKitInformation::targetAbi(kit);
if (false) {
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
rp.nativeMixedEnabled = version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 7, 0);
}
bool ok = false;
int nativeMixedOverride = qgetenv("QTC_DEBUGGER_NATIVE_MIXED").toInt(&ok);
if (ok)
......@@ -356,10 +347,10 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
if (rp.sysRoot.isEmpty())
rp.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
if (rp.displayName.isEmpty() && runConfig)
if (rp.displayName.isEmpty())
rp.displayName = runConfig->displayName();
if (runConfig && runConfig->property("supportsDebugger").toBool()) {
if (runConfig->property("supportsDebugger").toBool()) {
QString mainScript = runConfig->property("mainScript").toString();
QString interpreter = runConfig->property("interpreter").toString();
if (!interpreter.isEmpty() && mainScript.endsWith(".py")) {
......@@ -375,14 +366,11 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
}
}
DebuggerRunConfigurationAspect *debuggerAspect = 0;
if (runConfig)
debuggerAspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (debuggerAspect)
rp.multiProcess = debuggerAspect->useMultiProcess();
DebuggerRunConfigurationAspect *debuggerAspect
= runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (debuggerAspect) {
rp.multiProcess = debuggerAspect->useMultiProcess();
rp.languages = NoLanguage;
if (debuggerAspect->useCppDebugger())
rp.languages |= CppLanguage;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment