Commit 02b042a9 authored by Igor Kushnir's avatar Igor Kushnir Committed by Milian Wolff

Debugger plugin fixes

Summary:
Rename Qt logging category: common -> debuggercommon

The old name was too generic and undescriptive. This resulted in
the following confusing lines in KDevelop output:
  kdevelop.plugins.common: Change session  QObject(0x0)
  kdevelop.plugins.common: Will reparse arch

MIDebugger: print a specific process error message

Information in the messageboxes is general and sometimes insufficient
to understand why the process could not be started. In such cases
a warning-level error message can be useful. For example:
  Debugger ERRORED QProcess::FailedToStart "execvp: Exec format error"
  Debugger ERRORED QProcess::WriteError "Error writing to process"

GdbDebugger: pass correct string in userCommandOutput()

When Shell script was not empty, both the shell path and the debugger
executable were duplicated in the string sent to userCommandOutput()
because they are prepended to arguments in if(!shell.isEmpty()) branch.

Test Plan:
Run test_gdb, test_gdbprinters, test_lldb and test_lldbformatters.
The number of failed and skipped tests did not change with these fixes.

Reviewers: mwolff

Reviewed By: mwolff

Subscribers: mwolff, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D18325
parent e86c5a72
...@@ -41,8 +41,7 @@ declare_qt_logging_category(debuggercommon_SRCS ...@@ -41,8 +41,7 @@ declare_qt_logging_category(debuggercommon_SRCS
TYPE PLUGIN TYPE PLUGIN
HEADER debuglog.h HEADER debuglog.h
IDENTIFIER DEBUGGERCOMMON IDENTIFIER DEBUGGERCOMMON
CATEGORY_BASENAME "common" CATEGORY_BASENAME "debuggercommon"
DESCRIPTION "debuggers common"
) )
ki18n_wrap_ui(debuggercommon_SRCS ki18n_wrap_ui(debuggercommon_SRCS
......
...@@ -340,7 +340,7 @@ void MIDebugger::processFinished(int exitCode, QProcess::ExitStatus exitStatus) ...@@ -340,7 +340,7 @@ void MIDebugger::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
void MIDebugger::processErrored(QProcess::ProcessError error) void MIDebugger::processErrored(QProcess::ProcessError error)
{ {
qCDebug(DEBUGGERCOMMON) << "Debugger ERRORED" << error; qCWarning(DEBUGGERCOMMON) << "Debugger ERRORED" << error << m_process->errorString();
if(error == QProcess::FailedToStart) if(error == QProcess::FailedToStart)
{ {
KMessageBox::information( KMessageBox::information(
......
...@@ -61,6 +61,8 @@ bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments) ...@@ -61,6 +61,8 @@ bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments)
QStringList arguments = extraArguments; QStringList arguments = extraArguments;
arguments << QStringLiteral("--interpreter=mi2") << QStringLiteral("-quiet"); arguments << QStringLiteral("--interpreter=mi2") << QStringLiteral("-quiet");
QString fullCommand;
QUrl shell = config.readEntry(Config::DebuggerShellEntry, QUrl()); QUrl shell = config.readEntry(Config::DebuggerShellEntry, QUrl());
if(!shell.isEmpty()) { if(!shell.isEmpty()) {
qCDebug(DEBUGGERGDB) << "have shell" << shell; qCDebug(DEBUGGERGDB) << "have shell" << shell;
...@@ -85,14 +87,14 @@ bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments) ...@@ -85,14 +87,14 @@ bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments)
m_process->setShellCommand(KShell::joinArgs(arguments)); m_process->setShellCommand(KShell::joinArgs(arguments));
} else { } else {
m_process->setProgram(m_debuggerExecutable, arguments); m_process->setProgram(m_debuggerExecutable, arguments);
fullCommand = m_debuggerExecutable + QLatin1Char(' ');
} }
fullCommand += arguments.join(QLatin1Char(' '));
m_process->start(); m_process->start();
qCDebug(DEBUGGERGDB) << "Starting GDB with command" << shell.toLocalFile() + QLatin1Char(' ') + m_debuggerExecutable qCDebug(DEBUGGERGDB) << "Starting GDB with command" << fullCommand;
+ QLatin1Char(' ') + arguments.join(QLatin1Char(' '));
qCDebug(DEBUGGERGDB) << "GDB process pid:" << m_process->pid(); qCDebug(DEBUGGERGDB) << "GDB process pid:" << m_process->pid();
emit userCommandOutput(shell.toLocalFile() + QLatin1Char(' ') + m_debuggerExecutable emit userCommandOutput(fullCommand + QLatin1Char('\n'));
+ QLatin1Char(' ') + arguments.join(QLatin1Char(' ')) + QLatin1Char('\n'));
return true; return true;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment