| 34 | } |
| 35 | |
| 36 | bool LldbDebugger::start(KConfigGroup& config, const QStringList& extraArguments) |
| 37 | { |
| 38 | // Get path to executable |
| 39 | QUrl lldbUrl = config.readEntry(Config::LldbExecutableEntry, QUrl()); |
| 40 | if (!lldbUrl.isValid() || !lldbUrl.isLocalFile()) { |
| 41 | m_debuggerExecutable = QStringLiteral("lldb-mi"); |
| 42 | } else { |
| 43 | m_debuggerExecutable = lldbUrl.toLocalFile(); |
| 44 | } |
| 45 | |
| 46 | // Get arguments |
| 47 | QStringList arguments = extraArguments; |
| 48 | //arguments << "-quiet"; |
| 49 | arguments.append(KShell::splitArgs(config.readEntry(Config::LldbArgumentsEntry, QString()))); |
| 50 | |
| 51 | // Get environment |
| 52 | const EnvironmentProfileList egl(config.config()); |
| 53 | const auto &envs = egl.variables(config.readEntry(Config::LldbEnvironmentEntry, egl.defaultProfileName())); |
| 54 | QProcessEnvironment processEnv; |
| 55 | if (config.readEntry(Config::LldbInheritSystemEnvEntry, true)) { |
| 56 | processEnv = QProcessEnvironment::systemEnvironment(); |
| 57 | } |
| 58 | for (auto it = envs.begin(), ite = envs.end(); it != ite; ++it) { |
| 59 | processEnv.insert(it.key(), it.value()); |
| 60 | } |
| 61 | |
| 62 | // Start! |
| 63 | m_process->setProcessEnvironment(processEnv); |
| 64 | m_process->setProgram(m_debuggerExecutable, arguments); |
| 65 | ICore::self()->runtimeController()->currentRuntime()->startProcess(m_process); |
| 66 | |
| 67 | qCDebug(DEBUGGERLLDB) << "Starting LLDB with command" << m_debuggerExecutable + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')); |
| 68 | qCDebug(DEBUGGERLLDB) << "LLDB process pid:" << m_process->processId(); |
| 69 | emit userCommandOutput(m_debuggerExecutable + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')) + QLatin1Char('\n')); |
| 70 | |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | #include "moc_lldbdebugger.cpp" |