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

Method handleVersion

plugins/lldb/debugsession.cpp:320–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320void DebugSession::handleVersion(const QStringList& s)
321{
322 // Join stream output strings by an empty separator because such a string
323 // ends with '\n' unless the next string in the list continues a logical line.
324 auto versionText = s.join(QLatin1String{});
325
326 qCDebug(DEBUGGERLLDB) << versionText;
327
328#ifdef Q_OS_OSX
329 static const QRegularExpression versionPrefix(QStringLiteral("^lldb-\\d"), QRegularExpression::MultilineOption);
330 // LLDB 4.0 probably reports version 370.x.y on macOS
331 const QVersionNumber minimumVersion{370};
332#else
333 static const QRegularExpression versionPrefix(QStringLiteral("^lldb version \\d"),
334 QRegularExpression::MultilineOption);
335 const QVersionNumber minimumVersion{4, 0, 0};
336#endif
337
338 const auto match = versionPrefix.match(versionText);
339 if (!match.hasMatch()) {
340 if (versionText.endsWith(QLatin1Char{'\n'})) {
341 versionText.removeLast(); // prevent line break at the end to save vertical space
342 }
343 versionText = versionText.toHtmlEscaped();
344 versionText.replace(QLatin1Char{'\n'}, QLatin1String{"<br />"});
345
346 stopDebuggerOnError(
347 i18n("The LLDB version used by your <code>lldb-mi</code> could not be detected.<br />"
348 "Your <code>lldb-mi</code> sent the following reply to a CLI command <code>version</code>:<br />")
349 + versionText);
350 return;
351 }
352
353 const auto lldbVersion = QVersionNumber::fromString(QStringView(versionText).sliced(match.capturedEnd() - 1));
354 if (lldbVersion < minimumVersion) {
355 stopDebuggerOnError(
356 i18n("Your <code>lldb-mi</code> must use LLDB version %1 or later.<br />"
357 "But it is currently using LLDB version %2",
358 minimumVersion.toString(), lldbVersion.toString()));
359 }
360}
361
362void DebugSession::updateAllVariables()
363{

Callers

nothing calls this directly

Calls 8

joinMethod · 0.80
hasMatchMethod · 0.80
endsWithMethod · 0.80
toHtmlEscapedMethod · 0.80
QStringViewClass · 0.50
matchMethod · 0.45
replaceMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected