debugger: refactoring of output channeling

This commit is contained in:
hjk
2010-06-14 18:19:02 +02:00
parent 254a51bf5a
commit 9f7e9dc0ae
27 changed files with 225 additions and 234 deletions

View File

@@ -33,6 +33,8 @@
#include "cdbcom.h" #include "cdbcom.h"
#include "debuggerrunner.h" #include "debuggerrunner.h"
#include <utils/qtcassert.h>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -47,20 +49,16 @@ static int logChannel(ULONG mask)
return LogWarning; return LogWarning;
if (mask & (DEBUG_OUTPUT_ERROR)) if (mask & (DEBUG_OUTPUT_ERROR))
return LogError; return LogError;
return LogMisc;
}
enum OutputKind { DebuggerOutput, DebuggerPromptOutput, DebuggeeOutput, DebuggeePromptOutput };
static inline OutputKind outputKind(ULONG mask)
{
if (mask & DEBUG_OUTPUT_DEBUGGEE) if (mask & DEBUG_OUTPUT_DEBUGGEE)
return DebuggeeOutput; //return DebuggeeOutput;
return AppOut;
if (mask & DEBUG_OUTPUT_DEBUGGEE_PROMPT) if (mask & DEBUG_OUTPUT_DEBUGGEE_PROMPT)
return DebuggeePromptOutput; //return DebuggeePromptOutput;
return AppErr;
if (mask & DEBUG_OUTPUT_PROMPT) if (mask & DEBUG_OUTPUT_PROMPT)
return DebuggerPromptOutput; //return DebuggerPromptOutput;
return DebuggerOutput; return AppErr;
return LogMisc;
} }
CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine) CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine)
@@ -71,24 +69,10 @@ CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine)
void CdbDebugOutput::output(ULONG mask, const QString &msg) void CdbDebugOutput::output(ULONG mask, const QString &msg)
{ {
DebuggerRunControl *runControl = m_engine->runControl(); DebuggerRunControl *runControl = m_engine->runControl();
QTC_ASSER(runControl, return); QTC_ASSERT(runControl, return);
if (debugCDB > 1) if (debugCDB > 1)
qDebug() << Q_FUNC_INFO << "\n " << msg; qDebug() << Q_FUNC_INFO << "\n " << msg;
runControl->showMessage(msg, logChannel(mask));
switch (outputKind(mask)) {
case DebuggerOutput:
runControl->showDebuggerOutput(msg, logChannel(mask));
break;
case DebuggerPromptOutput:
runControl->showDebuggerInput(msg, logChannel(mask));
break;
case DebuggeeOutput:
runControl->showApplicationOutput(msg, true);
break;
case DebuggeePromptOutput:
runControl->showApplicationOutput(msg, false);
break;
}
} }
} // namespace Internal } // namespace Internal

View File

@@ -37,6 +37,8 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class CdbDebugEngine;
// Standard CDB output handler // Standard CDB output handler
class CdbDebugOutput : public CdbCore::DebugOutputBase class CdbDebugOutput : public CdbCore::DebugOutputBase
{ {

View File

@@ -263,7 +263,7 @@ void DisassemblerViewAgent::setFrame(const StackFrame &frame, bool tryMixed)
.arg(frame.function).arg(frame.file); .arg(frame.function).arg(frame.file);
QTC_ASSERT(d->manager->runControl(), /**/); QTC_ASSERT(d->manager->runControl(), /**/);
if (d->manager->runControl()) if (d->manager->runControl())
d->manager->runControl()->showDebuggerOutput(msg); d->manager->runControl()->showMessage(msg);
setContents(*it); setContents(*it);
return; return;
} }

View File

@@ -139,13 +139,17 @@ enum DebuggerCapabilities
enum LogChannel enum LogChannel
{ {
LogInput, // Used for user input LogInput, // Used for user input
LogMiscInput, // Used for misc stuff in the input pane
LogOutput, LogOutput,
LogWarning, LogWarning,
LogError, LogError,
LogStatus, // Used for status changed messages LogStatus, // Used for status changed messages
LogTime, // Used for time stamp messages LogTime, // Used for time stamp messages
LogDebug, LogDebug,
LogMisc LogMisc,
AppOutput,
AppError,
StatusBar // LogStatus and also put to the status bar
}; };
} // namespace Debugger } // namespace Debugger

View File

@@ -107,7 +107,7 @@
// use Q_FUNC_INFO? // use Q_FUNC_INFO?
# define STATE_DEBUG(s) \ # define STATE_DEBUG(s) \
do { QString msg; QTextStream ts(&msg); ts << s; \ do { QString msg; QTextStream ts(&msg); ts << s; \
showDebuggerOutput(msg, LogDebug); } while (0) showMessage(msg, LogDebug); } while (0)
#else #else
# define STATE_DEBUG(s) # define STATE_DEBUG(s)
#endif #endif
@@ -830,7 +830,7 @@ void DebuggerManager::clearStatusMessage()
void DebuggerManager::showStatusMessage(const QString &msg0, int timeout) void DebuggerManager::showStatusMessage(const QString &msg0, int timeout)
{ {
Q_UNUSED(timeout) Q_UNUSED(timeout)
showDebuggerOutput(msg0, LogStatus); showMessage(msg0, LogStatus);
QString msg = msg0; QString msg = msg0;
msg.replace(QLatin1Char('\n'), QString()); msg.replace(QLatin1Char('\n'), QString());
d->m_statusLabel->setText(msg); d->m_statusLabel->setText(msg);
@@ -1060,8 +1060,9 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
ProjectExplorer::ToolChain::ToolChainType(sp->toolChainType)); ProjectExplorer::ToolChain::ToolChainType(sp->toolChainType));
d->m_plugin->activateDebugMode(); d->m_plugin->activateDebugMode();
showDebuggerOutput(tr("Starting debugger for tool chain '%1'...").arg(toolChainName), LogStatus); showMessage(tr("Starting debugger for tool chain '%1'...").arg(toolChainName),
showDebuggerOutput(DebuggerSettings::instance()->dump(), LogDebug); LogStatus);
showMessage(DebuggerSettings::instance()->dump(), LogDebug);
QString errorMessage; QString errorMessage;
QString settingsIdHint; QString settingsIdHint;
@@ -1571,10 +1572,10 @@ void DebuggerManager::modulesDockToggled(bool on)
reloadModules(); reloadModules();
} }
void DebuggerManager::showDebuggerOutput(const QString &msg, int channel) void DebuggerManager::showMessage(const QString &msg, int channel)
{ {
if (runControl()) if (runControl())
runControl()->showDebuggerOutput(msg, channel); runControl()->showMessage(msg, channel);
else else
qDebug() << "OUTPUT: " << channel << msg; qDebug() << "OUTPUT: " << channel << msg;
} }
@@ -1776,7 +1777,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
if (!forced && !isAllowedTransition(d->m_state, state)) if (!forced && !isAllowedTransition(d->m_state, state))
qDebug() << "UNEXPECTED STATE TRANSITION: " << msg; qDebug() << "UNEXPECTED STATE TRANSITION: " << msg;
showDebuggerOutput(msg, LogDebug); showMessage(msg, LogDebug);
//resetLocation(); //resetLocation();
if (state == d->m_state) if (state == d->m_state)
@@ -2015,10 +2016,12 @@ DebuggerOutputWindow *DebuggerManager::debuggerOutputWindow() const
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/*
void IDebuggerEngine::showStatusMessage(const QString &msg, int timeout) void IDebuggerEngine::showStatusMessage(const QString &msg, int timeout)
{ {
m_manager->showStatusMessage(msg, timeout); m_manager->showStatusMessage(msg, timeout);
} }
*/
DebuggerState IDebuggerEngine::state() const DebuggerState IDebuggerEngine::state() const
{ {

View File

@@ -315,7 +315,7 @@ signals:
private: private:
void init(); void init();
// void runTest(const QString &fileName); // void runTest(const QString &fileName);
void showDebuggerOutput(const QString &msg, int channel); void showMessage(const QString &msg, int channel);
Q_SLOT void createNewDock(QWidget *widget); Q_SLOT void createNewDock(QWidget *widget);
void aboutToShutdown(); void aboutToShutdown();

View File

@@ -196,9 +196,34 @@ void DebuggerRunControl::start()
} }
} }
void DebuggerRunControl::showApplicationOutput(const QString &data, bool onStdErr) void DebuggerRunControl::showMessage(const QString &msg, int channel,
int timeout)
{ {
emit addToOutputWindowInline(this, data, onStdErr); DebuggerOutputWindow *ow = m_manager->debuggerOutputWindow();
QTC_ASSERT(ow, return);
switch (channel) {
case StatusBar:
m_manager->showStatusMessage(msg, timeout);
ow->showOutput(LogStatus, msg);
break;
case AppOutput:
emit addToOutputWindowInline(this, msg, false);
break;
case AppError:
emit addToOutputWindowInline(this, msg, true);
break;
case LogMiscInput:
ow->showInput(LogMisc, msg);
ow->showOutput(LogMisc, msg);
break;
case LogInput:
ow->showInput(channel, msg);
ow->showOutput(channel, msg);
break;
default:
ow->showOutput(channel, msg);
break;
}
} }
void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError) void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError)
@@ -206,19 +231,6 @@ void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError)
emit appendMessage(this, data, isError); emit appendMessage(this, data, isError);
} }
void DebuggerRunControl::showDebuggerOutput(const QString &output, int channel)
{
DebuggerOutputWindow *ow = m_manager->debuggerOutputWindow();
QTC_ASSERT(ow, return);
ow->showOutput(channel, output);
}
void DebuggerRunControl::showDebuggerInput(const QString &input, int channel)
{
DebuggerOutputWindow *ow = m_manager->debuggerOutputWindow();
QTC_ASSERT(ow, return);
ow->showInput(channel, input);
}
void DebuggerRunControl::stop() void DebuggerRunControl::stop()
{ {

View File

@@ -130,11 +130,7 @@ signals:
void stopRequested(); void stopRequested();
public slots: public slots:
void showDebuggerOutput(const QString &msg) void showMessage(const QString &output, int channel = LogDebug, int timeout = -1);
{ showDebuggerOutput(msg, LogDebug); }
void showApplicationOutput(const QString &output, bool onStdErr);
void showDebuggerOutput(const QString &output, int channel);
void showDebuggerInput(const QString &input, int channel);
private slots: private slots:
void slotMessageAvailable(const QString &data, bool isError); void slotMessageAvailable(const QString &data, bool isError);

View File

@@ -109,10 +109,8 @@ protected:
{ return m_engine->startParameters(); } { return m_engine->startParameters(); }
DebuggerRunControl *runControl() const DebuggerRunControl *runControl() const
{ return m_engine->runControl(); } { return m_engine->runControl(); }
void debugMessage(const QString &msg) const void showMessage(const QString &msg, int channel = LogDebug, int timeout = 1)
{ m_engine->debugMessage(msg); } { runControl()->showMessage(msg, channel, timeout); }
void showStatusMessage(const QString &msg) const
{ m_engine->showStatusMessage(msg); }
void showMessageBox(int icon, const QString &title, const QString &text) const void showMessageBox(int icon, const QString &title, const QString &text) const
{ m_engine->showMessageBox(icon, title, text); } { m_engine->showMessageBox(icon, title, text); }

View File

@@ -91,8 +91,8 @@ void AbstractPlainGdbAdapter::handleExecRun(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
QTC_ASSERT(state() == InferiorRunning, qDebug() << state()); QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
debugMessage(_("INFERIOR STARTED")); showMessage(_("INFERIOR STARTED"));
showStatusMessage(msgInferiorStarted()); showMessage(msgInferiorStarted(), StatusBar);
// FIXME: That's the wrong place for it. // FIXME: That's the wrong place for it.
if (theDebuggerBoolSetting(EnableReverseDebugging)) if (theDebuggerBoolSetting(EnableReverseDebugging))
m_engine->postCommand("target record"); m_engine->postCommand("target record");

View File

@@ -58,7 +58,7 @@ void AttachGdbAdapter::startAdapter()
{ {
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting); setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER")); showMessage(_("TRYING TO START ADAPTER"));
if (!m_engine->startGdb()) if (!m_engine->startGdb())
return; return;
@@ -80,8 +80,8 @@ void AttachGdbAdapter::handleAttach(const GdbResponse &response)
QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
setState(InferiorStopped); setState(InferiorStopped);
debugMessage(_("INFERIOR ATTACHED")); showMessage(_("INFERIOR ATTACHED"));
showStatusMessage(msgAttachedToStoppedInferior()); showMessage(msgAttachedToStoppedInferior(), StatusBar);
emit inferiorPrepared(); emit inferiorPrepared();
m_engine->updateAll(); m_engine->updateAll();
} else { } else {
@@ -95,7 +95,7 @@ void AttachGdbAdapter::interruptInferior()
const qint64 pid = startParameters().attachPID; const qint64 pid = startParameters().attachPID;
QTC_ASSERT(pid > 0, return); QTC_ASSERT(pid > 0, return);
if (!interruptProcess(pid)) if (!interruptProcess(pid))
debugMessage(_("CANNOT INTERRUPT %1").arg(pid)); showMessage(_("CANNOT INTERRUPT %1").arg(pid));
} }
} // namespace Internal } // namespace Internal

View File

@@ -160,8 +160,8 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
// Avoid endless loops created by faulty dumpers. // Avoid endless loops created by faulty dumpers.
QByteArray processedName = QByteArray::number(dumpChildren) + '-' + data.iname; QByteArray processedName = QByteArray::number(dumpChildren) + '-' + data.iname;
if (m_processedNames.contains(processedName)) { if (m_processedNames.contains(processedName)) {
showDebuggerInput( showMessage(
_("<Breaking endless loop for " + data.iname + '>'), LogStatus); _("<Breaking endless loop for " + data.iname + '>'), LogMiscInput);
data.setAllUnneeded(); data.setAllUnneeded();
data.setValue(_("<unavailable>")); data.setValue(_("<unavailable>"));
data.setHasChildren(false); data.setHasChildren(false);
@@ -395,7 +395,7 @@ void GdbEngine::handleDebuggingHelperValue2Classic(const GdbResponse &response)
// Remove traces of the question, too. // Remove traces of the question, too.
if (m_cookieForToken.contains(response.token - 1)) { if (m_cookieForToken.contains(response.token - 1)) {
m_cookieForToken.remove(response.token - 1); m_cookieForToken.remove(response.token - 1);
debugMessage(_("DETECTING LOST COMMAND %1").arg(response.token - 1)); showMessage(_("DETECTING LOST COMMAND %1").arg(response.token - 1));
--m_pendingWatchRequests; --m_pendingWatchRequests;
data.setError(WatchData::msgNotInScope()); data.setError(WatchData::msgNotInScope());
insertData(data); insertData(data);
@@ -591,12 +591,12 @@ void GdbEngine::setDebugDebuggingHelpersClassic(const QVariant &on)
{ {
PRECONDITION; PRECONDITION;
if (on.toBool()) { if (on.toBool()) {
debugMessage(_("SWITCHING ON DUMPER DEBUGGING")); showMessage(_("SWITCHING ON DUMPER DEBUGGING"));
postCommand("set unwindonsignal off"); postCommand("set unwindonsignal off");
m_manager->breakByFunction(_("qDumpObjectData440")); m_manager->breakByFunction(_("qDumpObjectData440"));
//updateLocals(); //updateLocals();
} else { } else {
debugMessage(_("SWITCHING OFF DUMPER DEBUGGING")); showMessage(_("SWITCHING OFF DUMPER DEBUGGING"));
postCommand("set unwindonsignal on"); postCommand("set unwindonsignal on");
} }
} }
@@ -641,7 +641,7 @@ void GdbEngine::handleStackListArgumentsClassic(const GdbResponse &response)
} else { } else {
// Seems to occur on "RedHat 4 based Linux" gdb 7.0.1: // Seems to occur on "RedHat 4 based Linux" gdb 7.0.1:
// ^error,msg="Cannot access memory at address 0x0" // ^error,msg="Cannot access memory at address 0x0"
debugMessage(_("UNEXPECTED RESPONSE: ") + response.toString()); showMessage(_("UNEXPECTED RESPONSE: ") + response.toString());
} }
} }
@@ -698,7 +698,7 @@ bool GdbEngine::checkDebuggingHelpersClassic()
const QStringList &locations = manager()->qtDumperLibraryLocations(); const QStringList &locations = manager()->qtDumperLibraryLocations();
const QString loc = locations.join(QLatin1String(", ")); const QString loc = locations.join(QLatin1String(", "));
const QString msg = tr("The debugging helper library was not found at %1.").arg(loc); const QString msg = tr("The debugging helper library was not found at %1.").arg(loc);
debugMessage(msg); showMessage(msg);
manager()->showQtDumperLibraryWarning(msg); manager()->showQtDumperLibraryWarning(msg);
return false; return false;
} }
@@ -757,11 +757,11 @@ void GdbEngine::handleDebuggingHelperVersionCheckClassic(const GdbResponse &resp
"application (%2).\nThis might yield incorrect results.") "application (%2).\nThis might yield incorrect results.")
.arg(dumperQtVersion).arg(debuggeeQtVersion)); .arg(dumperQtVersion).arg(debuggeeQtVersion));
} else { } else {
debugMessage(_("DUMPER VERSION CHECK SUCCESSFUL: ") showMessage(_("DUMPER VERSION CHECK SUCCESSFUL: ")
+ dumperQtVersion); + dumperQtVersion);
} }
} else { } else {
debugMessage("DUMPER VERSION CHECK NOT COMPLETED"); showMessage("DUMPER VERSION CHECK NOT COMPLETED");
} }
} }

View File

