MCPcopy Create free account
hub / github.com/KDE/kdevelop / configInferior

Method configInferior

plugins/lldb/debugsession.cpp:147–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void DebugSession::configInferior(ILaunchConfiguration *cfg, IExecutePlugin *iexec, const QString &executable)
148{
149 // Read Configuration values
150 KConfigGroup grp = cfg->config();
151
152 // Create target as early as possible, so we can do target specific configuration later
153 QString filesymbols = Utils::quote(executable);
154 bool remoteDebugging = grp.readEntry(Config::LldbRemoteDebuggingEntry, false);
155 if (remoteDebugging) {
156 auto connStr = grp.readEntry(Config::LldbRemoteServerEntry, QString());
157 auto remoteDir = grp.readEntry(Config::LldbRemotePathEntry, QString());
158 auto remoteExe = QDir(remoteDir).filePath(QFileInfo(executable).fileName());
159
160 filesymbols += QLatin1String(" -r ") + Utils::quote(remoteExe);
161
162 addFileExecAndSymbolsCommand(filesymbols);
163
164 addCommand(MI::TargetSelect, QLatin1String("remote ") + connStr,
165 this, &DebugSession::handleTargetSelect, CmdHandlesError);
166
167 // ensure executable is on remote end
168 addCommand(MI::NonMI, QStringLiteral("platform mkdir -v 755 %0").arg(Utils::quote(remoteDir)));
169 addCommand(MI::NonMI, QStringLiteral("platform put-file %0 %1")
170 .arg(Utils::quote(executable), Utils::quote(remoteExe)));
171 } else {
172 addFileExecAndSymbolsCommand(filesymbols);
173 }
174
175 raiseEvent(connected_to_program);
176
177 // Set the environment variables has effect only after target created
178 const EnvironmentProfileList environmentProfiles(KSharedConfig::openConfig());
179 QString envProfileName = iexec->environmentProfileName(cfg);
180 if (envProfileName.isEmpty()) {
181 envProfileName = environmentProfiles.defaultProfileName();
182 }
183 const auto &envVariables = environmentProfiles.variables(envProfileName);
184 if (!envVariables.isEmpty()) {
185 QStringList vars;
186 vars.reserve(envVariables.size());
187 for (auto it = envVariables.constBegin(), ite = envVariables.constEnd(); it != ite; ++it) {
188 vars.append(QStringLiteral("%0=%1").arg(it.key(), Utils::quote(it.value())));
189 }
190 // actually using lldb command 'settings set target.env-vars' which accepts multiple values
191 addCommand(GdbSet, QLatin1String("environment ") + vars.join(QLatin1Char(' ')));
192 }
193
194 // Break on start: can't use "-exec-run --start" because in lldb-mi
195 // the inferior stops without any notification
196 bool breakOnStart = grp.readEntry(KDevMI::Config::BreakOnStartEntry, false);
197 if (breakOnStart) {
198 BreakpointModel* m = ICore::self()->debugController()->breakpointModel();
199 bool found = false;
200 const auto breakpoints = m->breakpoints();
201 for (Breakpoint* b : breakpoints) {
202 if (b->location() == QLatin1String("main")) {
203 found = true;
204 break;

Callers

nothing calls this directly

Calls 15

quoteFunction · 0.85
readEntryMethod · 0.80
defaultProfileNameMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
joinMethod · 0.80
debugControllerMethod · 0.80
QStringClass · 0.50
QDirClass · 0.50
QFileInfoClass · 0.50
configMethod · 0.45
filePathMethod · 0.45

Tested by

no test coverage detected