Changeset View
Changeset View
Standalone View
Standalone View
debuggers/gdb/gdb.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
48 | { | 48 | { | ||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments) | 51 | bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments) | ||
52 | { | 52 | { | ||
53 | // FIXME: verify that default value leads to something sensible | 53 | // FIXME: verify that default value leads to something sensible | ||
54 | QUrl gdbUrl = config.readEntry(Config::GdbPathEntry, QUrl()); | 54 | QUrl gdbUrl = config.readEntry(Config::GdbPathEntry, QUrl()); | ||
55 | if (gdbUrl.isEmpty()) { | 55 | if (gdbUrl.isEmpty()) { | ||
56 | debuggerBinary_ = "gdb"; | 56 | debuggerExecutable_ = QStringLiteral("gdb"); | ||
57 | } else { | 57 | } else { | ||
58 | // FIXME: verify its' a local path. | 58 | // FIXME: verify its' a local path. | ||
59 | debuggerBinary_ = gdbUrl.url(QUrl::PreferLocalFile | QUrl::StripTrailingSlash); | 59 | debuggerExecutable_ = gdbUrl.url(QUrl::PreferLocalFile | QUrl::StripTrailingSlash); | ||
60 | } | 60 | } | ||
61 | 61 | | |||
62 | QStringList arguments = extraArguments; | 62 | QStringList arguments = extraArguments; | ||
63 | arguments << "--interpreter=mi2" << "-quiet"; | 63 | arguments << "--interpreter=mi2" << "-quiet"; | ||
64 | 64 | | |||
65 | QUrl shell = config.readEntry(Config::DebuggerShellEntry, QUrl()); | 65 | QUrl shell = config.readEntry(Config::DebuggerShellEntry, QUrl()); | ||
66 | if(!shell.isEmpty()) { | 66 | if(!shell.isEmpty()) { | ||
67 | qCDebug(DEBUGGERGDB) << "have shell" << shell; | 67 | qCDebug(DEBUGGERGDB) << "have shell" << shell; | ||
68 | QString shell_without_args = shell.toLocalFile().split(QChar(' ')).first(); | 68 | QString shell_without_args = shell.toLocalFile().split(QChar(' ')).first(); | ||
69 | 69 | | |||
70 | QFileInfo info(shell_without_args); | 70 | QFileInfo info(shell_without_args); | ||
71 | /*if( info.isRelative() ) | 71 | /*if( info.isRelative() ) | ||
72 | { | 72 | { | ||
73 | shell_without_args = build_dir + "/" + shell_without_args; | 73 | shell_without_args = build_dir + "/" + shell_without_args; | ||
74 | info.setFile( shell_without_args ); | 74 | info.setFile( shell_without_args ); | ||
75 | }*/ | 75 | }*/ | ||
76 | if(!info.exists()) { | 76 | if(!info.exists()) { | ||
77 | KMessageBox::information( | 77 | KMessageBox::information( | ||
78 | qApp->activeWindow(), | 78 | qApp->activeWindow(), | ||
79 | i18n("Could not locate the debugging shell '%1'.", shell_without_args ), | 79 | i18n("Could not locate the debugging shell '%1'.", shell_without_args ), | ||
80 | i18n("Debugging Shell Not Found") ); | 80 | i18n("Debugging Shell Not Found") ); | ||
81 | return false; | 81 | return false; | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | arguments.insert(0, debuggerBinary_); | 84 | arguments.insert(0, debuggerExecutable_); | ||
85 | arguments.insert(0, shell.toLocalFile()); | 85 | arguments.insert(0, shell.toLocalFile()); | ||
86 | process_->setShellCommand(KShell::joinArgs(arguments)); | 86 | process_->setShellCommand(KShell::joinArgs(arguments)); | ||
87 | } else { | 87 | } else { | ||
88 | process_->setProgram(debuggerBinary_, arguments); | 88 | process_->setProgram(debuggerExecutable_, arguments); | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | process_->start(); | 91 | process_->start(); | ||
92 | 92 | | |||
93 | qCDebug(DEBUGGERGDB) << "Starting GDB with command" << shell.toLocalFile() + ' ' + debuggerBinary_ | 93 | qCDebug(DEBUGGERGDB) << "Starting GDB with command" << shell.toLocalFile() + QLatin1Char(' ') + debuggerExecutable_ | ||
94 | + ' ' + arguments.join(' '); | 94 | + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')); | ||
95 | qCDebug(DEBUGGERGDB) << "GDB process pid:" << process_->pid(); | 95 | qCDebug(DEBUGGERGDB) << "GDB process pid:" << process_->pid(); | ||
96 | emit userCommandOutput(shell.toLocalFile() + ' ' + debuggerBinary_ | 96 | emit userCommandOutput(shell.toLocalFile() + QLatin1Char(' ') + debuggerExecutable_ | ||
97 | + ' ' + arguments.join(' ') + '\n'); | 97 | + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')) + QLatin1Char('\n')); | ||
98 | return true; | 98 | return true; | ||
99 | } | 99 | } |