@@ -61,7 +61,7 @@ void CoreGdbAdapter::startAdapter()
{ {
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting); setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER")); showMessage(_("TRYING TO START ADAPTER"));
if (!m_engine->startGdb()) if (!m_engine->startGdb())
return; return;
@@ -106,7 +106,7 @@ void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
{ {
QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
showStatusMessage(tr("Symbols found.")); showMessage(tr("Symbols found."), StatusBar);
} else { } else {
QString msg = tr("Loading symbols from \"%1\" failed:\n").arg(m_executable) QString msg = tr("Loading symbols from \"%1\" failed:\n").arg(m_executable)
+ QString::fromLocal8Bit(response.data.findChild("msg").data()); + QString::fromLocal8Bit(response.data.findChild("msg").data());
@@ -144,7 +144,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
.absoluteFilePath(m_executable); .absoluteFilePath(m_executable);
if (QFile::exists(m_executable)) { if (QFile::exists(m_executable)) {
// Finish extra round ... // Finish extra round ...
showStatusMessage(tr("Attached to core temporarily.")); showMessage(tr("Attached to core temporarily."), StatusBar);
m_engine->postCommand("detach"); m_engine->postCommand("detach");
// ... and retry. // ... and retry.
loadExeAndSyms(); loadExeAndSyms();
@@ -156,7 +156,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
tr("Unable to determine executable from core file.")); tr("Unable to determine executable from core file."));
} }
#endif #endif
showStatusMessage(tr("Attached to core.")); showMessage(tr("Attached to core."), StatusBar);
setState(InferiorUnrunnable); setState(InferiorUnrunnable);
m_engine->updateAll(); m_engine->updateAll();
} else { } else {

View File

@@ -341,18 +341,13 @@ void GdbEngine::readDebugeeOutput(const QByteArray &data)
data.constData(), data.length(), &m_outputCodecState), true); data.constData(), data.length(), &m_outputCodecState), true);
} }
void GdbEngine::debugMessage(const QString &msg)
{
showDebuggerOutput(msg, LogDebug);
}
void GdbEngine::handleResponse(const QByteArray &buff) void GdbEngine::handleResponse(const QByteArray &buff)
{ {
static QTime lastTime; static QTime lastTime;
if (theDebuggerBoolSetting(LogTimeStamps)) if (theDebuggerBoolSetting(LogTimeStamps))
showDebuggerOutput(currentTime(), LogTime); showMessage(currentTime(), LogTime);
showDebuggerOutput(QString::fromLocal8Bit(buff, buff.length()), LogOutput); showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
#if 0 #if 0
qDebug() // << "#### start response handling #### " qDebug() // << "#### start response handling #### "
@@ -624,7 +619,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
void GdbEngine::readGdbStandardError() void GdbEngine::readGdbStandardError()
{ {
QByteArray err = gdbProc()->readAllStandardError(); QByteArray err = gdbProc()->readAllStandardError();
debugMessage(_("UNEXPECTED GDB STDERR: " + err)); showMessage(_("UNEXPECTED GDB STDERR: " + err));
if (err == "Undefined command: \"bb\". Try \"help\".\n") if (err == "Undefined command: \"bb\". Try \"help\".\n")
return; return;
if (err.startsWith("BFD: reopening")) if (err.startsWith("BFD: reopening"))
@@ -678,7 +673,7 @@ void GdbEngine::interruptInferior()
setState(InferiorStopping); setState(InferiorStopping);
showStatusMessage(tr("Stop requested..."), 5000); showStatusMessage(tr("Stop requested..."), 5000);
debugMessage(_("TRYING TO INTERRUPT INFERIOR")); showMessage(_("TRYING TO INTERRUPT INFERIOR"));
m_gdbAdapter->interruptInferior(); m_gdbAdapter->interruptInferior();
} }
@@ -696,12 +691,12 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0)
{ {
const qint64 pid = pid0.toLongLong(); const qint64 pid = pid0.toLongLong();
if (pid == 0) { if (pid == 0) {
debugMessage(_("Cannot parse PID from %1").arg(pid0)); showMessage(_("Cannot parse PID from %1").arg(pid0));
return; return;
} }
if (pid == inferiorPid()) if (pid == inferiorPid())
return; return;
debugMessage(_("FOUND PID %1").arg(pid)); showMessage(_("FOUND PID %1").arg(pid));
handleInferiorPidChanged(pid); handleInferiorPidChanged(pid);
} }
@@ -748,7 +743,7 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
{ {
if (!stateAcceptsGdbCommands(state())) { if (!stateAcceptsGdbCommands(state())) {
PENDING_DEBUG(_("NO GDB PROCESS RUNNING, CMD IGNORED: " + cmd.command)); PENDING_DEBUG(_("NO GDB PROCESS RUNNING, CMD IGNORED: " + cmd.command));
debugMessage(_("NO GDB PROCESS RUNNING, CMD IGNORED: %1 %2") showMessage(_("NO GDB PROCESS RUNNING, CMD IGNORED: %1 %2")
.arg(_(cmd.command)).arg(state())); .arg(_(cmd.command)).arg(state()));
return; return;
} }
@@ -779,24 +774,24 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
flushCommand(cmd); flushCommand(cmd);
} else { } else {
// Queue the commands that we cannot send at once. // Queue the commands that we cannot send at once.
debugMessage(_("QUEUING COMMAND " + cmd.command)); showMessage(_("QUEUING COMMAND " + cmd.command));
m_commandsToRunOnTemporaryBreak.append(cmd); m_commandsToRunOnTemporaryBreak.append(cmd);
if (state() == InferiorStopping) { if (state() == InferiorStopping) {
if (cmd.flags & LosesChild) if (cmd.flags & LosesChild)
setState(InferiorStopping_Kill); setState(InferiorStopping_Kill);
debugMessage(_("CHILD ALREADY BEING INTERRUPTED. STILL HOPING.")); showMessage(_("CHILD ALREADY BEING INTERRUPTED. STILL HOPING."));
// Calling shutdown() here breaks all situations where two // Calling shutdown() here breaks all situations where two
// NeedsStop commands are issued in quick succession. // NeedsStop commands are issued in quick succession.
} else if (state() == InferiorStopping_Kill) { } else if (state() == InferiorStopping_Kill) {
debugMessage(_("CHILD ALREADY BEING INTERRUPTED (KILL PENDING)")); showMessage(_("CHILD ALREADY BEING INTERRUPTED (KILL PENDING)"));
// FIXME // FIXME
shutdown(); shutdown();
} else if (state() == InferiorRunningRequested) { } else if (state() == InferiorRunningRequested) {
if (cmd.flags & LosesChild) if (cmd.flags & LosesChild)
setState(InferiorRunningRequested_Kill); setState(InferiorRunningRequested_Kill);
debugMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT")); showMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT"));
} else if (state() == InferiorRunningRequested_Kill) { } else if (state() == InferiorRunningRequested_Kill) {
debugMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT (KILL PENDING)")); showMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT (KILL PENDING)"));
} else if (state() == InferiorRunning) { } else if (state() == InferiorRunning) {
showStatusMessage(tr("Stopping temporarily"), 1000); showStatusMessage(tr("Stopping temporarily"), 1000);
interruptInferiorTemporarily(); interruptInferiorTemporarily();
@@ -814,7 +809,7 @@ void GdbEngine::flushQueuedCommands()
showStatusMessage(tr("Processing queued commands"), 1000); showStatusMessage(tr("Processing queued commands"), 1000);
while (!m_commandsToRunOnTemporaryBreak.isEmpty()) { while (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
GdbCommand cmd = m_commandsToRunOnTemporaryBreak.takeFirst(); GdbCommand cmd = m_commandsToRunOnTemporaryBreak.takeFirst();
debugMessage(_("RUNNING QUEUED COMMAND " + cmd.command + ' ' showMessage(_("RUNNING QUEUED COMMAND " + cmd.command + ' '
+ cmd.callbackName)); + cmd.callbackName));
flushCommand(cmd); flushCommand(cmd);
} }
@@ -824,8 +819,8 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
{ {
GdbCommand cmd = cmd0; GdbCommand cmd = cmd0;
if (state() == DebuggerNotReady) { if (state() == DebuggerNotReady) {
showDebuggerInput(_(cmd.command), LogInput); showMessage(_(cmd.command), LogInput);
debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: " + cmd.command)); showMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: " + cmd.command));
return; return;
} }
@@ -833,7 +828,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
cmd.postTime = QTime::currentTime(); cmd.postTime = QTime::currentTime();
m_cookieForToken[currentToken()] = cmd; m_cookieForToken[currentToken()] = cmd;
cmd.command = QByteArray::number(currentToken()) + cmd.command; cmd.command = QByteArray::number(currentToken()) + cmd.command;
showDebuggerInput(_(cmd.command), LogInput); showMessage(_(cmd.command), LogInput);
m_gdbAdapter->write(cmd.command + "\r\n"); m_gdbAdapter->write(cmd.command + "\r\n");
@@ -862,10 +857,10 @@ void GdbEngine::commandTimeout()
msg += ": " + cmd.command + " => "; msg += ": " + cmd.command + " => ";
QTC_ASSERT(cmd.callbackName, /**/); QTC_ASSERT(cmd.callbackName, /**/);
msg += cmd.callbackName; msg += cmd.callbackName;
debugMessage(_(msg)); showMessage(_(msg));
} }
if (killIt) { if (killIt) {
debugMessage(_("TIMED OUT WAITING FOR GDB REPLY. COMMANDS STILL IN PROGRESS:")); showMessage(_("TIMED OUT WAITING FOR GDB REPLY. COMMANDS STILL IN PROGRESS:"));
int timeOut = m_commandTimer->interval(); int timeOut = m_commandTimer->interval();
//m_commandTimer->stop(); //m_commandTimer->stop();
const QString msg = tr("The gdb process has not responded " const QString msg = tr("The gdb process has not responded "
@@ -879,15 +874,15 @@ void GdbEngine::commandTimeout()
mb->button(QMessageBox::Cancel)->setText(tr("Give gdb more time")); mb->button(QMessageBox::Cancel)->setText(tr("Give gdb more time"));
mb->button(QMessageBox::Ok)->setText(tr("Stop debugging")); mb->button(QMessageBox::Ok)->setText(tr("Stop debugging"));
if (mb->exec() == QMessageBox::Ok) { if (mb->exec() == QMessageBox::Ok) {
debugMessage(_("KILLING DEBUGGER AS REQUESTED BY USER")); showMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
// This is an undefined state, so we just pull the emergency brake. // This is an undefined state, so we just pull the emergency brake.
manager()->watchHandler()->endCycle(); manager()->watchHandler()->endCycle();
gdbProc()->kill(); gdbProc()->kill();
} else { } else {
debugMessage(_("CONTINUE DEBUGGER AS REQUESTED BY USER")); showMessage(_("CONTINUE DEBUGGER AS REQUESTED BY USER"));
} }
} else { } else {
debugMessage(_("\nNON-CRITICAL TIMEOUT\n")); showMessage(_("\nNON-CRITICAL TIMEOUT\n"));
} }
} }
@@ -906,7 +901,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// reported in the "first" response to the command) in practice it // reported in the "first" response to the command) in practice it
// does. We try to handle a few situations we are aware of gracefully. // does. We try to handle a few situations we are aware of gracefully.
// Ideally, this code should not be present at all. // Ideally, this code should not be present at all.
debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. " showMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. "
"TWO RESPONSES FOR ONE COMMAND?").arg(token)); "TWO RESPONSES FOR ONE COMMAND?").arg(token));
if (response->resultClass == GdbResultError) { if (response->resultClass == GdbResultError) {
QByteArray msg = response->data.findChild("msg").data(); QByteArray msg = response->data.findChild("msg").data();
@@ -914,7 +909,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc // Handle a case known to occur on Linux/gdb 6.8 when debugging moc
// with helpers enabled. In this case we get a second response with // with helpers enabled. In this case we get a second response with
// msg="Cannot find new threads: generic error" // msg="Cannot find new threads: generic error"
debugMessage(_("APPLYING WORKAROUND #1")); showMessage(_("APPLYING WORKAROUND #1"));
showMessageBox(QMessageBox::Critical, showMessageBox(QMessageBox::Critical,
tr("Executable failed"), QString::fromLocal8Bit(msg)); tr("Executable failed"), QString::fromLocal8Bit(msg));
showStatusMessage(tr("Process failed to start")); showStatusMessage(tr("Process failed to start"));
@@ -922,13 +917,13 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
} else if (msg == "\"finish\" not meaningful in the outermost frame.") { } else if (msg == "\"finish\" not meaningful in the outermost frame.") {
// Handle a case known to appear on gdb 6.4 symbianelf when // Handle a case known to appear on gdb 6.4 symbianelf when
// the stack is cut due to access to protected memory. // the stack is cut due to access to protected memory.
debugMessage(_("APPLYING WORKAROUND #2")); showMessage(_("APPLYING WORKAROUND #2"));
setState(InferiorStopping); setState(InferiorStopping);
setState(InferiorStopped); setState(InferiorStopped);
} else if (msg.startsWith("Cannot find bounds of current function")) { } else if (msg.startsWith("Cannot find bounds of current function")) {
// Happens when running "-exec-next" in a function for which // Happens when running "-exec-next" in a function for which
// there is no debug information. Divert to "-exec-next-step" // there is no debug information. Divert to "-exec-next-step"
debugMessage(_("APPLYING WORKAROUND #3")); showMessage(_("APPLYING WORKAROUND #3"));
setState(InferiorStopping); setState(InferiorStopping);
setState(InferiorStopped); setState(InferiorStopped);
executeNextI(); executeNextI();
@@ -936,7 +931,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// Happens on archer-tromey-python 6.8.50.20090910-cvs // Happens on archer-tromey-python 6.8.50.20090910-cvs
// There might to be a race between a process shutting down // There might to be a race between a process shutting down
// and library load messages. // and library load messages.
debugMessage(_("APPLYING WORKAROUND #4")); showMessage(_("APPLYING WORKAROUND #4"));
setState(InferiorStopping); setState(InferiorStopping);
setState(InferiorStopped); setState(InferiorStopped);
setState(InferiorShuttingDown); setState(InferiorShuttingDown);
@@ -958,14 +953,14 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
GdbCommand cmd = m_cookieForToken.take(token); GdbCommand cmd = m_cookieForToken.take(token);
if (theDebuggerBoolSetting(LogTimeStamps)) { if (theDebuggerBoolSetting(LogTimeStamps)) {
showDebuggerOutput(_("Response time: %1: %2 s") showMessage(_("Response time: %1: %2 s")
.arg(_(cmd.command)) .arg(_(cmd.command))
.arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.), .arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.),
LogTime); LogTime);
} }
if (response->token < m_oldestAcceptableToken && (cmd.flags & Discardable)) { if (response->token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
//debugMessage(_("### SKIPPING OLD RESULT") + response.toString()); //showMessage(_("### SKIPPING OLD RESULT") + response.toString());
return; return;
} }
@@ -986,7 +981,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
QByteArray rsp = GdbResponse::stringFromResultClass(response->resultClass); QByteArray rsp = GdbResponse::stringFromResultClass(response->resultClass);
rsp = "UNEXPECTED RESPONSE '" + rsp + "' TO COMMAND '" + cmd.command + "'"; rsp = "UNEXPECTED RESPONSE '" + rsp + "' TO COMMAND '" + cmd.command + "'";
qWarning() << rsp << " AT " __FILE__ ":" STRINGIFY(__LINE__); qWarning() << rsp << " AT " __FILE__ ":" STRINGIFY(__LINE__);
debugMessage(_(rsp)); showMessage(_(rsp));
} }
} else { } else {
if (cmd.callback) if (cmd.callback)
@@ -1031,7 +1026,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// event loop is entered, and let individual commands have a flag to suppress // event loop is entered, and let individual commands have a flag to suppress
// that behavior. // that behavior.
if (m_commandsDoneCallback && m_cookieForToken.isEmpty()) { if (m_commandsDoneCallback && m_cookieForToken.isEmpty()) {
debugMessage(_("ALL COMMANDS DONE; INVOKING CALLBACK")); showMessage(_("ALL COMMANDS DONE; INVOKING CALLBACK"));
CommandsDoneCallback cont = m_commandsDoneCallback; CommandsDoneCallback cont = m_commandsDoneCallback;
m_commandsDoneCallback = 0; m_commandsDoneCallback = 0;
(this->*cont)(); (this->*cont)();
@@ -1046,7 +1041,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
void GdbEngine::executeDebuggerCommand(const QString &command) void GdbEngine::executeDebuggerCommand(const QString &command)
{ {
if (state() == DebuggerNotReady) { if (state() == DebuggerNotReady) {
debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command); showMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
return; return;
} }
@@ -1256,9 +1251,9 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
// The related code (handleAqcuiredInferior()) is disabled as well. // The related code (handleAqcuiredInferior()) is disabled as well.
if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) { if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) {
QString dataStr = _(data.toString()); QString dataStr = _(data.toString());
debugMessage(_("SHARED LIBRARY EVENT: ") + dataStr); showMessage(_("SHARED LIBRARY EVENT: ") + dataStr);
QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern); QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern);
debugMessage(_("PATTERN: ") + pat); showMessage(_("PATTERN: ") + pat);
postCommand("sharedlibrary " + pat.toLocal8Bit()); postCommand("sharedlibrary " + pat.toLocal8Bit());
showStatusMessage(tr("Loading %1...").arg(dataStr)); showStatusMessage(tr("Loading %1...").arg(dataStr));
} }
@@ -1314,17 +1309,17 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
if (theDebuggerBoolSetting(SkipKnownFrames)) { if (theDebuggerBoolSetting(SkipKnownFrames)) {
if (reason == "end-stepping-range" || reason == "function-finished") { if (reason == "end-stepping-range" || reason == "function-finished") {
GdbMi frame = data.findChild("frame"); GdbMi frame = data.findChild("frame");
//debugMessage(frame.toString()); //showMessage(frame.toString());
QString funcName = _(frame.findChild("func").data()); QString funcName = _(frame.findChild("func").data());
QString fileName = QString::fromLocal8Bit(frame.findChild("file").data()); QString fileName = QString::fromLocal8Bit(frame.findChild("file").data());
if (isLeavableFunction(funcName, fileName)) { if (isLeavableFunction(funcName, fileName)) {
//debugMessage(_("LEAVING ") + funcName); //showMessage(_("LEAVING ") + funcName);
++stepCounter; ++stepCounter;
m_manager->executeStepOut(); m_manager->executeStepOut();
return; return;
} }
if (isSkippableFunction(funcName, fileName)) { if (isSkippableFunction(funcName, fileName)) {
//debugMessage(_("SKIPPING ") + funcName); //showMessage(_("SKIPPING ") + funcName);
++stepCounter; ++stepCounter;
m_manager->executeStep(); m_manager->executeStep();
return; return;
@@ -1386,7 +1381,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
&& reason == "signal-received" && reason == "signal-received"
&& data.findChild("signal-name").data() == "SIGTRAP") { && data.findChild("signal-name").data() == "SIGTRAP") {
// Caused by "library load" message. // Caused by "library load" message.
debugMessage(_("INTERNAL CONTINUE")); showMessage(_("INTERNAL CONTINUE"));
continueInferiorInternal(); continueInferiorInternal();
return; return;
} }
@@ -1507,7 +1502,7 @@ void GdbEngine::handleInfoProc(const GdbResponse &response)
void GdbEngine::handleShowVersion(const GdbResponse &response) void GdbEngine::handleShowVersion(const GdbResponse &response)
{ {
debugMessage(_("PARSING VERSION: " + response.toString())); showMessage(_("PARSING VERSION: " + response.toString()));
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
m_gdbVersion = 100; m_gdbVersion = 100;
m_gdbBuildVersion = -1; m_gdbBuildVersion = -1;
@@ -1517,11 +1512,11 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
extractGdbVersion(msg, extractGdbVersion(msg,
&m_gdbVersion, &m_gdbBuildVersion, &m_isMacGdb); &m_gdbVersion, &m_gdbBuildVersion, &m_isMacGdb);
if (m_gdbVersion > 60500 && m_gdbVersion < 200000) if (m_gdbVersion > 60500 && m_gdbVersion < 200000)
debugMessage(_("SUPPORTED GDB VERSION ") + msg); showMessage(_("SUPPORTED GDB VERSION ") + msg);
else else
debugMessage(_("UNSUPPORTED GDB VERSION ") + msg); showMessage(_("UNSUPPORTED GDB VERSION ") + msg);
debugMessage(_("USING GDB VERSION: %1, BUILD: %2%3").arg(m_gdbVersion) showMessage(_("USING GDB VERSION: %1, BUILD: %2%3").arg(m_gdbVersion)
.arg(m_gdbBuildVersion).arg(_(m_isMacGdb ? " (APPLE)" : ""))); .arg(m_gdbBuildVersion).arg(_(m_isMacGdb ? " (APPLE)" : "")));
} }
} }
@@ -1601,7 +1596,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
void GdbEngine::shutdown() void GdbEngine::shutdown()
{ {
debugMessage(_("INITIATE GDBENGINE SHUTDOWN")); showMessage(_("INITIATE GDBENGINE SHUTDOWN"));
if (m_progress) { if (m_progress) {
m_progress->setProgressValue(90); m_progress->setProgressValue(90);
m_progress->reportCanceled(); m_progress->reportCanceled();
@@ -1658,18 +1653,18 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
{ {
QTC_ASSERT(state() == InferiorShuttingDown, qDebug() << state()); QTC_ASSERT(state() == InferiorShuttingDown, qDebug() << state());
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN")); showMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
setState(InferiorShutDown); setState(InferiorShutDown);
} else { } else {
QByteArray ba = response.data.findChild("msg").data(); QByteArray ba = response.data.findChild("msg").data();
if (ba.contains(": No such file or directory.")) { if (ba.contains(": No such file or directory.")) {
// This happens when someone removed the binary behind our back. // This happens when someone removed the binary behind our back.
// It is not really an error from a user's point of view. // It is not really an error from a user's point of view.
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN")); showMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
debugMessage(_("NOTE: " + ba)); showMessage(_("NOTE: " + ba));
setState(InferiorShutDown); setState(InferiorShutDown);
} else { } else {
debugMessage(_("INFERIOR SHUTDOWN FAILED")); showMessage(_("INFERIOR SHUTDOWN FAILED"));
setState(InferiorShutdownFailed); setState(InferiorShutdownFailed);
showMessageBox(QMessageBox::Critical, showMessageBox(QMessageBox::Critical,
tr("Failed to shut down application"), tr("Failed to shut down application"),
@@ -1682,13 +1677,13 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
void GdbEngine::handleGdbExit(const GdbResponse &response) void GdbEngine::handleGdbExit(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultExit) { if (response.resultClass == GdbResultExit) {
debugMessage(_("GDB CLAIMS EXIT; WAITING")); showMessage(_("GDB CLAIMS EXIT; WAITING"));
m_commandsDoneCallback = 0; m_commandsDoneCallback = 0;
// Don't set state here, this will be handled in handleGdbFinished() // Don't set state here, this will be handled in handleGdbFinished()
} else { } else {
QString msg = m_gdbAdapter->msgGdbStopFailed( QString msg = m_gdbAdapter->msgGdbStopFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data())); QString::fromLocal8Bit(response.data.findChild("msg").data()));
debugMessage(_("GDB WON'T EXIT (%1); KILLING IT").arg(msg)); showMessage(_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
gdbProc()->kill(); gdbProc()->kill();
} }
} }
@@ -2050,9 +2045,9 @@ void GdbEngine::setTokenBarrier()
); );
} }
PENDING_DEBUG("\n--- token barrier ---\n"); PENDING_DEBUG("\n--- token barrier ---\n");
showDebuggerInput(_("--- token barrier ---"), LogMisc); showMessage(_("--- token barrier ---"), LogMiscInput);
if (theDebuggerBoolSetting(LogTimeStamps)) if (theDebuggerBoolSetting(LogTimeStamps))
showDebuggerInput(currentTime(), LogMisc); showMessage(currentTime(), LogMiscInput);
m_oldestAcceptableToken = currentToken(); m_oldestAcceptableToken = currentToken();
} }
@@ -2209,7 +2204,7 @@ void GdbEngine::handleWatchInsert(const GdbResponse &response)
data->bpNumber = ba.mid(20, pos - 20); data->bpNumber = ba.mid(20, pos - 20);
manager()->breakHandler()->updateMarkers(); manager()->breakHandler()->updateMarkers();
} else { } else {
debugMessage(_("CANNOT PARSE WATCHPOINT FROM" + ba)); showMessage(_("CANNOT PARSE WATCHPOINT FROM" + ba));
} }
} }
} }
@@ -2302,7 +2297,7 @@ void GdbEngine::handleBreakList(const GdbMi &table)
//qDebug() << " TO: " << data->toString(); //qDebug() << " TO: " << data->toString();
} else { } else {
//qDebug() << " NOTHING SUITABLE FOUND"; //qDebug() << " NOTHING SUITABLE FOUND";
debugMessage(_("CANNOT FIND BP: " + bkpt.toString())); showMessage(_("CANNOT FIND BP: " + bkpt.toString()));
} }
} }
@@ -2466,7 +2461,7 @@ void GdbEngine::attemptBreakpointSynchronization()
{ {
QTC_ASSERT(!m_sourcesListUpdating, QTC_ASSERT(!m_sourcesListUpdating,
qDebug() << "SOURCES LIST CURRENTLY UPDATING"; return); qDebug() << "SOURCES LIST CURRENTLY UPDATING"; return);
debugMessage(_("ATTEMPT BREAKPOINT SYNC")); showMessage(_("ATTEMPT BREAKPOINT SYNC"));
switch (state()) { switch (state()) {
case InferiorStarting: case InferiorStarting:
@@ -2477,7 +2472,7 @@ void GdbEngine::attemptBreakpointSynchronization()
break; break;
default: default:
//qDebug() << "attempted breakpoint sync in state" << state(); //qDebug() << "attempted breakpoint sync in state" << state();
debugMessage(_("... NOT POSSIBLE IN CURRENT STATE")); showMessage(_("... NOT POSSIBLE IN CURRENT STATE"));
return; return;
} }
@@ -2534,12 +2529,12 @@ void GdbEngine::attemptBreakpointSynchronization()
foreach (BreakpointData *data, handler->takeRemovedBreakpoints()) { foreach (BreakpointData *data, handler->takeRemovedBreakpoints()) {
QByteArray bpNumber = data->bpNumber; QByteArray bpNumber = data->bpNumber;
if (!bpNumber.trimmed().isEmpty()) { if (!bpNumber.trimmed().isEmpty()) {
debugMessage(_("DELETING BP " + bpNumber + " IN " showMessage(_("DELETING BP " + bpNumber + " IN "
+ data->markerFileName().toLocal8Bit())); + data->markerFileName().toLocal8Bit()));
postCommand("-break-delete " + bpNumber, postCommand("-break-delete " + bpNumber,
NeedsStop | RebuildBreakpointModel); NeedsStop | RebuildBreakpointModel);
} else { } else {
debugMessage(_("QUIETLY REMOVING UNNUMBERED BREAKPOINT")); showMessage(_("QUIETLY REMOVING UNNUMBERED BREAKPOINT"));
} }
delete data; delete data;
} }
@@ -3058,7 +3053,7 @@ void GdbEngine::activateSnapshot(int index)
"snapshot?"), QMessageBox::Ok | QMessageBox::Cancel); "snapshot?"), QMessageBox::Ok | QMessageBox::Cancel);
if (mb->exec() == QMessageBox::Cancel) if (mb->exec() == QMessageBox::Cancel)
return; return;
debugMessage(_("KILLING DEBUGGER AS REQUESTED BY USER")); showMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
delete m_gdbAdapter; delete m_gdbAdapter;
m_gdbAdapter = createAdapter(); m_gdbAdapter = createAdapter();
postCommand("kill", NeedsStop, CB(handleActivateSnapshot)); postCommand("kill", NeedsStop, CB(handleActivateSnapshot));
@@ -3376,8 +3371,8 @@ void GdbEngine::updateWatchData(const WatchData &data)
//qDebug() << "PROCESSED NAMES: " << processedName << m_processedNames; //qDebug() << "PROCESSED NAMES: " << processedName << m_processedNames;
if (m_processedNames.contains(processedName)) { if (m_processedNames.contains(processedName)) {
WatchData data1 = data; WatchData data1 = data;
showDebuggerInput(_("<Breaking endless loop for " + data.iname + '>'), showMessage(_("<Breaking endless loop for " + data.iname + '>'),
LogStatus); LogMiscInput);
data1.setAllUnneeded(); data1.setAllUnneeded();
data1.setValue(_("<unavailable>")); data1.setValue(_("<unavailable>"));
data1.setHasChildren(false); data1.setHasChildren(false);
@@ -3428,8 +3423,8 @@ void GdbEngine::rebuildWatchModel()
m_processedNames.clear(); m_processedNames.clear();
PENDING_DEBUG("REBUILDING MODEL" << count); PENDING_DEBUG("REBUILDING MODEL" << count);
if (theDebuggerBoolSetting(LogTimeStamps)) if (theDebuggerBoolSetting(LogTimeStamps))
showDebuggerInput(currentTime(), LogMisc); showMessage(currentTime(), LogMiscInput);
showDebuggerInput(_("<Rebuild Watchmodel %1>").arg(count), LogStatus); showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
showStatusMessage(tr("Finished retrieving data"), 400); showStatusMessage(tr("Finished retrieving data"), 400);
manager()->watchHandler()->endCycle(); manager()->watchHandler()->endCycle();
showToolTip(); showToolTip();
@@ -3457,7 +3452,7 @@ void GdbEngine::sendWatchParameters(const QByteArray &params0)
const QByteArray inBufferCmd = arrayFillCommand("qDumpInBuffer", params); const QByteArray inBufferCmd = arrayFillCommand("qDumpInBuffer", params);
params.replace('\0','!'); params.replace('\0','!');
showDebuggerInput(QString::fromUtf8(params), LogMisc); showMessage(QString::fromUtf8(params), LogMiscInput);
params.clear(); params.clear();
params.append('\0'); params.append('\0');
@@ -3903,7 +3898,7 @@ void GdbEngine::handleFetchDisassemblerByAddress1(const GdbResponse &response)
if (ac.agent->contentsCoversAddress(contents)) { if (ac.agent->contentsCoversAddress(contents)) {
ac.agent->setContents(parseDisassembler(lines)); ac.agent->setContents(parseDisassembler(lines));
} else { } else {
debugMessage(_("FALL BACK TO NON-MIXED")); showMessage(_("FALL BACK TO NON-MIXED"));
fetchDisassemblerByAddress(ac, false); fetchDisassemblerByAddress(ac, false);
} }
} }
@@ -4015,7 +4010,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
GdbOptionsPage::settingsId()); GdbOptionsPage::settingsId());
return false; return false;
} }
debugMessage(_("STARTING GDB ") + m_gdb); showMessage(_("STARTING GDB ") + m_gdb);
QStringList gdbArgs; QStringList gdbArgs;
gdbArgs << _("-i"); gdbArgs << _("-i");
gdbArgs << _("mi"); gdbArgs << _("mi");
@@ -4034,20 +4029,20 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
// Check for existing values. // Check for existing values.
if (environment.contains(pythonPathVariable)) { if (environment.contains(pythonPathVariable)) {
const QString oldPythonPath = environment.value(pythonPathVariable); const QString oldPythonPath = environment.value(pythonPathVariable);
showDebuggerOutput(_("Using existing python path: %1") showMessage(_("Using existing python path: %1")
.arg(oldPythonPath), LogMisc); .arg(oldPythonPath), LogMisc);
} else { } else {
const QString pythonPath = const QString pythonPath =
QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion)); QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
environment.insert(pythonPathVariable, pythonPath); environment.insert(pythonPathVariable, pythonPath);
showDebuggerOutput(_("Python path: %1").arg(pythonPath), LogMisc); showMessage(_("Python path: %1").arg(pythonPath), LogMisc);
gdbProc()->setProcessEnvironment(environment); gdbProc()->setProcessEnvironment(environment);
} }
foundPython = true; foundPython = true;
} }
} }
if (!foundPython) { if (!foundPython) {
debugMessage(_("UNSUPPORTED GDB %1 DOES NOT HAVE PYTHON.").arg(m_gdb)); showMessage(_("UNSUPPORTED GDB %1 DOES NOT HAVE PYTHON.").arg(m_gdb));
showStatusMessage(_("Gdb at %1 does not have python").arg(m_gdb)); showStatusMessage(_("Gdb at %1 does not have python").arg(m_gdb));
} }
#endif #endif
@@ -4073,7 +4068,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
const QByteArray dumperSourcePath = const QByteArray dumperSourcePath =
Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/"; Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/";
debugMessage(_("GDB STARTED, INITIALIZING IT")); showMessage(_("GDB STARTED, INITIALIZING IT"));
m_commandTimer->setInterval(commandTimeoutTime()); m_commandTimer->setInterval(commandTimeoutTime());
postCommand("show version", CB(handleShowVersion)); postCommand("show version", CB(handleShowVersion));
@@ -4178,7 +4173,7 @@ bool GdbEngine::checkDebuggingHelpers()
void GdbEngine::handleGdbError(QProcess::ProcessError error) void GdbEngine::handleGdbError(QProcess::ProcessError error)
{ {
debugMessage(_("HANDLE GDB ERROR")); showMessage(_("HANDLE GDB ERROR"));
switch (error) { switch (error) {
case QProcess::Crashed: case QProcess::Crashed:
break; // will get a processExited() as well break; // will get a processExited() as well
@@ -4197,11 +4192,11 @@ void GdbEngine::handleGdbError(QProcess::ProcessError error)
void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type) void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
{ {
debugMessage(_("GDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code)); showMessage(_("GDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
if (!m_gdbAdapter) { if (!m_gdbAdapter) {
debugMessage(_("NO ADAPTER PRESENT")); showMessage(_("NO ADAPTER PRESENT"));
} else if (state() == EngineShuttingDown) { } else if (state() == EngineShuttingDown) {
debugMessage(_("GOING TO SHUT DOWN ADAPTER")); showMessage(_("GOING TO SHUT DOWN ADAPTER"));
m_gdbAdapter->shutdown(); m_gdbAdapter->shutdown();
} else if (state() != AdapterStartFailed) { } else if (state() != AdapterStartFailed) {
QString msg = tr("The gdb process exited unexpectedly (%1).") QString msg = tr("The gdb process exited unexpectedly (%1).")
@@ -4218,7 +4213,7 @@ void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
void GdbEngine::handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint) void GdbEngine::handleAdapterStartFailed(const QString &msg, const QString &settingsIdHint)
{ {
setState(AdapterStartFailed); setState(AdapterStartFailed);
debugMessage(_("ADAPTER START FAILED")); showMessage(_("ADAPTER START FAILED"));
if (!msg.isEmpty()) { if (!msg.isEmpty()) {
const QString title = tr("Adapter start failed"); const QString title = tr("Adapter start failed");
if (settingsIdHint.isEmpty()) { if (settingsIdHint.isEmpty()) {
@@ -4236,7 +4231,7 @@ void GdbEngine::handleAdapterStarted()
setState(AdapterStarted); setState(AdapterStarted);
if (m_progress) if (m_progress)
m_progress->setProgressValue(25); m_progress->setProgressValue(25);
debugMessage(_("ADAPTER SUCCESSFULLY STARTED")); showMessage(_("ADAPTER SUCCESSFULLY STARTED"));
showStatusMessage(tr("Starting inferior...")); showStatusMessage(tr("Starting inferior..."));
setState(InferiorStarting); setState(InferiorStarting);
@@ -4261,7 +4256,7 @@ void GdbEngine::handleInferiorPrepared()
// Initial attempt to set breakpoints // Initial attempt to set breakpoints
showStatusMessage(tr("Setting breakpoints...")); showStatusMessage(tr("Setting breakpoints..."));
debugMessage(tr("Setting breakpoints...")); showMessage(tr("Setting breakpoints..."));
attemptBreakpointSynchronization(); attemptBreakpointSynchronization();
if (m_cookieForToken.isEmpty()) { if (m_cookieForToken.isEmpty()) {
@@ -4274,7 +4269,7 @@ void GdbEngine::handleInferiorPrepared()
void GdbEngine::startInferiorPhase2() void GdbEngine::startInferiorPhase2()
{ {
debugMessage(_("BREAKPOINTS SET, CONTINUING INFERIOR STARTUP")); showMessage(_("BREAKPOINTS SET, CONTINUING INFERIOR STARTUP"));
m_gdbAdapter->startInferiorPhase2(); m_gdbAdapter->startInferiorPhase2();
} }
@@ -4282,10 +4277,10 @@ void GdbEngine::handleInferiorStartFailed(const QString &msg)
{ {
showStatusMessage(tr("Failed to start application: ") + msg); showStatusMessage(tr("Failed to start application: ") + msg);
if (state() == AdapterStartFailed) { if (state() == AdapterStartFailed) {
debugMessage(_("INFERIOR START FAILED, BUT ADAPTER DIED ALREADY")); showMessage(_("INFERIOR START FAILED, BUT ADAPTER DIED ALREADY"));
return; // Adapter crashed meanwhile, so this notification is meaningless. return; // Adapter crashed meanwhile, so this notification is meaningless.
} }
debugMessage(_("INFERIOR START FAILED")); showMessage(_("INFERIOR START FAILED"));
showMessageBox(QMessageBox::Critical, tr("Failed to start application"), msg); showMessageBox(QMessageBox::Critical, tr("Failed to start application"), msg);
setState(InferiorStartFailed); setState(InferiorStartFailed);
shutdown(); shutdown();
@@ -4293,7 +4288,7 @@ void GdbEngine::handleInferiorStartFailed(const QString &msg)
void GdbEngine::handleAdapterCrashed(const QString &msg) void GdbEngine::handleAdapterCrashed(const QString &msg)
{ {
debugMessage(_("ADAPTER CRASHED")); showMessage(_("ADAPTER CRASHED"));
// The adapter is expected to have cleaned up after itself when we get here, // The adapter is expected to have cleaned up after itself when we get here,
// so the effect is about the same as AdapterStartFailed => use it. // so the effect is about the same as AdapterStartFailed => use it.

View File

@@ -527,7 +527,6 @@ private: ////////// Convenience Functions //////////
QString errorMessage(QProcess::ProcessError error); QString errorMessage(QProcess::ProcessError error);
QMessageBox *showMessageBox(int icon, const QString &title, const QString &text, QMessageBox *showMessageBox(int icon, const QString &title, const QString &text,
int buttons = 0); int buttons = 0);
void debugMessage(const QString &msg);
QMainWindow *mainWindow() const; QMainWindow *mainWindow() const;
AbstractGdbProcess *gdbProc() const; AbstractGdbProcess *gdbProc() const;

View File

@@ -70,7 +70,7 @@ void LocalPlainGdbAdapter::startAdapter()
{ {
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting); setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER")); showMessage(_("TRYING TO START ADAPTER"));
QStringList gdbArgs; QStringList gdbArgs;
@@ -125,17 +125,17 @@ void LocalPlainGdbAdapter::interruptInferior()
{ {
const qint64 attachedPID = m_engine->inferiorPid(); const qint64 attachedPID = m_engine->inferiorPid();
if (attachedPID <= 0) { if (attachedPID <= 0) {
debugMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED")); showMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED"));
return; return;
} }
if (!interruptProcess(attachedPID)) if (!interruptProcess(attachedPID))
debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID)); showMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
} }
void LocalPlainGdbAdapter::shutdown() void LocalPlainGdbAdapter::shutdown()
{ {
debugMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state())); showMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state()));
m_outputCollector.shutdown(); m_outputCollector.shutdown();
} }

View File

@@ -120,7 +120,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
//qDebug() << "SECOND CHUNK: " << out; //qDebug() << "SECOND CHUNK: " << out;
int pos = out.indexOf("data="); int pos = out.indexOf("data=");
if (pos != 0) { if (pos != 0) {
debugMessage(_("DISCARDING JUNK AT BEGIN OF RESPONSE: " showMessage(_("DISCARDING JUNK AT BEGIN OF RESPONSE: "
+ out.left(pos))); + out.left(pos)));
out = out.mid(pos); out = out.mid(pos);
} }
@@ -186,7 +186,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
rebuildWatchModel(); rebuildWatchModel();
} }
} else { } else {
debugMessage(_("DUMPER FAILED: " + response.toString())); showMessage(_("DUMPER FAILED: " + response.toString()));
} }
} }

View File

@@ -86,13 +86,13 @@ void RemoteGdbServerAdapter::startAdapter()
{ {
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting); setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER")); showMessage(_("TRYING TO START ADAPTER"));
// FIXME: make asynchroneous // FIXME: make asynchroneous
// Start the remote server // Start the remote server
if (startParameters().serverStartScript.isEmpty()) { if (startParameters().serverStartScript.isEmpty()) {
m_engine->showStatusMessage(_("No server start script given. " showMessage(_("No server start script given. "
"Assuming server runs already.")); "Assuming server runs already."), StatusBar);
} else { } else {
m_uploadProc.start(_("/bin/sh ") + startParameters().serverStartScript); m_uploadProc.start(_("/bin/sh ") + startParameters().serverStartScript);
m_uploadProc.waitForStarted(); m_uploadProc.waitForStarted();
@@ -135,20 +135,24 @@ void RemoteGdbServerAdapter::uploadProcError(QProcess::ProcessError error)
"This is the default return value of error()."); "This is the default return value of error().");
} }
m_engine->showStatusMessage(msg); showMessage(msg, StatusBar);
showMessageBox(QMessageBox::Critical, tr("Error"), msg); showMessageBox(QMessageBox::Critical, tr("Error"), msg);
} }
void RemoteGdbServerAdapter::readUploadStandardOutput() void RemoteGdbServerAdapter::readUploadStandardOutput()
{ {
QByteArray ba = m_uploadProc.readAllStandardOutput(); const QByteArray ba = m_uploadProc.readAllStandardOutput();
runControl()->showDebuggerOutput(QString::fromLocal8Bit(ba, ba.length()), LogOutput); const QString msg = QString::fromLocal8Bit(ba, ba.length());
showMessage(msg, LogOutput);
showMessage(msg, AppOutput);
} }
void RemoteGdbServerAdapter::readUploadStandardError() void RemoteGdbServerAdapter::readUploadStandardError()
{ {
QByteArray ba = m_uploadProc.readAllStandardError(); const QByteArray ba = m_uploadProc.readAllStandardError();
runControl()->showDebuggerOutput(QString::fromLocal8Bit(ba, ba.length()), LogError); const QString msg = QString::fromLocal8Bit(ba, ba.length());
showMessage(msg, LogOutput);
showMessage(msg, AppError);
} }
void RemoteGdbServerAdapter::startInferior() void RemoteGdbServerAdapter::startInferior()
@@ -209,8 +213,8 @@ void RemoteGdbServerAdapter::handleTargetRemote(const GdbResponse &record)
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
setState(InferiorStopped); setState(InferiorStopped);
// gdb server will stop the remote application itself. // gdb server will stop the remote application itself.
debugMessage(_("INFERIOR STARTED")); showMessage(_("INFERIOR STARTED"));
showStatusMessage(msgAttachedToStoppedInferior()); showMessage(msgAttachedToStoppedInferior(), StatusBar);
emit inferiorPrepared(); emit inferiorPrepared();
} else { } else {
// 16^error,msg="hd:5555: Connection timed out." // 16^error,msg="hd:5555: Connection timed out."

View File

@@ -48,7 +48,7 @@ void RemotePlainGdbAdapter::startAdapter()
{ {
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting); setState(AdapterStarting);
debugMessage(QLatin1String("TRYING TO START ADAPTER")); showMessage(QLatin1String("TRYING TO START ADAPTER"));
if (!startParameters().workingDirectory.isEmpty()) if (!startParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory); m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
@@ -86,8 +86,8 @@ QString RemotePlainGdbAdapter::fromLocalEncoding(const QByteArray &b) const
void RemotePlainGdbAdapter::handleApplicationOutput(const QByteArray &output) void RemotePlainGdbAdapter::handleApplicationOutput(const QByteArray &output)
{ {
QTC_ASSERT(m_engine->runControl(), return); // FIXME: Remote encoding?
m_engine->runControl()->showApplicationOutput(output, false); showMessage(QString::fromLatin1(output), AppOutput);
} }
} // namespace Internal } // namespace Internal

View File

@@ -83,7 +83,7 @@ void TermGdbAdapter::startAdapter()
{ {
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting); setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER")); showMessage(_("TRYING TO START ADAPTER"));
// Currently, adapters are not re-used // Currently, adapters are not re-used
// // We leave the console open, so recycle it now. // // We leave the console open, so recycle it now.
@@ -130,7 +130,7 @@ void TermGdbAdapter::handleStubAttached(const GdbResponse &response)
QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
setState(InferiorStopped); setState(InferiorStopped);
debugMessage(_("INFERIOR ATTACHED")); showMessage(_("INFERIOR ATTACHED"));
emit inferiorPrepared(); emit inferiorPrepared();
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
m_engine->postCommand("-stack-list-frames 0 0", CB(handleEntryPoint)); m_engine->postCommand("-stack-list-frames 0 0", CB(handleEntryPoint));
@@ -162,7 +162,7 @@ void TermGdbAdapter::interruptInferior()
const qint64 attachedPID = m_engine->inferiorPid(); const qint64 attachedPID = m_engine->inferiorPid();
QTC_ASSERT(attachedPID > 0, return); QTC_ASSERT(attachedPID > 0, return);
if (!interruptProcess(attachedPID)) if (!interruptProcess(attachedPID))
debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID)); showMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
} }
void TermGdbAdapter::stubMessage(const QString &msg, bool) void TermGdbAdapter::stubMessage(const QString &msg, bool)
@@ -172,7 +172,7 @@ void TermGdbAdapter::stubMessage(const QString &msg, bool)
void TermGdbAdapter::stubExited() void TermGdbAdapter::stubExited()
{ {
debugMessage(_("STUB EXITED")); showMessage(_("STUB EXITED"));
if (state() != AdapterStarting // From previous instance if (state() != AdapterStarting // From previous instance
&& state() != EngineShuttingDown && state() != DebuggerNotReady) && state() != EngineShuttingDown && state() != DebuggerNotReady)
emit adapterCrashed(QString()); emit adapterCrashed(QString());

View File

@@ -379,7 +379,7 @@ QByteArray TrkGdbAdapter::trkStepRangeMessage()
if (from <= pc && pc <= to) { if (from <= pc && pc <= to) {
//to = qMax(to - 4, from); //to = qMax(to - 4, from);
//to = qMax(to - 4, from); //to = qMax(to - 4, from);
debugMessage("STEP IN " + hexxNumber(from) + " " + hexxNumber(to) showMessage("STEP IN " + hexxNumber(from) + " " + hexxNumber(to)
+ " INSTEAD OF " + hexxNumber(pc)); + " INSTEAD OF " + hexxNumber(pc));
} else { } else {
from = pc; from = pc;
@@ -434,7 +434,7 @@ void TrkGdbAdapter::slotEmitDelayedInferiorStartFailed()
void TrkGdbAdapter::logMessage(const QString &msg) void TrkGdbAdapter::logMessage(const QString &msg)
{ {
if (m_verbose) if (m_verbose)
debugMessage("TRK LOG: " + msg); showMessage("TRK LOG: " + msg);
} }
// //
@@ -1130,7 +1130,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
} }
case TrkNotifyStopped: { // 0x90 Notified Stopped case TrkNotifyStopped: { // 0x90 Notified Stopped
// 90 01 78 6a 40 40 00 00 07 23 00 00 07 24 00 00 // 90 01 78 6a 40 40 00 00 07 23 00 00 07 24 00 00
debugMessage(_("RESET SNAPSHOT (NOTIFY STOPPED)")); showMessage(_("RESET SNAPSHOT (NOTIFY STOPPED)"));
m_snapshot.reset(); m_snapshot.reset();
QString reason; QString reason;
uint addr; uint addr;
@@ -1139,7 +1139,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
trk::Launcher::parseNotifyStopped(result.data, &pid, &tid, &addr, &reason); trk::Launcher::parseNotifyStopped(result.data, &pid, &tid, &addr, &reason);
const QString msg = trk::Launcher::msgStopped(pid, tid, addr, reason); const QString msg = trk::Launcher::msgStopped(pid, tid, addr, reason);
logMessage(prefix + msg); logMessage(prefix + msg);
runControl()->showDebuggerOutput(msg, LogMisc); showMessage(msg, LogMisc);
sendTrkAck(result.token); sendTrkAck(result.token);
if (addr) { if (addr) {
// Todo: Do not send off GdbMessages if a synced gdb // Todo: Do not send off GdbMessages if a synced gdb
@@ -1174,14 +1174,14 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
break; break;
} }
case TrkNotifyException: { // 0x91 Notify Exception (obsolete) case TrkNotifyException: { // 0x91 Notify Exception (obsolete)
debugMessage(_("RESET SNAPSHOT (NOTIFY EXCEPTION)")); showMessage(_("RESET SNAPSHOT (NOTIFY EXCEPTION)"));
m_snapshot.reset(); m_snapshot.reset();
logMessage(prefix + "NOTE: EXCEPTION " + str); logMessage(prefix + "NOTE: EXCEPTION " + str);
sendTrkAck(result.token); sendTrkAck(result.token);
break; break;
} }
case 0x92: { // case 0x92: { //
debugMessage(_("RESET SNAPSHOT (NOTIFY INTERNAL ERROR)")); showMessage(_("RESET SNAPSHOT (NOTIFY INTERNAL ERROR)"));
m_snapshot.reset(); m_snapshot.reset();
logMessage(prefix + "NOTE: INTERNAL ERROR: " + str); logMessage(prefix + "NOTE: INTERNAL ERROR: " + str);
sendTrkAck(result.token); sendTrkAck(result.token);
@@ -1192,7 +1192,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
case 0xa0: { // Notify Created case 0xa0: { // Notify Created
// Sending this ACK does not seem to make a difference. Why? // Sending this ACK does not seem to make a difference. Why?
//sendTrkAck(result.token); //sendTrkAck(result.token);
debugMessage(_("RESET SNAPSHOT (NOTIFY CREATED)")); showMessage(_("RESET SNAPSHOT (NOTIFY CREATED)"));
m_snapshot.fullReset(); m_snapshot.fullReset();
const char *data = result.data.data(); const char *data = result.data.data();
const trk::byte error = result.data.at(0); const trk::byte error = result.data.at(0);
@@ -1521,7 +1521,7 @@ void TrkGdbAdapter::tryAnswerGdbMemoryRequest(bool buffered)
} }
// Happens when chunks are not combined // Happens when chunks are not combined
QTC_ASSERT(false, /**/); QTC_ASSERT(false, /**/);
debugMessage("CHUNKS NOT COMBINED"); showMessage("CHUNKS NOT COMBINED");
# ifdef MEMORY_DEBUG # ifdef MEMORY_DEBUG
qDebug() << "CHUNKS NOT COMBINED"; qDebug() << "CHUNKS NOT COMBINED";
it = m_snapshot.memory.begin(); it = m_snapshot.memory.begin();
@@ -1590,7 +1590,7 @@ void TrkGdbAdapter::handleStep(const TrkResult &result)
logMessage("ERROR: " + result.errorString() + " in handleStep"); logMessage("ERROR: " + result.errorString() + " in handleStep");
// Try fallback with Continue. // Try fallback with Continue.
debugMessage("FALLBACK TO 'CONTINUE'"); showMessage("FALLBACK TO 'CONTINUE'");
sendTrkMessage(0x18, TrkCallback(), trkContinueMessage(), "CONTINUE"); sendTrkMessage(0x18, TrkCallback(), trkContinueMessage(), "CONTINUE");
//sendGdbServerMessage("S05", "Stepping finished"); //sendGdbServerMessage("S05", "Stepping finished");
@@ -1775,7 +1775,7 @@ void TrkGdbAdapter::startAdapter()
// Start // Start
QTC_ASSERT(state() == EngineStarting, qDebug() << state()); QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting); setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER")); showMessage(_("TRYING TO START ADAPTER"));
logMessage(QLatin1String("### Starting TrkGdbAdapter")); logMessage(QLatin1String("### Starting TrkGdbAdapter"));
// Prompt the user to start communication // Prompt the user to start communication

View File

@@ -58,16 +58,10 @@ bool IDebuggerEngine::checkConfiguration(int toolChain,
return true; return true;
} }
void IDebuggerEngine::showDebuggerInput(const QString &msg, int channel) const void IDebuggerEngine::showMessage(const QString &msg, int channel, int timeout) const
{ {
QTC_ASSERT(runControl(), return); QTC_ASSERT(runControl(), return);
runControl()->showDebuggerInput(msg, channel); runControl()->showMessage(msg, channel, timeout);
}
void IDebuggerEngine::showDebuggerOutput(const QString &msg, int channel) const
{
QTC_ASSERT(runControl(), return);
runControl()->showDebuggerOutput(msg, channel);
} }
} // namespace Internal } // namespace Internal

