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

Method start

plugins/gdb/gdb.cpp:40–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments)
41{
42 // FIXME: verify that default value leads to something sensible
43 QUrl gdbUrl = config.readEntry(Config::GdbPathEntry, QUrl());
44 if (gdbUrl.isEmpty()) {
45 m_debuggerExecutable = QStringLiteral("gdb");
46 } else {
47 // FIXME: verify its' a local path.
48 m_debuggerExecutable = gdbUrl.url(QUrl::PreferLocalFile | QUrl::StripTrailingSlash);
49 }
50
51 QStringList arguments = extraArguments;
52 arguments << QStringLiteral("--interpreter=mi2") << QStringLiteral("-quiet");
53
54 QString fullCommand;
55
56 QUrl shell = config.readEntry(Config::DebuggerShellEntry, QUrl());
57 if(!shell.isEmpty()) {
58 qCDebug(DEBUGGERGDB) << "have shell" << shell;
59 QString shell_without_args = shell.toLocalFile().split(QLatin1Char(' ')).first();
60
61 QFileInfo info(shell_without_args);
62 /*if( info.isRelative() )
63 {
64 shell_without_args = build_dir + "/" + shell_without_args;
65 info.setFile( shell_without_args );
66 }*/
67 if(!info.exists()) {
68 const QString messageText = i18n("Could not locate the debugging shell '%1'.", shell_without_args);
69 auto* message = new Sublime::Message(messageText, Sublime::Message::Error);
70 KDevelop::ICore::self()->uiController()->postMessage(message);
71 return false;
72 }
73
74 arguments.insert(0, m_debuggerExecutable);
75 arguments.insert(0, shell.toLocalFile());
76 m_process->setShellCommand(KShell::joinArgs(arguments));
77 } else {
78 m_process->setProgram(m_debuggerExecutable, arguments);
79 fullCommand = m_debuggerExecutable + QLatin1Char(' ');
80 }
81 fullCommand += arguments.join(QLatin1Char(' '));
82
83 KDevelop::ICore::self()->runtimeController()->currentRuntime()->startProcess(m_process);
84
85 qCDebug(DEBUGGERGDB) << "Starting GDB with command" << fullCommand;
86 qCDebug(DEBUGGERGDB) << "GDB process pid:" << m_process->processId();
87 emit userCommandOutput(fullCommand + QLatin1Char('\n'));
88 return true;
89}
90
91#include "moc_gdb.cpp"

Callers 15

mainFunction · 0.45
openSessionFunction · 0.45
authenticateMethod · 0.45
twoFactorAuthenticateMethod · 0.45
revokeAccessMethod · 0.45
keyPressEventMethod · 0.45
startProcessMethod · 0.45
seekHunkMethod · 0.45
notifyPatchChangedMethod · 0.45
markClickedMethod · 0.45
rangeForMarkMethod · 0.45
textRemovedMethod · 0.45

Calls 15

readEntryMethod · 0.80
toLocalFileMethod · 0.80
existsMethod · 0.80
uiControllerMethod · 0.80
joinMethod · 0.80
currentRuntimeMethod · 0.80
runtimeControllerMethod · 0.80
QUrlClass · 0.50
isEmptyMethod · 0.45
urlMethod · 0.45
firstMethod · 0.45
splitMethod · 0.45

Tested by 3

showSourceMethod · 0.36
testAttachMethod · 0.36
testManualAttachMethod · 0.36