Changeset View
Changeset View
Standalone View
Standalone View
debuggers/lldb/lldbdebugger.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
46 | { | 46 | { | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | bool LldbDebugger::start(KConfigGroup& config, const QStringList& extraArguments) | 49 | bool LldbDebugger::start(KConfigGroup& config, const QStringList& extraArguments) | ||
50 | { | 50 | { | ||
51 | // Get path to executable | 51 | // Get path to executable | ||
52 | QUrl lldbUrl = config.readEntry(Config::LldbExecutableEntry, QUrl()); | 52 | QUrl lldbUrl = config.readEntry(Config::LldbExecutableEntry, QUrl()); | ||
53 | if (!lldbUrl.isValid() || !lldbUrl.isLocalFile()) { | 53 | if (!lldbUrl.isValid() || !lldbUrl.isLocalFile()) { | ||
54 | debuggerBinary_ = "lldb-mi"; | 54 | debuggerExecutable_ = QStringLiteral("lldb-mi"); | ||
55 | } else { | 55 | } else { | ||
56 | debuggerBinary_ = lldbUrl.toLocalFile(); | 56 | debuggerExecutable_ = lldbUrl.toLocalFile(); | ||
57 | } | 57 | } | ||
58 | 58 | | |||
59 | // Get arguments | 59 | // Get arguments | ||
60 | QStringList arguments = extraArguments; | 60 | QStringList arguments = extraArguments; | ||
61 | //arguments << "-quiet"; | 61 | //arguments << "-quiet"; | ||
62 | arguments.append(KShell::splitArgs(config.readEntry(Config::LldbArgumentsEntry, QString()))); | 62 | arguments.append(KShell::splitArgs(config.readEntry(Config::LldbArgumentsEntry, QString()))); | ||
63 | 63 | | |||
64 | // Get environment | 64 | // Get environment | ||
65 | const EnvironmentGroupList egl(config.config()); | 65 | const EnvironmentGroupList egl(config.config()); | ||
66 | const auto &envs = egl.variables(config.readEntry(Config::LldbEnvironmentEntry, egl.defaultGroup())); | 66 | const auto &envs = egl.variables(config.readEntry(Config::LldbEnvironmentEntry, egl.defaultGroup())); | ||
67 | QProcessEnvironment processEnv; | 67 | QProcessEnvironment processEnv; | ||
68 | if (config.readEntry(Config::LldbInheritSystemEnvEntry, true)) { | 68 | if (config.readEntry(Config::LldbInheritSystemEnvEntry, true)) { | ||
69 | processEnv = QProcessEnvironment::systemEnvironment(); | 69 | processEnv = QProcessEnvironment::systemEnvironment(); | ||
70 | } | 70 | } | ||
71 | for (auto it = envs.begin(), ite = envs.end(); it != ite; ++it) { | 71 | for (auto it = envs.begin(), ite = envs.end(); it != ite; ++it) { | ||
72 | processEnv.insert(it.key(), it.value()); | 72 | processEnv.insert(it.key(), it.value()); | ||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | // Start! | 75 | // Start! | ||
76 | process_->setProcessEnvironment(processEnv); | 76 | process_->setProcessEnvironment(processEnv); | ||
77 | process_->setProgram(debuggerBinary_, arguments); | 77 | process_->setProgram(debuggerExecutable_, arguments); | ||
78 | process_->start(); | 78 | process_->start(); | ||
79 | 79 | | |||
80 | qCDebug(DEBUGGERLLDB) << "Starting LLDB with command" << debuggerBinary_ + ' ' + arguments.join(' '); | 80 | qCDebug(DEBUGGERLLDB) << "Starting LLDB with command" << debuggerExecutable_ + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')); | ||
81 | qCDebug(DEBUGGERLLDB) << "LLDB process pid:" << process_->pid(); | 81 | qCDebug(DEBUGGERLLDB) << "LLDB process pid:" << process_->pid(); | ||
82 | emit userCommandOutput(debuggerBinary_ + ' ' + arguments.join(' ') + '\n'); | 82 | emit userCommandOutput(debuggerExecutable_ + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')) + QLatin1Char('\n')); | ||
83 | 83 | | |||
84 | return true; | 84 | return true; | ||
85 | } | 85 | } |