View File

@@ -133,11 +133,11 @@ public:
virtual QString qtNamespace() const { return QString(); } virtual QString qtNamespace() const { return QString(); }
// Convenience // Convenience
void showDebuggerInput(const QString &msg, int channel = LogDebug) const; void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1) const;
void showDebuggerOutput(const QString &msg, int channel = LogDebug) const; void showStatusMessage(const QString &msg, int timeout = -1) const
{ showMessage(msg, StatusBar, timeout); }
protected: protected:
void showStatusMessage(const QString &msg, int timeout = -1);
DebuggerState state() const; DebuggerState state() const;
void setState(DebuggerState state, bool forced = false); void setState(DebuggerState state, bool forced = false);
DebuggerManager *manager() const { return m_manager; } DebuggerManager *manager() const { return m_manager; }

View File

@@ -94,7 +94,7 @@ void PdbEngine::executeDebuggerCommand(const QString &command)
{ {
XSDEBUG("PdbEngine::executeDebuggerCommand:" << command); XSDEBUG("PdbEngine::executeDebuggerCommand:" << command);
if (state() == DebuggerNotReady) { if (state() == DebuggerNotReady) {
showDebuggerOutput(_("PDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command); showMessage(_("PDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
return; return;
} }
m_pdbProc.write(command.toLatin1() + "\n"); m_pdbProc.write(command.toLatin1() + "\n");
@@ -112,7 +112,7 @@ void PdbEngine::postCommand(const QByteArray &command,
cmd.callbackName = callbackName; cmd.callbackName = callbackName;
cmd.cookie = cookie; cmd.cookie = cookie;
m_commands.enqueue(cmd); m_commands.enqueue(cmd);
showDebuggerInput(_(cmd.command), LogInput); showMessage(_(cmd.command), LogInput);
m_pdbProc.write(cmd.command + "\n"); m_pdbProc.write(cmd.command + "\n");
} }
@@ -144,8 +144,8 @@ void PdbEngine::startDebugger()
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath(); m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
QFile scriptFile(m_scriptFileName); QFile scriptFile(m_scriptFileName);
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) { if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
//showDebuggerOutput("STARTING " +m_scriptFileName + "FAILED"); //showMessage("STARTING " +m_scriptFileName + "FAILED");
showDebuggerOutput(QString::fromLatin1("Cannot open %1: %2"). showMessage(QString::fromLatin1("Cannot open %1: %2").
arg(m_scriptFileName, scriptFile.errorString()), LogError); arg(m_scriptFileName, scriptFile.errorString()), LogError);
emit startFailed(); emit startFailed();
return; return;
@@ -158,7 +158,7 @@ void PdbEngine::startDebugger()
m_pdbProc.disconnect(); // From any previous runs m_pdbProc.disconnect(); // From any previous runs
m_pdb = _("/usr/bin/python"); m_pdb = _("/usr/bin/python");
showDebuggerOutput(_("STARTING PDB ") + m_pdb); showMessage(_("STARTING PDB ") + m_pdb);
QStringList gdbArgs; QStringList gdbArgs;
gdbArgs += _("-i"); gdbArgs += _("-i");
gdbArgs += _("/usr/bin/pdb"); gdbArgs += _("/usr/bin/pdb");
@@ -186,7 +186,7 @@ void PdbEngine::startDebugger()
const QString msg = tr("Unable to start pdb '%1': %2") const QString msg = tr("Unable to start pdb '%1': %2")
.arg(m_pdb, m_pdbProc.errorString()); .arg(m_pdb, m_pdbProc.errorString());
setState(AdapterStartFailed); setState(AdapterStartFailed);
showDebuggerOutput(_("ADAPTER START FAILED")); showMessage(_("ADAPTER START FAILED"));
if (!msg.isEmpty()) { if (!msg.isEmpty()) {
const QString title = tr("Adapter start failed"); const QString title = tr("Adapter start failed");
Core::ICore::instance()->showWarningWithOptions(title, msg); Core::ICore::instance()->showWarningWithOptions(title, msg);
@@ -200,7 +200,7 @@ void PdbEngine::startDebugger()
setState(InferiorRunning); setState(InferiorRunning);
attemptBreakpointSynchronization(); attemptBreakpointSynchronization();
showDebuggerOutput(_("PDB STARTED, INITIALIZING IT")); showMessage(_("PDB STARTED, INITIALIZING IT"));
const QByteArray dumperSourcePath = const QByteArray dumperSourcePath =
Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/"; Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/";
postCommand("execfile('" + dumperSourcePath + "pdumper.py')", postCommand("execfile('" + dumperSourcePath + "pdumper.py')",
@@ -556,7 +556,7 @@ void PdbEngine::updateWatchData(const WatchData &data)
void PdbEngine::handlePdbError(QProcess::ProcessError error) void PdbEngine::handlePdbError(QProcess::ProcessError error)
{ {
showDebuggerOutput(_("HANDLE PDB ERROR")); showMessage(_("HANDLE PDB ERROR"));
switch (error) { switch (error) {
case QProcess::Crashed: case QProcess::Crashed:
break; // will get a processExited() as well break; // will get a processExited() as well
@@ -602,7 +602,7 @@ QString PdbEngine::errorMessage(QProcess::ProcessError error) const
void PdbEngine::handlePdbFinished(int code, QProcess::ExitStatus type) void PdbEngine::handlePdbFinished(int code, QProcess::ExitStatus type)
{ {
showDebuggerOutput(_("PDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code)); showMessage(_("PDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
//shutdown(); //shutdown();
//initializeVariables(); //initializeVariables();
setState(DebuggerNotReady, true); setState(DebuggerNotReady, true);
@@ -612,7 +612,7 @@ void PdbEngine::readPdbStandardError()
{ {
QByteArray err = m_pdbProc.readAllStandardError(); QByteArray err = m_pdbProc.readAllStandardError();
qWarning() << "Unexpected pdb stderr:" << err; qWarning() << "Unexpected pdb stderr:" << err;
showDebuggerOutput(_("Unexpected pdb stderr: " + err)); showMessage(_("Unexpected pdb stderr: " + err));
} }
void PdbEngine::readPdbStandardOutput() void PdbEngine::readPdbStandardOutput()
@@ -623,7 +623,7 @@ void PdbEngine::readPdbStandardOutput()
while ((pos = m_inbuffer.indexOf("(Pdb)")) != -1) { while ((pos = m_inbuffer.indexOf("(Pdb)")) != -1) {
PdbResponse response; PdbResponse response;
response.data = m_inbuffer.left(pos).trimmed(); response.data = m_inbuffer.left(pos).trimmed();
showDebuggerOutput(_(response.data)); showMessage(_(response.data));
m_inbuffer = m_inbuffer.mid(pos + 6); m_inbuffer = m_inbuffer.mid(pos + 6);
QTC_ASSERT(!m_commands.isEmpty(), QTC_ASSERT(!m_commands.isEmpty(),
qDebug() << "RESPONSE: " << response.data; return) qDebug() << "RESPONSE: " << response.data; return)

View File

@@ -314,7 +314,7 @@ void QmlEngine::handleResponse(const QByteArray &response)
/* /*
static QTime lastTime; static QTime lastTime;
//debugMessage(_(" "), currentTime()); //showMessage(_(" "), currentTime(), LogTime);
QList<QByteArray> parts = response.split('\0'); QList<QByteArray> parts = response.split('\0');
if (parts.size() < 2 || !parts.last().isEmpty()) { if (parts.size() < 2 || !parts.last().isEmpty()) {
SDEBUG("WRONG RESPONSE PACKET LAYOUT" << parts); SDEBUG("WRONG RESPONSE PACKET LAYOUT" << parts);
@@ -460,7 +460,7 @@ void QmlEngine::sendCommandNow(const QmlCommand &cmd)
int result = m_socket->write(cmd.command); int result = m_socket->write(cmd.command);
Q_UNUSED(result) Q_UNUSED(result)
m_socket->flush(); m_socket->flush();
showDebuggerInput(QString::number(cmd.token) + " " + cmd.toString(), LogInput); showMessage(QString::number(cmd.token) + " " + cmd.toString(), LogInput);
SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result)); SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result));
} }

View File

@@ -128,7 +128,7 @@ void ScriptAgent::exceptionCatch(qint64 scriptId, const QScriptValue & exception
const QString msg = QString::fromLatin1("An exception was caught on %1: '%2'"). const QString msg = QString::fromLatin1("An exception was caught on %1: '%2'").
arg(scriptId).arg(exception.toString()); arg(scriptId).arg(exception.toString());
SDEBUG(msg); SDEBUG(msg);
q->showDebuggerOutput(msg, LogMisc); q->showMessage(msg, LogMisc);
} }
void ScriptAgent::exceptionThrow(qint64 scriptId, const QScriptValue &exception, void ScriptAgent::exceptionThrow(qint64 scriptId, const QScriptValue &exception,
@@ -140,13 +140,13 @@ void ScriptAgent::exceptionThrow(qint64 scriptId, const QScriptValue &exception,
const QString msg = QString::fromLatin1("An exception occurred on %1: '%2'"). const QString msg = QString::fromLatin1("An exception occurred on %1: '%2'").
arg(scriptId).arg(exception.toString()); arg(scriptId).arg(exception.toString());
SDEBUG(msg); SDEBUG(msg);
q->showDebuggerOutput(msg, LogMisc); q->showMessage(msg, LogMisc);
} }
void ScriptAgent::functionEntry(qint64 scriptId) void ScriptAgent::functionEntry(qint64 scriptId)
{ {
Q_UNUSED(scriptId) Q_UNUSED(scriptId)
q->showDebuggerOutput(QString::fromLatin1("Function entry occurred on %1").arg(scriptId), LogMisc); q->showMessage(QString::fromLatin1("Function entry occurred on %1").arg(scriptId), LogMisc);
q->checkForBreakCondition(true); q->checkForBreakCondition(true);
} }
@@ -156,7 +156,7 @@ void ScriptAgent::functionExit(qint64 scriptId, const QScriptValue &returnValue)
Q_UNUSED(returnValue) Q_UNUSED(returnValue)
const QString msg = QString::fromLatin1("Function exit occurred on %1: '%2'").arg(scriptId).arg(returnValue.toString()); const QString msg = QString::fromLatin1("Function exit occurred on %1: '%2'").arg(scriptId).arg(returnValue.toString());
SDEBUG(msg); SDEBUG(msg);
q->showDebuggerOutput(msg, LogMisc); q->showMessage(msg, LogMisc);
} }
void ScriptAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber) void ScriptAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber)
@@ -175,7 +175,7 @@ void ScriptAgent::scriptLoad(qint64 scriptId, const QString &program,
Q_UNUSED(program) Q_UNUSED(program)
Q_UNUSED(fileName) Q_UNUSED(fileName)
Q_UNUSED(baseLineNumber) Q_UNUSED(baseLineNumber)
q->showDebuggerOutput(QString::fromLatin1("Loaded: %1 id: %2") q->showMessage(QString::fromLatin1("Loaded: %1 id: %2")
.arg(fileName).arg(scriptId), LogMisc); .arg(fileName).arg(scriptId), LogMisc);
} }
@@ -252,7 +252,7 @@ void ScriptEngine::startDebugger()
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath(); m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
QFile scriptFile(m_scriptFileName); QFile scriptFile(m_scriptFileName);
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) { if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
showDebuggerOutput(QString::fromLatin1("Cannot open %1: %2"). showMessage(QString::fromLatin1("Cannot open %1: %2").
arg(m_scriptFileName, scriptFile.errorString()), LogError); arg(m_scriptFileName, scriptFile.errorString()), LogError);
emit startFailed(); emit startFailed();
return; return;
@@ -263,7 +263,7 @@ void ScriptEngine::startDebugger()
attemptBreakpointSynchronization(); attemptBreakpointSynchronization();
setState(InferiorRunningRequested); setState(InferiorRunningRequested);
showStatusMessage(tr("Running requested..."), 5000); showStatusMessage(tr("Running requested..."), 5000);
showDebuggerOutput(QLatin1String("Running: ") + m_scriptFileName, LogMisc); showMessage(QLatin1String("Running: ") + m_scriptFileName, LogMisc);
QTimer::singleShot(0, this, SLOT(runInferior())); QTimer::singleShot(0, this, SLOT(runInferior()));
emit startSuccessful(); emit startSuccessful();
} }
@@ -341,7 +341,7 @@ void ScriptEngine::runInferior()
msg = QString::fromLatin1("Evaluation returns '%1'") msg = QString::fromLatin1("Evaluation returns '%1'")
.arg(result.toString()); .arg(result.toString());
} }
showDebuggerOutput(msg, LogMisc); showMessage(msg, LogMisc);
exitDebugger(); exitDebugger();
} }

View File

@@ -313,7 +313,7 @@ void TcfEngine::handleResponse(const QByteArray &response)
{ {
static QTime lastTime; static QTime lastTime;
//debugMessage(_(" "), currentTime()); //showMessage(_(" "), currentTime(), LogTime);
QList<QByteArray> parts = response.split('\0'); QList<QByteArray> parts = response.split('\0');
if (parts.size() < 2 || !parts.last().isEmpty()) { if (parts.size() < 2 || !parts.last().isEmpty()) {
SDEBUG("WRONG RESPONSE PACKET LAYOUT" << parts); SDEBUG("WRONG RESPONSE PACKET LAYOUT" << parts);
@@ -328,7 +328,7 @@ void TcfEngine::handleResponse(const QByteArray &response)
int token = parts.at(1).toInt(); int token = parts.at(1).toInt();
TcfCommand tcf = m_cookieForToken[token]; TcfCommand tcf = m_cookieForToken[token];
SDEBUG("COMMAND NOT RECOGNIZED FOR TOKEN" << token << tcf.toString()); SDEBUG("COMMAND NOT RECOGNIZED FOR TOKEN" << token << tcf.toString());
showDebuggerOutput(QString::number(token) + "^" showMessage(QString::number(token) + "^"
+ "NOT RECOQNIZED: " + quoteUnprintableLatin1(response), + "NOT RECOQNIZED: " + quoteUnprintableLatin1(response),
LogOutput); LogOutput);
acknowledgeResult(); acknowledgeResult();
@@ -340,7 +340,7 @@ void TcfEngine::handleResponse(const QByteArray &response)
int token = parts.at(1).toInt(); int token = parts.at(1).toInt();
QByteArray message = parts.at(2); QByteArray message = parts.at(2);
JsonValue data(parts.at(3)); JsonValue data(parts.at(3));
showDebuggerOutput(QString("%1^%2%3").arg(token) showMessage(QString("%1^%2%3").arg(token)
.arg(quoteUnprintableLatin1(response)) .arg(quoteUnprintableLatin1(response))
.arg(QString::fromUtf8(data.toString())), LogOutput); .arg(QString::fromUtf8(data.toString())), LogOutput);
TcfCommand tcf = m_cookieForToken[token]; TcfCommand tcf = m_cookieForToken[token];
@@ -482,7 +482,7 @@ void TcfEngine::sendCommandNow(const TcfCommand &cmd)
int result = m_socket->write(cmd.command); int result = m_socket->write(cmd.command);
Q_UNUSED(result) Q_UNUSED(result)
m_socket->flush(); m_socket->flush();
showDebuggerInput(QString::number(cmd.token) + " " + cmd.toString(), LogInput); showMessage(QString::number(cmd.token) + " " + cmd.toString(), LogInput);
SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result)); SDEBUG("SEND " << cmd.toString()); //<< " " << QString::number(result));
} }