Changeset View
Changeset View
Standalone View
Standalone View
debuggers/gdb/gdb.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 42 | GdbDebugger::GdbDebugger(QObject* parent) | |||
---|---|---|---|---|---|
43 | : MIDebugger(parent) | 43 | : MIDebugger(parent) | ||
44 | { | 44 | { | ||
45 | } | 45 | } | ||
46 | 46 | | |||
47 | GdbDebugger::~GdbDebugger() | 47 | GdbDebugger::~GdbDebugger() | ||
48 | { | 48 | { | ||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | void 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(gdbPathEntry, QUrl()); | 54 | QUrl gdbUrl = config.readEntry(gdbPathEntry, QUrl()); | ||
55 | if (gdbUrl.isEmpty()) { | 55 | if (gdbUrl.isEmpty()) { | ||
56 | debuggerBinary_ = "gdb"; | 56 | debuggerBinary_ = "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 | debuggerBinary_ = gdbUrl.url(QUrl::PreferLocalFile | QUrl::StripTrailingSlash); | ||
Show All 13 Lines | 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 | // FIXME: throw, or set some error message. | 81 | return false; | ||
82 | return; | | |||
83 | } | 82 | } | ||
84 | 83 | | |||
85 | arguments.insert(0, debuggerBinary_); | 84 | arguments.insert(0, debuggerBinary_); | ||
86 | arguments.insert(0, shell.toLocalFile()); | 85 | arguments.insert(0, shell.toLocalFile()); | ||
87 | process_->setShellCommand(KShell::joinArgs(arguments)); | 86 | process_->setShellCommand(KShell::joinArgs(arguments)); | ||
88 | } else { | 87 | } else { | ||
89 | process_->setProgram(debuggerBinary_, arguments); | 88 | process_->setProgram(debuggerBinary_, arguments); | ||
90 | } | 89 | } | ||
91 | 90 | | |||
92 | process_->start(); | 91 | process_->start(); | ||
93 | 92 | | |||
94 | qCDebug(DEBUGGERGDB) << "Starting GDB with command" << shell.toLocalFile() + ' ' + debuggerBinary_ | 93 | qCDebug(DEBUGGERGDB) << "Starting GDB with command" << shell.toLocalFile() + ' ' + debuggerBinary_ | ||
95 | + ' ' + arguments.join(' '); | 94 | + ' ' + arguments.join(' '); | ||
96 | qCDebug(DEBUGGERGDB) << "GDB process pid:" << process_->pid(); | 95 | qCDebug(DEBUGGERGDB) << "GDB process pid:" << process_->pid(); | ||
97 | emit userCommandOutput(shell.toLocalFile() + ' ' + debuggerBinary_ | 96 | emit userCommandOutput(shell.toLocalFile() + ' ' + debuggerBinary_ | ||
98 | + ' ' + arguments.join(' ') + '\n'); | 97 | + ' ' + arguments.join(' ') + '\n'); | ||
98 | return true; | ||||
99 | } | 99 | } |