forked from qt-creator/qt-creator
debugger: refactoring of output channeling
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#include "cdbcom.h"
|
||||
#include "debuggerrunner.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
@@ -47,20 +49,16 @@ static int logChannel(ULONG mask)
|
||||
return LogWarning;
|
||||
if (mask & (DEBUG_OUTPUT_ERROR))
|
||||
return LogError;
|
||||
return LogMisc;
|
||||
}
|
||||
|
||||
enum OutputKind { DebuggerOutput, DebuggerPromptOutput, DebuggeeOutput, DebuggeePromptOutput };
|
||||
|
||||
static inline OutputKind outputKind(ULONG mask)
|
||||
{
|
||||
if (mask & DEBUG_OUTPUT_DEBUGGEE)
|
||||
return DebuggeeOutput;
|
||||
//return DebuggeeOutput;
|
||||
return AppOut;
|
||||
if (mask & DEBUG_OUTPUT_DEBUGGEE_PROMPT)
|
||||
return DebuggeePromptOutput;
|
||||
//return DebuggeePromptOutput;
|
||||
return AppErr;
|
||||
if (mask & DEBUG_OUTPUT_PROMPT)
|
||||
return DebuggerPromptOutput;
|
||||
return DebuggerOutput;
|
||||
//return DebuggerPromptOutput;
|
||||
return AppErr;
|
||||
return LogMisc;
|
||||
}
|
||||
|
||||
CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine)
|
||||
@@ -71,24 +69,10 @@ CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine)
|
||||
void CdbDebugOutput::output(ULONG mask, const QString &msg)
|
||||
{
|
||||
DebuggerRunControl *runControl = m_engine->runControl();
|
||||
QTC_ASSER(runControl, return);
|
||||
QTC_ASSERT(runControl, return);
|
||||
if (debugCDB > 1)
|
||||
qDebug() << Q_FUNC_INFO << "\n " << msg;
|
||||
|
||||
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;
|
||||
}
|
||||
runControl->showMessage(msg, logChannel(mask));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -37,6 +37,8 @@
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class CdbDebugEngine;
|
||||
|
||||
// Standard CDB output handler
|
||||
class CdbDebugOutput : public CdbCore::DebugOutputBase
|
||||
{
|
||||
|
@@ -263,7 +263,7 @@ void DisassemblerViewAgent::setFrame(const StackFrame &frame, bool tryMixed)
|
||||
.arg(frame.function).arg(frame.file);
|
||||
QTC_ASSERT(d->manager->runControl(), /**/);
|
||||
if (d->manager->runControl())
|
||||
d->manager->runControl()->showDebuggerOutput(msg);
|
||||
d->manager->runControl()->showMessage(msg);
|
||||
setContents(*it);
|
||||
return;
|
||||
}
|
||||
|
@@ -139,13 +139,17 @@ enum DebuggerCapabilities
|
||||
enum LogChannel
|
||||
{
|
||||
LogInput, // Used for user input
|
||||
LogMiscInput, // Used for misc stuff in the input pane
|
||||
LogOutput,
|
||||
LogWarning,
|
||||
LogError,
|
||||
LogStatus, // Used for status changed messages
|
||||
LogTime, // Used for time stamp messages
|
||||
LogDebug,
|
||||
LogMisc
|
||||
LogMisc,
|
||||
AppOutput,
|
||||
AppError,
|
||||
StatusBar // LogStatus and also put to the status bar
|
||||
};
|
||||
|
||||
} // namespace Debugger
|
||||
|
@@ -107,7 +107,7 @@
|
||||
// use Q_FUNC_INFO?
|
||||
# define STATE_DEBUG(s) \
|
||||
do { QString msg; QTextStream ts(&msg); ts << s; \
|
||||
showDebuggerOutput(msg, LogDebug); } while (0)
|
||||
showMessage(msg, LogDebug); } while (0)
|
||||
#else
|
||||
# define STATE_DEBUG(s)
|
||||
#endif
|
||||
@@ -830,7 +830,7 @@ void DebuggerManager::clearStatusMessage()
|
||||
void DebuggerManager::showStatusMessage(const QString &msg0, int timeout)
|
||||
{
|
||||
Q_UNUSED(timeout)
|
||||
showDebuggerOutput(msg0, LogStatus);
|
||||
showMessage(msg0, LogStatus);
|
||||
QString msg = msg0;
|
||||
msg.replace(QLatin1Char('\n'), QString());
|
||||
d->m_statusLabel->setText(msg);
|
||||
@@ -1060,8 +1060,9 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
|
||||
ProjectExplorer::ToolChain::ToolChainType(sp->toolChainType));
|
||||
|
||||
d->m_plugin->activateDebugMode();
|
||||
showDebuggerOutput(tr("Starting debugger for tool chain '%1'...").arg(toolChainName), LogStatus);
|
||||
showDebuggerOutput(DebuggerSettings::instance()->dump(), LogDebug);
|
||||
showMessage(tr("Starting debugger for tool chain '%1'...").arg(toolChainName),
|
||||
LogStatus);
|
||||
showMessage(DebuggerSettings::instance()->dump(), LogDebug);
|
||||
|
||||
QString errorMessage;
|
||||
QString settingsIdHint;
|
||||
@@ -1571,10 +1572,10 @@ void DebuggerManager::modulesDockToggled(bool on)
|
||||
reloadModules();
|
||||
}
|
||||
|
||||
void DebuggerManager::showDebuggerOutput(const QString &msg, int channel)
|
||||
void DebuggerManager::showMessage(const QString &msg, int channel)
|
||||
{
|
||||
if (runControl())
|
||||
runControl()->showDebuggerOutput(msg, channel);
|
||||
runControl()->showMessage(msg, channel);
|
||||
else
|
||||
qDebug() << "OUTPUT: " << channel << msg;
|
||||
}
|
||||
@@ -1776,7 +1777,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
|
||||
if (!forced && !isAllowedTransition(d->m_state, state))
|
||||
qDebug() << "UNEXPECTED STATE TRANSITION: " << msg;
|
||||
|
||||
showDebuggerOutput(msg, LogDebug);
|
||||
showMessage(msg, LogDebug);
|
||||
|
||||
//resetLocation();
|
||||
if (state == d->m_state)
|
||||
@@ -2015,10 +2016,12 @@ DebuggerOutputWindow *DebuggerManager::debuggerOutputWindow() const
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
void IDebuggerEngine::showStatusMessage(const QString &msg, int timeout)
|
||||
{
|
||||
m_manager->showStatusMessage(msg, timeout);
|
||||
}
|
||||
*/
|
||||
|
||||
DebuggerState IDebuggerEngine::state() const
|
||||
{
|
||||
|
@@ -315,7 +315,7 @@ signals:
|
||||
private:
|
||||
void init();
|
||||
// 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);
|
||||
|
||||
void aboutToShutdown();
|
||||
|
@@ -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)
|
||||
@@ -206,19 +231,6 @@ void DebuggerRunControl::slotMessageAvailable(const QString &data, bool 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()
|
||||
{
|
||||
|
@@ -130,11 +130,7 @@ signals:
|
||||
void stopRequested();
|
||||
|
||||
public slots:
|
||||
void showDebuggerOutput(const QString &msg)
|
||||
{ showDebuggerOutput(msg, LogDebug); }
|
||||
void showApplicationOutput(const QString &output, bool onStdErr);
|
||||
void showDebuggerOutput(const QString &output, int channel);
|
||||
void showDebuggerInput(const QString &input, int channel);
|
||||
void showMessage(const QString &output, int channel = LogDebug, int timeout = -1);
|
||||
|
||||
private slots:
|
||||
void slotMessageAvailable(const QString &data, bool isError);
|
||||
|
@@ -109,10 +109,8 @@ protected:
|
||||
{ return m_engine->startParameters(); }
|
||||
DebuggerRunControl *runControl() const
|
||||
{ return m_engine->runControl(); }
|
||||
void debugMessage(const QString &msg) const
|
||||
{ m_engine->debugMessage(msg); }
|
||||
void showStatusMessage(const QString &msg) const
|
||||
{ m_engine->showStatusMessage(msg); }
|
||||
void showMessage(const QString &msg, int channel = LogDebug, int timeout = 1)
|
||||
{ runControl()->showMessage(msg, channel, timeout); }
|
||||
void showMessageBox(int icon, const QString &title, const QString &text) const
|
||||
{ m_engine->showMessageBox(icon, title, text); }
|
||||
|
||||
|
@@ -91,8 +91,8 @@ void AbstractPlainGdbAdapter::handleExecRun(const GdbResponse &response)
|
||||
{
|
||||
if (response.resultClass == GdbResultRunning) {
|
||||
QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
|
||||
debugMessage(_("INFERIOR STARTED"));
|
||||
showStatusMessage(msgInferiorStarted());
|
||||
showMessage(_("INFERIOR STARTED"));
|
||||
showMessage(msgInferiorStarted(), StatusBar);
|
||||
// FIXME: That's the wrong place for it.
|
||||
if (theDebuggerBoolSetting(EnableReverseDebugging))
|
||||
m_engine->postCommand("target record");
|
||||
|
@@ -58,7 +58,7 @@ void AttachGdbAdapter::startAdapter()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
setState(AdapterStarting);
|
||||
debugMessage(_("TRYING TO START ADAPTER"));
|
||||
showMessage(_("TRYING TO START ADAPTER"));
|
||||
|
||||
if (!m_engine->startGdb())
|
||||
return;
|
||||
@@ -80,8 +80,8 @@ void AttachGdbAdapter::handleAttach(const GdbResponse &response)
|
||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
setState(InferiorStopped);
|
||||
debugMessage(_("INFERIOR ATTACHED"));
|
||||
showStatusMessage(msgAttachedToStoppedInferior());
|
||||
showMessage(_("INFERIOR ATTACHED"));
|
||||
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
||||
emit inferiorPrepared();
|
||||
m_engine->updateAll();
|
||||
} else {
|
||||
@@ -95,7 +95,7 @@ void AttachGdbAdapter::interruptInferior()
|
||||
const qint64 pid = startParameters().attachPID;
|
||||
QTC_ASSERT(pid > 0, return);
|
||||
if (!interruptProcess(pid))
|
||||
debugMessage(_("CANNOT INTERRUPT %1").arg(pid));
|
||||
showMessage(_("CANNOT INTERRUPT %1").arg(pid));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -160,8 +160,8 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
|
||||
// Avoid endless loops created by faulty dumpers.
|
||||
QByteArray processedName = QByteArray::number(dumpChildren) + '-' + data.iname;
|
||||
if (m_processedNames.contains(processedName)) {
|
||||
showDebuggerInput(
|
||||
_("<Breaking endless loop for " + data.iname + '>'), LogStatus);
|
||||
showMessage(
|
||||
_("<Breaking endless loop for " + data.iname + '>'), LogMiscInput);
|
||||
data.setAllUnneeded();
|
||||
data.setValue(_("<unavailable>"));
|
||||
data.setHasChildren(false);
|
||||
@@ -395,7 +395,7 @@ void GdbEngine::handleDebuggingHelperValue2Classic(const GdbResponse &response)
|
||||
// Remove traces of the question, too.
|
||||
if (m_cookieForToken.contains(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;
|
||||
data.setError(WatchData::msgNotInScope());
|
||||
insertData(data);
|
||||
@@ -591,12 +591,12 @@ void GdbEngine::setDebugDebuggingHelpersClassic(const QVariant &on)
|
||||
{
|
||||
PRECONDITION;
|
||||
if (on.toBool()) {
|
||||
debugMessage(_("SWITCHING ON DUMPER DEBUGGING"));
|
||||
showMessage(_("SWITCHING ON DUMPER DEBUGGING"));
|
||||
postCommand("set unwindonsignal off");
|
||||
m_manager->breakByFunction(_("qDumpObjectData440"));
|
||||
//updateLocals();
|
||||
} else {
|
||||
debugMessage(_("SWITCHING OFF DUMPER DEBUGGING"));
|
||||
showMessage(_("SWITCHING OFF DUMPER DEBUGGING"));
|
||||
postCommand("set unwindonsignal on");
|
||||
}
|
||||
}
|
||||
@@ -641,7 +641,7 @@ void GdbEngine::handleStackListArgumentsClassic(const GdbResponse &response)
|
||||
} else {
|
||||
// Seems to occur on "RedHat 4 based Linux" gdb 7.0.1:
|
||||
// ^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 QString loc = locations.join(QLatin1String(", "));
|
||||
const QString msg = tr("The debugging helper library was not found at %1.").arg(loc);
|
||||
debugMessage(msg);
|
||||
showMessage(msg);
|
||||
manager()->showQtDumperLibraryWarning(msg);
|
||||
return false;
|
||||
}
|
||||
@@ -757,11 +757,11 @@ void GdbEngine::handleDebuggingHelperVersionCheckClassic(const GdbResponse &resp
|
||||
"application (%2).\nThis might yield incorrect results.")
|
||||
.arg(dumperQtVersion).arg(debuggeeQtVersion));
|
||||
} else {
|
||||
debugMessage(_("DUMPER VERSION CHECK SUCCESSFUL: ")
|
||||
showMessage(_("DUMPER VERSION CHECK SUCCESSFUL: ")
|
||||
+ dumperQtVersion);
|
||||
}
|
||||
} else {
|
||||
debugMessage("DUMPER VERSION CHECK NOT COMPLETED");
|
||||
showMessage("DUMPER VERSION CHECK NOT COMPLETED");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ void CoreGdbAdapter::startAdapter()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
setState(AdapterStarting);
|
||||
debugMessage(_("TRYING TO START ADAPTER"));
|
||||
showMessage(_("TRYING TO START ADAPTER"));
|
||||
|
||||
if (!m_engine->startGdb())
|
||||
return;
|
||||
@@ -106,7 +106,7 @@ void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
showStatusMessage(tr("Symbols found."));
|
||||
showMessage(tr("Symbols found."), StatusBar);
|
||||
} else {
|
||||
QString msg = tr("Loading symbols from \"%1\" failed:\n").arg(m_executable)
|
||||
+ QString::fromLocal8Bit(response.data.findChild("msg").data());
|
||||
@@ -144,7 +144,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
|
||||
.absoluteFilePath(m_executable);
|
||||
if (QFile::exists(m_executable)) {
|
||||
// Finish extra round ...
|
||||
showStatusMessage(tr("Attached to core temporarily."));
|
||||
showMessage(tr("Attached to core temporarily."), StatusBar);
|
||||
m_engine->postCommand("detach");
|
||||
// ... and retry.
|
||||
loadExeAndSyms();
|
||||
@@ -156,7 +156,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
|
||||
tr("Unable to determine executable from core file."));
|
||||
}
|
||||
#endif
|
||||
showStatusMessage(tr("Attached to core."));
|
||||
showMessage(tr("Attached to core."), StatusBar);
|
||||
setState(InferiorUnrunnable);
|
||||
m_engine->updateAll();
|
||||
} else {
|
||||
|
@@ -341,18 +341,13 @@ void GdbEngine::readDebugeeOutput(const QByteArray &data)
|
||||
data.constData(), data.length(), &m_outputCodecState), true);
|
||||
}
|
||||
|
||||
void GdbEngine::debugMessage(const QString &msg)
|
||||
{
|
||||
showDebuggerOutput(msg, LogDebug);
|
||||
}
|
||||
|
||||
void GdbEngine::handleResponse(const QByteArray &buff)
|
||||
{
|
||||
static QTime lastTime;
|
||||
|
||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||
showDebuggerOutput(currentTime(), LogTime);
|
||||
showDebuggerOutput(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
||||
showMessage(currentTime(), LogTime);
|
||||
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
||||
|
||||
#if 0
|
||||
qDebug() // << "#### start response handling #### "
|
||||
@@ -624,7 +619,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
||||
void GdbEngine::readGdbStandardError()
|
||||
{
|
||||
QByteArray err = gdbProc()->readAllStandardError();
|
||||
debugMessage(_("UNEXPECTED GDB STDERR: " + err));
|
||||
showMessage(_("UNEXPECTED GDB STDERR: " + err));
|
||||
if (err == "Undefined command: \"bb\". Try \"help\".\n")
|
||||
return;
|
||||
if (err.startsWith("BFD: reopening"))
|
||||
@@ -678,7 +673,7 @@ void GdbEngine::interruptInferior()
|
||||
setState(InferiorStopping);
|
||||
showStatusMessage(tr("Stop requested..."), 5000);
|
||||
|
||||
debugMessage(_("TRYING TO INTERRUPT INFERIOR"));
|
||||
showMessage(_("TRYING TO INTERRUPT INFERIOR"));
|
||||
m_gdbAdapter->interruptInferior();
|
||||
}
|
||||
|
||||
@@ -696,12 +691,12 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0)
|
||||
{
|
||||
const qint64 pid = pid0.toLongLong();
|
||||
if (pid == 0) {
|
||||
debugMessage(_("Cannot parse PID from %1").arg(pid0));
|
||||
showMessage(_("Cannot parse PID from %1").arg(pid0));
|
||||
return;
|
||||
}
|
||||
if (pid == inferiorPid())
|
||||
return;
|
||||
debugMessage(_("FOUND PID %1").arg(pid));
|
||||
showMessage(_("FOUND PID %1").arg(pid));
|
||||
|
||||
handleInferiorPidChanged(pid);
|
||||
}
|
||||
@@ -748,7 +743,7 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
|
||||
{
|
||||
if (!stateAcceptsGdbCommands(state())) {
|
||||
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()));
|
||||
return;
|
||||
}
|
||||
@@ -779,24 +774,24 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
|
||||
flushCommand(cmd);
|
||||
} else {
|
||||
// Queue the commands that we cannot send at once.
|
||||
debugMessage(_("QUEUING COMMAND " + cmd.command));
|
||||
showMessage(_("QUEUING COMMAND " + cmd.command));
|
||||
m_commandsToRunOnTemporaryBreak.append(cmd);
|
||||
if (state() == InferiorStopping) {
|
||||
if (cmd.flags & LosesChild)
|
||||
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
|
||||
// NeedsStop commands are issued in quick succession.
|
||||
} else if (state() == InferiorStopping_Kill) {
|
||||
debugMessage(_("CHILD ALREADY BEING INTERRUPTED (KILL PENDING)"));
|
||||
showMessage(_("CHILD ALREADY BEING INTERRUPTED (KILL PENDING)"));
|
||||
// FIXME
|
||||
shutdown();
|
||||
} else if (state() == InferiorRunningRequested) {
|
||||
if (cmd.flags & LosesChild)
|
||||
setState(InferiorRunningRequested_Kill);
|
||||
debugMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT"));
|
||||
showMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT"));
|
||||
} else if (state() == InferiorRunningRequested_Kill) {
|
||||
debugMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT (KILL PENDING)"));
|
||||
showMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT (KILL PENDING)"));
|
||||
} else if (state() == InferiorRunning) {
|
||||
showStatusMessage(tr("Stopping temporarily"), 1000);
|
||||
interruptInferiorTemporarily();
|
||||
@@ -814,7 +809,7 @@ void GdbEngine::flushQueuedCommands()
|
||||
showStatusMessage(tr("Processing queued commands"), 1000);
|
||||
while (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
|
||||
GdbCommand cmd = m_commandsToRunOnTemporaryBreak.takeFirst();
|
||||
debugMessage(_("RUNNING QUEUED COMMAND " + cmd.command + ' '
|
||||
showMessage(_("RUNNING QUEUED COMMAND " + cmd.command + ' '
|
||||
+ cmd.callbackName));
|
||||
flushCommand(cmd);
|
||||
}
|
||||
@@ -824,8 +819,8 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
|
||||
{
|
||||
GdbCommand cmd = cmd0;
|
||||
if (state() == DebuggerNotReady) {
|
||||
showDebuggerInput(_(cmd.command), LogInput);
|
||||
debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: " + cmd.command));
|
||||
showMessage(_(cmd.command), LogInput);
|
||||
showMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: " + cmd.command));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -833,7 +828,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
|
||||
cmd.postTime = QTime::currentTime();
|
||||
m_cookieForToken[currentToken()] = cmd;
|
||||
cmd.command = QByteArray::number(currentToken()) + cmd.command;
|
||||
showDebuggerInput(_(cmd.command), LogInput);
|
||||
showMessage(_(cmd.command), LogInput);
|
||||
|
||||
m_gdbAdapter->write(cmd.command + "\r\n");
|
||||
|
||||
@@ -862,10 +857,10 @@ void GdbEngine::commandTimeout()
|
||||
msg += ": " + cmd.command + " => ";
|
||||
QTC_ASSERT(cmd.callbackName, /**/);
|
||||
msg += cmd.callbackName;
|
||||
debugMessage(_(msg));
|
||||
showMessage(_(msg));
|
||||
}
|
||||
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();
|
||||
//m_commandTimer->stop();
|
||||
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::Ok)->setText(tr("Stop debugging"));
|
||||
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.
|
||||
manager()->watchHandler()->endCycle();
|
||||
gdbProc()->kill();
|
||||
} else {
|
||||
debugMessage(_("CONTINUE DEBUGGER AS REQUESTED BY USER"));
|
||||
showMessage(_("CONTINUE DEBUGGER AS REQUESTED BY USER"));
|
||||
}
|
||||
} 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
|
||||
// does. We try to handle a few situations we are aware of gracefully.
|
||||
// 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));
|
||||
if (response->resultClass == GdbResultError) {
|
||||
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
|
||||
// with helpers enabled. In this case we get a second response with
|
||||
// msg="Cannot find new threads: generic error"
|
||||
debugMessage(_("APPLYING WORKAROUND #1"));
|
||||
showMessage(_("APPLYING WORKAROUND #1"));
|
||||
showMessageBox(QMessageBox::Critical,
|
||||
tr("Executable failed"), QString::fromLocal8Bit(msg));
|
||||
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.") {
|
||||
// Handle a case known to appear on gdb 6.4 symbianelf when
|
||||
// the stack is cut due to access to protected memory.
|
||||
debugMessage(_("APPLYING WORKAROUND #2"));
|
||||
showMessage(_("APPLYING WORKAROUND #2"));
|
||||
setState(InferiorStopping);
|
||||
setState(InferiorStopped);
|
||||
} else if (msg.startsWith("Cannot find bounds of current function")) {
|
||||
// Happens when running "-exec-next" in a function for which
|
||||
// there is no debug information. Divert to "-exec-next-step"
|
||||
debugMessage(_("APPLYING WORKAROUND #3"));
|
||||
showMessage(_("APPLYING WORKAROUND #3"));
|
||||
setState(InferiorStopping);
|
||||
setState(InferiorStopped);
|
||||
executeNextI();
|
||||
@@ -936,7 +931,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
||||
// Happens on archer-tromey-python 6.8.50.20090910-cvs
|
||||
// There might to be a race between a process shutting down
|
||||
// and library load messages.
|
||||
debugMessage(_("APPLYING WORKAROUND #4"));
|
||||
showMessage(_("APPLYING WORKAROUND #4"));
|
||||
setState(InferiorStopping);
|
||||
setState(InferiorStopped);
|
||||
setState(InferiorShuttingDown);
|
||||
@@ -958,14 +953,14 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
||||
|
||||
GdbCommand cmd = m_cookieForToken.take(token);
|
||||
if (theDebuggerBoolSetting(LogTimeStamps)) {
|
||||
showDebuggerOutput(_("Response time: %1: %2 s")
|
||||
showMessage(_("Response time: %1: %2 s")
|
||||
.arg(_(cmd.command))
|
||||
.arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.),
|
||||
LogTime);
|
||||
}
|
||||
|
||||
if (response->token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
|
||||
//debugMessage(_("### SKIPPING OLD RESULT") + response.toString());
|
||||
//showMessage(_("### SKIPPING OLD RESULT") + response.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -986,7 +981,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
||||
QByteArray rsp = GdbResponse::stringFromResultClass(response->resultClass);
|
||||
rsp = "UNEXPECTED RESPONSE '" + rsp + "' TO COMMAND '" + cmd.command + "'";
|
||||
qWarning() << rsp << " AT " __FILE__ ":" STRINGIFY(__LINE__);
|
||||
debugMessage(_(rsp));
|
||||
showMessage(_(rsp));
|
||||
}
|
||||
} else {
|
||||
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
|
||||
// that behavior.
|
||||
if (m_commandsDoneCallback && m_cookieForToken.isEmpty()) {
|
||||
debugMessage(_("ALL COMMANDS DONE; INVOKING CALLBACK"));
|
||||
showMessage(_("ALL COMMANDS DONE; INVOKING CALLBACK"));
|
||||
CommandsDoneCallback cont = m_commandsDoneCallback;
|
||||
m_commandsDoneCallback = 0;
|
||||
(this->*cont)();
|
||||
@@ -1046,7 +1041,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
||||
void GdbEngine::executeDebuggerCommand(const QString &command)
|
||||
{
|
||||
if (state() == DebuggerNotReady) {
|
||||
debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
|
||||
showMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1256,9 +1251,9 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
||||
// The related code (handleAqcuiredInferior()) is disabled as well.
|
||||
if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) {
|
||||
QString dataStr = _(data.toString());
|
||||
debugMessage(_("SHARED LIBRARY EVENT: ") + dataStr);
|
||||
showMessage(_("SHARED LIBRARY EVENT: ") + dataStr);
|
||||
QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern);
|
||||
debugMessage(_("PATTERN: ") + pat);
|
||||
showMessage(_("PATTERN: ") + pat);
|
||||
postCommand("sharedlibrary " + pat.toLocal8Bit());
|
||||
showStatusMessage(tr("Loading %1...").arg(dataStr));
|
||||
}
|
||||
@@ -1314,17 +1309,17 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
||||
if (theDebuggerBoolSetting(SkipKnownFrames)) {
|
||||
if (reason == "end-stepping-range" || reason == "function-finished") {
|
||||
GdbMi frame = data.findChild("frame");
|
||||
//debugMessage(frame.toString());
|
||||
//showMessage(frame.toString());
|
||||
QString funcName = _(frame.findChild("func").data());
|
||||
QString fileName = QString::fromLocal8Bit(frame.findChild("file").data());
|
||||
if (isLeavableFunction(funcName, fileName)) {
|
||||
//debugMessage(_("LEAVING ") + funcName);
|
||||
//showMessage(_("LEAVING ") + funcName);
|
||||
++stepCounter;
|
||||
m_manager->executeStepOut();
|
||||
return;
|
||||
}
|
||||
if (isSkippableFunction(funcName, fileName)) {
|
||||
//debugMessage(_("SKIPPING ") + funcName);
|
||||
//showMessage(_("SKIPPING ") + funcName);
|
||||
++stepCounter;
|
||||
m_manager->executeStep();
|
||||
return;
|
||||
@@ -1386,7 +1381,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
|
||||
&& reason == "signal-received"
|
||||
&& data.findChild("signal-name").data() == "SIGTRAP") {
|
||||
// Caused by "library load" message.
|
||||
debugMessage(_("INTERNAL CONTINUE"));
|
||||
showMessage(_("INTERNAL CONTINUE"));
|
||||
continueInferiorInternal();
|
||||
return;
|
||||
}
|
||||
@@ -1507,7 +1502,7 @@ void GdbEngine::handleInfoProc(const GdbResponse &response)
|
||||
|
||||
void GdbEngine::handleShowVersion(const GdbResponse &response)
|
||||
{
|
||||
debugMessage(_("PARSING VERSION: " + response.toString()));
|
||||
showMessage(_("PARSING VERSION: " + response.toString()));
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
m_gdbVersion = 100;
|
||||
m_gdbBuildVersion = -1;
|
||||
@@ -1517,11 +1512,11 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
|
||||
extractGdbVersion(msg,
|
||||
&m_gdbVersion, &m_gdbBuildVersion, &m_isMacGdb);
|
||||
if (m_gdbVersion > 60500 && m_gdbVersion < 200000)
|
||||
debugMessage(_("SUPPORTED GDB VERSION ") + msg);
|
||||
showMessage(_("SUPPORTED GDB VERSION ") + msg);
|
||||
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)" : "")));
|
||||
}
|
||||
}
|
||||
@@ -1601,7 +1596,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
|
||||
|
||||
void GdbEngine::shutdown()
|
||||
{
|
||||
debugMessage(_("INITIATE GDBENGINE SHUTDOWN"));
|
||||
showMessage(_("INITIATE GDBENGINE SHUTDOWN"));
|
||||
if (m_progress) {
|
||||
m_progress->setProgressValue(90);
|
||||
m_progress->reportCanceled();
|
||||
@@ -1658,18 +1653,18 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorShuttingDown, qDebug() << state());
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||
showMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||
setState(InferiorShutDown);
|
||||
} else {
|
||||
QByteArray ba = response.data.findChild("msg").data();
|
||||
if (ba.contains(": No such file or directory.")) {
|
||||
// This happens when someone removed the binary behind our back.
|
||||
// It is not really an error from a user's point of view.
|
||||
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||
debugMessage(_("NOTE: " + ba));
|
||||
showMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||
showMessage(_("NOTE: " + ba));
|
||||
setState(InferiorShutDown);
|
||||
} else {
|
||||
debugMessage(_("INFERIOR SHUTDOWN FAILED"));
|
||||
showMessage(_("INFERIOR SHUTDOWN FAILED"));
|
||||
setState(InferiorShutdownFailed);
|
||||
showMessageBox(QMessageBox::Critical,
|
||||
tr("Failed to shut down application"),
|
||||
@@ -1682,13 +1677,13 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
|
||||
void GdbEngine::handleGdbExit(const GdbResponse &response)
|
||||
{
|
||||
if (response.resultClass == GdbResultExit) {
|
||||
debugMessage(_("GDB CLAIMS EXIT; WAITING"));
|
||||
showMessage(_("GDB CLAIMS EXIT; WAITING"));
|
||||
m_commandsDoneCallback = 0;
|
||||
// Don't set state here, this will be handled in handleGdbFinished()
|
||||
} else {
|
||||
QString msg = m_gdbAdapter->msgGdbStopFailed(
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -2050,9 +2045,9 @@ void GdbEngine::setTokenBarrier()
|
||||
);
|
||||
}
|
||||
PENDING_DEBUG("\n--- token barrier ---\n");
|
||||
showDebuggerInput(_("--- token barrier ---"), LogMisc);
|
||||
showMessage(_("--- token barrier ---"), LogMiscInput);
|
||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||
showDebuggerInput(currentTime(), LogMisc);
|
||||
showMessage(currentTime(), LogMiscInput);
|
||||
m_oldestAcceptableToken = currentToken();
|
||||
}
|
||||
|
||||
@@ -2209,7 +2204,7 @@ void GdbEngine::handleWatchInsert(const GdbResponse &response)
|
||||
data->bpNumber = ba.mid(20, pos - 20);
|
||||
manager()->breakHandler()->updateMarkers();
|
||||
} 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();
|
||||
} else {
|
||||
//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,
|
||||
qDebug() << "SOURCES LIST CURRENTLY UPDATING"; return);
|
||||
debugMessage(_("ATTEMPT BREAKPOINT SYNC"));
|
||||
showMessage(_("ATTEMPT BREAKPOINT SYNC"));
|
||||
|
||||
switch (state()) {
|
||||
case InferiorStarting:
|
||||
@@ -2477,7 +2472,7 @@ void GdbEngine::attemptBreakpointSynchronization()
|
||||
break;
|
||||
default:
|
||||
//qDebug() << "attempted breakpoint sync in state" << state();
|
||||
debugMessage(_("... NOT POSSIBLE IN CURRENT STATE"));
|
||||
showMessage(_("... NOT POSSIBLE IN CURRENT STATE"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2534,12 +2529,12 @@ void GdbEngine::attemptBreakpointSynchronization()
|
||||
foreach (BreakpointData *data, handler->takeRemovedBreakpoints()) {
|
||||
QByteArray bpNumber = data->bpNumber;
|
||||
if (!bpNumber.trimmed().isEmpty()) {
|
||||
debugMessage(_("DELETING BP " + bpNumber + " IN "
|
||||
showMessage(_("DELETING BP " + bpNumber + " IN "
|
||||
+ data->markerFileName().toLocal8Bit()));
|
||||
postCommand("-break-delete " + bpNumber,
|
||||
NeedsStop | RebuildBreakpointModel);
|
||||
} else {
|
||||
debugMessage(_("QUIETLY REMOVING UNNUMBERED BREAKPOINT"));
|
||||
showMessage(_("QUIETLY REMOVING UNNUMBERED BREAKPOINT"));
|
||||
}
|
||||
delete data;
|
||||
}
|
||||
@@ -3058,7 +3053,7 @@ void GdbEngine::activateSnapshot(int index)
|
||||
"snapshot?"), QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (mb->exec() == QMessageBox::Cancel)
|
||||
return;
|
||||
debugMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
|
||||
showMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
|
||||
delete m_gdbAdapter;
|
||||
m_gdbAdapter = createAdapter();
|
||||
postCommand("kill", NeedsStop, CB(handleActivateSnapshot));
|
||||
@@ -3376,8 +3371,8 @@ void GdbEngine::updateWatchData(const WatchData &data)
|
||||
//qDebug() << "PROCESSED NAMES: " << processedName << m_processedNames;
|
||||
if (m_processedNames.contains(processedName)) {
|
||||
WatchData data1 = data;
|
||||
showDebuggerInput(_("<Breaking endless loop for " + data.iname + '>'),
|
||||
LogStatus);
|
||||
showMessage(_("<Breaking endless loop for " + data.iname + '>'),
|
||||
LogMiscInput);
|
||||
data1.setAllUnneeded();
|
||||
data1.setValue(_("<unavailable>"));
|
||||
data1.setHasChildren(false);
|
||||
@@ -3428,8 +3423,8 @@ void GdbEngine::rebuildWatchModel()
|
||||
m_processedNames.clear();
|
||||
PENDING_DEBUG("REBUILDING MODEL" << count);
|
||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||
showDebuggerInput(currentTime(), LogMisc);
|
||||
showDebuggerInput(_("<Rebuild Watchmodel %1>").arg(count), LogStatus);
|
||||
showMessage(currentTime(), LogMiscInput);
|
||||
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
|
||||
showStatusMessage(tr("Finished retrieving data"), 400);
|
||||
manager()->watchHandler()->endCycle();
|
||||
showToolTip();
|
||||
@@ -3457,7 +3452,7 @@ void GdbEngine::sendWatchParameters(const QByteArray ¶ms0)
|
||||
const QByteArray inBufferCmd = arrayFillCommand("qDumpInBuffer", params);
|
||||
|
||||
params.replace('\0','!');
|
||||
showDebuggerInput(QString::fromUtf8(params), LogMisc);
|
||||
showMessage(QString::fromUtf8(params), LogMiscInput);
|
||||
|
||||
params.clear();
|
||||
params.append('\0');
|
||||
@@ -3903,7 +3898,7 @@ void GdbEngine::handleFetchDisassemblerByAddress1(const GdbResponse &response)
|
||||
if (ac.agent->contentsCoversAddress(contents)) {
|
||||
ac.agent->setContents(parseDisassembler(lines));
|
||||
} else {
|
||||
debugMessage(_("FALL BACK TO NON-MIXED"));
|
||||
showMessage(_("FALL BACK TO NON-MIXED"));
|
||||
fetchDisassemblerByAddress(ac, false);
|
||||
}
|
||||
}
|
||||
@@ -4015,7 +4010,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
|
||||
GdbOptionsPage::settingsId());
|
||||
return false;
|
||||
}
|
||||
debugMessage(_("STARTING GDB ") + m_gdb);
|
||||
showMessage(_("STARTING GDB ") + m_gdb);
|
||||
QStringList gdbArgs;
|
||||
gdbArgs << _("-i");
|
||||
gdbArgs << _("mi");
|
||||
@@ -4034,20 +4029,20 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
|
||||
// Check for existing values.
|
||||
if (environment.contains(pythonPathVariable)) {
|
||||
const QString oldPythonPath = environment.value(pythonPathVariable);
|
||||
showDebuggerOutput(_("Using existing python path: %1")
|
||||
showMessage(_("Using existing python path: %1")
|
||||
.arg(oldPythonPath), LogMisc);
|
||||
} else {
|
||||
const QString pythonPath =
|
||||
QDir::toNativeSeparators(dir.absoluteFilePath(winPythonVersion));
|
||||
environment.insert(pythonPathVariable, pythonPath);
|
||||
showDebuggerOutput(_("Python path: %1").arg(pythonPath), LogMisc);
|
||||
showMessage(_("Python path: %1").arg(pythonPath), LogMisc);
|
||||
gdbProc()->setProcessEnvironment(environment);
|
||||
}
|
||||
foundPython = true;
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
#endif
|
||||
@@ -4073,7 +4068,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
|
||||
const QByteArray dumperSourcePath =
|
||||
Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/";
|
||||
|
||||
debugMessage(_("GDB STARTED, INITIALIZING IT"));
|
||||
showMessage(_("GDB STARTED, INITIALIZING IT"));
|
||||
m_commandTimer->setInterval(commandTimeoutTime());
|
||||
|
||||
postCommand("show version", CB(handleShowVersion));
|
||||
@@ -4178,7 +4173,7 @@ bool GdbEngine::checkDebuggingHelpers()
|
||||
|
||||
void GdbEngine::handleGdbError(QProcess::ProcessError error)
|
||||
{
|
||||
debugMessage(_("HANDLE GDB ERROR"));
|
||||
showMessage(_("HANDLE GDB ERROR"));
|
||||
switch (error) {
|
||||
case QProcess::Crashed:
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
debugMessage(_("NO ADAPTER PRESENT"));
|
||||
showMessage(_("NO ADAPTER PRESENT"));
|
||||
} else if (state() == EngineShuttingDown) {
|
||||
debugMessage(_("GOING TO SHUT DOWN ADAPTER"));
|
||||
showMessage(_("GOING TO SHUT DOWN ADAPTER"));
|
||||
m_gdbAdapter->shutdown();
|
||||
} else if (state() != AdapterStartFailed) {
|
||||
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)
|
||||
{
|
||||
setState(AdapterStartFailed);
|
||||
debugMessage(_("ADAPTER START FAILED"));
|
||||
showMessage(_("ADAPTER START FAILED"));
|
||||
if (!msg.isEmpty()) {
|
||||
const QString title = tr("Adapter start failed");
|
||||
if (settingsIdHint.isEmpty()) {
|
||||
@@ -4236,7 +4231,7 @@ void GdbEngine::handleAdapterStarted()
|
||||
setState(AdapterStarted);
|
||||
if (m_progress)
|
||||
m_progress->setProgressValue(25);
|
||||
debugMessage(_("ADAPTER SUCCESSFULLY STARTED"));
|
||||
showMessage(_("ADAPTER SUCCESSFULLY STARTED"));
|
||||
|
||||
showStatusMessage(tr("Starting inferior..."));
|
||||
setState(InferiorStarting);
|
||||
@@ -4261,7 +4256,7 @@ void GdbEngine::handleInferiorPrepared()
|
||||
|
||||
// Initial attempt to set breakpoints
|
||||
showStatusMessage(tr("Setting breakpoints..."));
|
||||
debugMessage(tr("Setting breakpoints..."));
|
||||
showMessage(tr("Setting breakpoints..."));
|
||||
attemptBreakpointSynchronization();
|
||||
|
||||
if (m_cookieForToken.isEmpty()) {
|
||||
@@ -4274,7 +4269,7 @@ void GdbEngine::handleInferiorPrepared()
|
||||
|
||||
void GdbEngine::startInferiorPhase2()
|
||||
{
|
||||
debugMessage(_("BREAKPOINTS SET, CONTINUING INFERIOR STARTUP"));
|
||||
showMessage(_("BREAKPOINTS SET, CONTINUING INFERIOR STARTUP"));
|
||||
m_gdbAdapter->startInferiorPhase2();
|
||||
}
|
||||
|
||||
@@ -4282,10 +4277,10 @@ void GdbEngine::handleInferiorStartFailed(const QString &msg)
|
||||
{
|
||||
showStatusMessage(tr("Failed to start application: ") + msg);
|
||||
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.
|
||||
}
|
||||
debugMessage(_("INFERIOR START FAILED"));
|
||||
showMessage(_("INFERIOR START FAILED"));
|
||||
showMessageBox(QMessageBox::Critical, tr("Failed to start application"), msg);
|
||||
setState(InferiorStartFailed);
|
||||
shutdown();
|
||||
@@ -4293,7 +4288,7 @@ void GdbEngine::handleInferiorStartFailed(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,
|
||||
// so the effect is about the same as AdapterStartFailed => use it.
|
||||
|
@@ -527,7 +527,6 @@ private: ////////// Convenience Functions //////////
|
||||
QString errorMessage(QProcess::ProcessError error);
|
||||
QMessageBox *showMessageBox(int icon, const QString &title, const QString &text,
|
||||
int buttons = 0);
|
||||
void debugMessage(const QString &msg);
|
||||
QMainWindow *mainWindow() const;
|
||||
AbstractGdbProcess *gdbProc() const;
|
||||
|
||||
|
@@ -70,7 +70,7 @@ void LocalPlainGdbAdapter::startAdapter()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
setState(AdapterStarting);
|
||||
debugMessage(_("TRYING TO START ADAPTER"));
|
||||
showMessage(_("TRYING TO START ADAPTER"));
|
||||
|
||||
QStringList gdbArgs;
|
||||
|
||||
@@ -125,17 +125,17 @@ void LocalPlainGdbAdapter::interruptInferior()
|
||||
{
|
||||
const qint64 attachedPID = m_engine->inferiorPid();
|
||||
if (attachedPID <= 0) {
|
||||
debugMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED"));
|
||||
showMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!interruptProcess(attachedPID))
|
||||
debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
|
||||
showMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
|
||||
}
|
||||
|
||||
void LocalPlainGdbAdapter::shutdown()
|
||||
{
|
||||
debugMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state()));
|
||||
showMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state()));
|
||||
m_outputCollector.shutdown();
|
||||
}
|
||||
|
||||
|
@@ -120,7 +120,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
|
||||
//qDebug() << "SECOND CHUNK: " << out;
|
||||
int pos = out.indexOf("data=");
|
||||
if (pos != 0) {
|
||||
debugMessage(_("DISCARDING JUNK AT BEGIN OF RESPONSE: "
|
||||
showMessage(_("DISCARDING JUNK AT BEGIN OF RESPONSE: "
|
||||
+ out.left(pos)));
|
||||
out = out.mid(pos);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
|
||||
rebuildWatchModel();
|
||||
}
|
||||
} else {
|
||||
debugMessage(_("DUMPER FAILED: " + response.toString()));
|
||||
showMessage(_("DUMPER FAILED: " + response.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -86,13 +86,13 @@ void RemoteGdbServerAdapter::startAdapter()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
setState(AdapterStarting);
|
||||
debugMessage(_("TRYING TO START ADAPTER"));
|
||||
showMessage(_("TRYING TO START ADAPTER"));
|
||||
|
||||
// FIXME: make asynchroneous
|
||||
// Start the remote server
|
||||
if (startParameters().serverStartScript.isEmpty()) {
|
||||
m_engine->showStatusMessage(_("No server start script given. "
|
||||
"Assuming server runs already."));
|
||||
showMessage(_("No server start script given. "
|
||||
"Assuming server runs already."), StatusBar);
|
||||
} else {
|
||||
m_uploadProc.start(_("/bin/sh ") + startParameters().serverStartScript);
|
||||
m_uploadProc.waitForStarted();
|
||||
@@ -135,20 +135,24 @@ void RemoteGdbServerAdapter::uploadProcError(QProcess::ProcessError error)
|
||||
"This is the default return value of error().");
|
||||
}
|
||||
|
||||
m_engine->showStatusMessage(msg);
|
||||
showMessage(msg, StatusBar);
|
||||
showMessageBox(QMessageBox::Critical, tr("Error"), msg);
|
||||
}
|
||||
|
||||
void RemoteGdbServerAdapter::readUploadStandardOutput()
|
||||
{
|
||||
QByteArray ba = m_uploadProc.readAllStandardOutput();
|
||||
runControl()->showDebuggerOutput(QString::fromLocal8Bit(ba, ba.length()), LogOutput);
|
||||
const QByteArray ba = m_uploadProc.readAllStandardOutput();
|
||||
const QString msg = QString::fromLocal8Bit(ba, ba.length());
|
||||
showMessage(msg, LogOutput);
|
||||
showMessage(msg, AppOutput);
|
||||
}
|
||||
|
||||
void RemoteGdbServerAdapter::readUploadStandardError()
|
||||
{
|
||||
QByteArray ba = m_uploadProc.readAllStandardError();
|
||||
runControl()->showDebuggerOutput(QString::fromLocal8Bit(ba, ba.length()), LogError);
|
||||
const QByteArray ba = m_uploadProc.readAllStandardError();
|
||||
const QString msg = QString::fromLocal8Bit(ba, ba.length());
|
||||
showMessage(msg, LogOutput);
|
||||
showMessage(msg, AppError);
|
||||
}
|
||||
|
||||
void RemoteGdbServerAdapter::startInferior()
|
||||
@@ -209,8 +213,8 @@ void RemoteGdbServerAdapter::handleTargetRemote(const GdbResponse &record)
|
||||
if (record.resultClass == GdbResultDone) {
|
||||
setState(InferiorStopped);
|
||||
// gdb server will stop the remote application itself.
|
||||
debugMessage(_("INFERIOR STARTED"));
|
||||
showStatusMessage(msgAttachedToStoppedInferior());
|
||||
showMessage(_("INFERIOR STARTED"));
|
||||
showMessage(msgAttachedToStoppedInferior(), StatusBar);
|
||||
emit inferiorPrepared();
|
||||
} else {
|
||||
// 16^error,msg="hd:5555: Connection timed out."
|
||||
|
@@ -48,7 +48,7 @@ void RemotePlainGdbAdapter::startAdapter()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
setState(AdapterStarting);
|
||||
debugMessage(QLatin1String("TRYING TO START ADAPTER"));
|
||||
showMessage(QLatin1String("TRYING TO START ADAPTER"));
|
||||
|
||||
if (!startParameters().workingDirectory.isEmpty())
|
||||
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
|
||||
@@ -86,8 +86,8 @@ QString RemotePlainGdbAdapter::fromLocalEncoding(const QByteArray &b) const
|
||||
|
||||
void RemotePlainGdbAdapter::handleApplicationOutput(const QByteArray &output)
|
||||
{
|
||||
QTC_ASSERT(m_engine->runControl(), return);
|
||||
m_engine->runControl()->showApplicationOutput(output, false);
|
||||
// FIXME: Remote encoding?
|
||||
showMessage(QString::fromLatin1(output), AppOutput);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -83,7 +83,7 @@ void TermGdbAdapter::startAdapter()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
setState(AdapterStarting);
|
||||
debugMessage(_("TRYING TO START ADAPTER"));
|
||||
showMessage(_("TRYING TO START ADAPTER"));
|
||||
|
||||
// Currently, adapters are not re-used
|
||||
// // 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());
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
setState(InferiorStopped);
|
||||
debugMessage(_("INFERIOR ATTACHED"));
|
||||
showMessage(_("INFERIOR ATTACHED"));
|
||||
emit inferiorPrepared();
|
||||
#ifdef Q_OS_LINUX
|
||||
m_engine->postCommand("-stack-list-frames 0 0", CB(handleEntryPoint));
|
||||
@@ -162,7 +162,7 @@ void TermGdbAdapter::interruptInferior()
|
||||
const qint64 attachedPID = m_engine->inferiorPid();
|
||||
QTC_ASSERT(attachedPID > 0, return);
|
||||
if (!interruptProcess(attachedPID))
|
||||
debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
|
||||
showMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
|
||||
}
|
||||
|
||||
void TermGdbAdapter::stubMessage(const QString &msg, bool)
|
||||
@@ -172,7 +172,7 @@ void TermGdbAdapter::stubMessage(const QString &msg, bool)
|
||||
|
||||
void TermGdbAdapter::stubExited()
|
||||
{
|
||||
debugMessage(_("STUB EXITED"));
|
||||
showMessage(_("STUB EXITED"));
|
||||
if (state() != AdapterStarting // From previous instance
|
||||
&& state() != EngineShuttingDown && state() != DebuggerNotReady)
|
||||
emit adapterCrashed(QString());
|
||||
|
@@ -379,7 +379,7 @@ QByteArray TrkGdbAdapter::trkStepRangeMessage()
|
||||
if (from <= pc && pc <= to) {
|
||||
//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));
|
||||
} else {
|
||||
from = pc;
|
||||
@@ -434,7 +434,7 @@ void TrkGdbAdapter::slotEmitDelayedInferiorStartFailed()
|
||||
void TrkGdbAdapter::logMessage(const QString &msg)
|
||||
{
|
||||
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
|
||||
// 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();
|
||||
QString reason;
|
||||
uint addr;
|
||||
@@ -1139,7 +1139,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
|
||||
trk::Launcher::parseNotifyStopped(result.data, &pid, &tid, &addr, &reason);
|
||||
const QString msg = trk::Launcher::msgStopped(pid, tid, addr, reason);
|
||||
logMessage(prefix + msg);
|
||||
runControl()->showDebuggerOutput(msg, LogMisc);
|
||||
showMessage(msg, LogMisc);
|
||||
sendTrkAck(result.token);
|
||||
if (addr) {
|
||||
// Todo: Do not send off GdbMessages if a synced gdb
|
||||
@@ -1174,14 +1174,14 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
|
||||
break;
|
||||
}
|
||||
case TrkNotifyException: { // 0x91 Notify Exception (obsolete)
|
||||
debugMessage(_("RESET SNAPSHOT (NOTIFY EXCEPTION)"));
|
||||
showMessage(_("RESET SNAPSHOT (NOTIFY EXCEPTION)"));
|
||||
m_snapshot.reset();
|
||||
logMessage(prefix + "NOTE: EXCEPTION " + str);
|
||||
sendTrkAck(result.token);
|
||||
break;
|
||||
}
|
||||
case 0x92: { //
|
||||
debugMessage(_("RESET SNAPSHOT (NOTIFY INTERNAL ERROR)"));
|
||||
showMessage(_("RESET SNAPSHOT (NOTIFY INTERNAL ERROR)"));
|
||||
m_snapshot.reset();
|
||||
logMessage(prefix + "NOTE: INTERNAL ERROR: " + str);
|
||||
sendTrkAck(result.token);
|
||||
@@ -1192,7 +1192,7 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
|
||||
case 0xa0: { // Notify Created
|
||||
// Sending this ACK does not seem to make a difference. Why?
|
||||
//sendTrkAck(result.token);
|
||||
debugMessage(_("RESET SNAPSHOT (NOTIFY CREATED)"));
|
||||
showMessage(_("RESET SNAPSHOT (NOTIFY CREATED)"));
|
||||
m_snapshot.fullReset();
|
||||
const char *data = result.data.data();
|
||||
const trk::byte error = result.data.at(0);
|
||||
@@ -1521,7 +1521,7 @@ void TrkGdbAdapter::tryAnswerGdbMemoryRequest(bool buffered)
|
||||
}
|
||||
// Happens when chunks are not combined
|
||||
QTC_ASSERT(false, /**/);
|
||||
debugMessage("CHUNKS NOT COMBINED");
|
||||
showMessage("CHUNKS NOT COMBINED");
|
||||
# ifdef MEMORY_DEBUG
|
||||
qDebug() << "CHUNKS NOT COMBINED";
|
||||
it = m_snapshot.memory.begin();
|
||||
@@ -1590,7 +1590,7 @@ void TrkGdbAdapter::handleStep(const TrkResult &result)
|
||||
logMessage("ERROR: " + result.errorString() + " in handleStep");
|
||||
|
||||
// Try fallback with Continue.
|
||||
debugMessage("FALLBACK TO 'CONTINUE'");
|
||||
showMessage("FALLBACK TO 'CONTINUE'");
|
||||
sendTrkMessage(0x18, TrkCallback(), trkContinueMessage(), "CONTINUE");
|
||||
//sendGdbServerMessage("S05", "Stepping finished");
|
||||
|
||||
@@ -1775,7 +1775,7 @@ void TrkGdbAdapter::startAdapter()
|
||||
// Start
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
setState(AdapterStarting);
|
||||
debugMessage(_("TRYING TO START ADAPTER"));
|
||||
showMessage(_("TRYING TO START ADAPTER"));
|
||||
logMessage(QLatin1String("### Starting TrkGdbAdapter"));
|
||||
|
||||
// Prompt the user to start communication
|
||||
|
@@ -58,16 +58,10 @@ bool IDebuggerEngine::checkConfiguration(int toolChain,
|
||||
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);
|
||||
runControl()->showDebuggerInput(msg, channel);
|
||||
}
|
||||
|
||||
void IDebuggerEngine::showDebuggerOutput(const QString &msg, int channel) const
|
||||
{
|
||||
QTC_ASSERT(runControl(), return);
|
||||
runControl()->showDebuggerOutput(msg, channel);
|
||||
runControl()->showMessage(msg, channel, timeout);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -133,11 +133,11 @@ public:
|
||||
virtual QString qtNamespace() const { return QString(); }
|
||||
|
||||
// Convenience
|
||||
void showDebuggerInput(const QString &msg, int channel = LogDebug) const;
|
||||
void showDebuggerOutput(const QString &msg, int channel = LogDebug) const;
|
||||
void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1) const;
|
||||
void showStatusMessage(const QString &msg, int timeout = -1) const
|
||||
{ showMessage(msg, StatusBar, timeout); }
|
||||
|
||||
protected:
|
||||
void showStatusMessage(const QString &msg, int timeout = -1);
|
||||
DebuggerState state() const;
|
||||
void setState(DebuggerState state, bool forced = false);
|
||||
DebuggerManager *manager() const { return m_manager; }
|
||||
|
@@ -94,7 +94,7 @@ void PdbEngine::executeDebuggerCommand(const QString &command)
|
||||
{
|
||||
XSDEBUG("PdbEngine::executeDebuggerCommand:" << command);
|
||||
if (state() == DebuggerNotReady) {
|
||||
showDebuggerOutput(_("PDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
|
||||
showMessage(_("PDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
|
||||
return;
|
||||
}
|
||||
m_pdbProc.write(command.toLatin1() + "\n");
|
||||
@@ -112,7 +112,7 @@ void PdbEngine::postCommand(const QByteArray &command,
|
||||
cmd.callbackName = callbackName;
|
||||
cmd.cookie = cookie;
|
||||
m_commands.enqueue(cmd);
|
||||
showDebuggerInput(_(cmd.command), LogInput);
|
||||
showMessage(_(cmd.command), LogInput);
|
||||
m_pdbProc.write(cmd.command + "\n");
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ void PdbEngine::startDebugger()
|
||||
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
||||
QFile scriptFile(m_scriptFileName);
|
||||
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
||||
//showDebuggerOutput("STARTING " +m_scriptFileName + "FAILED");
|
||||
showDebuggerOutput(QString::fromLatin1("Cannot open %1: %2").
|
||||
//showMessage("STARTING " +m_scriptFileName + "FAILED");
|
||||
showMessage(QString::fromLatin1("Cannot open %1: %2").
|
||||
arg(m_scriptFileName, scriptFile.errorString()), LogError);
|
||||
emit startFailed();
|
||||
return;
|
||||
@@ -158,7 +158,7 @@ void PdbEngine::startDebugger()
|
||||
m_pdbProc.disconnect(); // From any previous runs
|
||||
|
||||
m_pdb = _("/usr/bin/python");
|
||||
showDebuggerOutput(_("STARTING PDB ") + m_pdb);
|
||||
showMessage(_("STARTING PDB ") + m_pdb);
|
||||
QStringList gdbArgs;
|
||||
gdbArgs += _("-i");
|
||||
gdbArgs += _("/usr/bin/pdb");
|
||||
@@ -186,7 +186,7 @@ void PdbEngine::startDebugger()
|
||||
const QString msg = tr("Unable to start pdb '%1': %2")
|
||||
.arg(m_pdb, m_pdbProc.errorString());
|
||||
setState(AdapterStartFailed);
|
||||
showDebuggerOutput(_("ADAPTER START FAILED"));
|
||||
showMessage(_("ADAPTER START FAILED"));
|
||||
if (!msg.isEmpty()) {
|
||||
const QString title = tr("Adapter start failed");
|
||||
Core::ICore::instance()->showWarningWithOptions(title, msg);
|
||||
@@ -200,7 +200,7 @@ void PdbEngine::startDebugger()
|
||||
setState(InferiorRunning);
|
||||
attemptBreakpointSynchronization();
|
||||
|
||||
showDebuggerOutput(_("PDB STARTED, INITIALIZING IT"));
|
||||
showMessage(_("PDB STARTED, INITIALIZING IT"));
|
||||
const QByteArray dumperSourcePath =
|
||||
Core::ICore::instance()->resourcePath().toLocal8Bit() + "/gdbmacros/";
|
||||
postCommand("execfile('" + dumperSourcePath + "pdumper.py')",
|
||||
@@ -556,7 +556,7 @@ void PdbEngine::updateWatchData(const WatchData &data)
|
||||
|
||||
void PdbEngine::handlePdbError(QProcess::ProcessError error)
|
||||
{
|
||||
showDebuggerOutput(_("HANDLE PDB ERROR"));
|
||||
showMessage(_("HANDLE PDB ERROR"));
|
||||
switch (error) {
|
||||
case QProcess::Crashed:
|
||||
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)
|
||||
{
|
||||
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();
|
||||
//initializeVariables();
|
||||
setState(DebuggerNotReady, true);
|
||||
@@ -612,7 +612,7 @@ void PdbEngine::readPdbStandardError()
|
||||
{
|
||||
QByteArray err = m_pdbProc.readAllStandardError();
|
||||
qWarning() << "Unexpected pdb stderr:" << err;
|
||||
showDebuggerOutput(_("Unexpected pdb stderr: " + err));
|
||||
showMessage(_("Unexpected pdb stderr: " + err));
|
||||
}
|
||||
|
||||
void PdbEngine::readPdbStandardOutput()
|
||||
@@ -623,7 +623,7 @@ void PdbEngine::readPdbStandardOutput()
|
||||
while ((pos = m_inbuffer.indexOf("(Pdb)")) != -1) {
|
||||
PdbResponse response;
|
||||
response.data = m_inbuffer.left(pos).trimmed();
|
||||
showDebuggerOutput(_(response.data));
|
||||
showMessage(_(response.data));
|
||||
m_inbuffer = m_inbuffer.mid(pos + 6);
|
||||
QTC_ASSERT(!m_commands.isEmpty(),
|
||||
qDebug() << "RESPONSE: " << response.data; return)
|
||||
|
@@ -314,7 +314,7 @@ void QmlEngine::handleResponse(const QByteArray &response)
|
||||
/*
|
||||
static QTime lastTime;
|
||||
|
||||
//debugMessage(_(" "), currentTime());
|
||||
//showMessage(_(" "), currentTime(), LogTime);
|
||||
QList<QByteArray> parts = response.split('\0');
|
||||
if (parts.size() < 2 || !parts.last().isEmpty()) {
|
||||
SDEBUG("WRONG RESPONSE PACKET LAYOUT" << parts);
|
||||
@@ -460,7 +460,7 @@ void QmlEngine::sendCommandNow(const QmlCommand &cmd)
|
||||
int result = m_socket->write(cmd.command);
|
||||
Q_UNUSED(result)
|
||||
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));
|
||||
}
|
||||
|
||||
|
@@ -128,7 +128,7 @@ void ScriptAgent::exceptionCatch(qint64 scriptId, const QScriptValue & exception
|
||||
const QString msg = QString::fromLatin1("An exception was caught on %1: '%2'").
|
||||
arg(scriptId).arg(exception.toString());
|
||||
SDEBUG(msg);
|
||||
q->showDebuggerOutput(msg, LogMisc);
|
||||
q->showMessage(msg, LogMisc);
|
||||
}
|
||||
|
||||
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'").
|
||||
arg(scriptId).arg(exception.toString());
|
||||
SDEBUG(msg);
|
||||
q->showDebuggerOutput(msg, LogMisc);
|
||||
q->showMessage(msg, LogMisc);
|
||||
}
|
||||
|
||||
void ScriptAgent::functionEntry(qint64 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);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void ScriptAgent::functionExit(qint64 scriptId, const QScriptValue &returnValue)
|
||||
Q_UNUSED(returnValue)
|
||||
const QString msg = QString::fromLatin1("Function exit occurred on %1: '%2'").arg(scriptId).arg(returnValue.toString());
|
||||
SDEBUG(msg);
|
||||
q->showDebuggerOutput(msg, LogMisc);
|
||||
q->showMessage(msg, LogMisc);
|
||||
}
|
||||
|
||||
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(fileName)
|
||||
Q_UNUSED(baseLineNumber)
|
||||
q->showDebuggerOutput(QString::fromLatin1("Loaded: %1 id: %2")
|
||||
q->showMessage(QString::fromLatin1("Loaded: %1 id: %2")
|
||||
.arg(fileName).arg(scriptId), LogMisc);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ void ScriptEngine::startDebugger()
|
||||
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
||||
QFile scriptFile(m_scriptFileName);
|
||||
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);
|
||||
emit startFailed();
|
||||
return;
|
||||
@@ -263,7 +263,7 @@ void ScriptEngine::startDebugger()
|
||||
attemptBreakpointSynchronization();
|
||||
setState(InferiorRunningRequested);
|
||||
showStatusMessage(tr("Running requested..."), 5000);
|
||||
showDebuggerOutput(QLatin1String("Running: ") + m_scriptFileName, LogMisc);
|
||||
showMessage(QLatin1String("Running: ") + m_scriptFileName, LogMisc);
|
||||
QTimer::singleShot(0, this, SLOT(runInferior()));
|
||||
emit startSuccessful();
|
||||
}
|
||||
@@ -341,7 +341,7 @@ void ScriptEngine::runInferior()
|
||||
msg = QString::fromLatin1("Evaluation returns '%1'")
|
||||
.arg(result.toString());
|
||||
}
|
||||
showDebuggerOutput(msg, LogMisc);
|
||||
showMessage(msg, LogMisc);
|
||||
exitDebugger();
|
||||
}
|
||||
|
||||
|
@@ -313,7 +313,7 @@ void TcfEngine::handleResponse(const QByteArray &response)
|
||||
{
|
||||
static QTime lastTime;
|
||||
|
||||
//debugMessage(_(" "), currentTime());
|
||||
//showMessage(_(" "), currentTime(), LogTime);
|
||||
QList<QByteArray> parts = response.split('\0');
|
||||
if (parts.size() < 2 || !parts.last().isEmpty()) {
|
||||
SDEBUG("WRONG RESPONSE PACKET LAYOUT" << parts);
|
||||
@@ -328,7 +328,7 @@ void TcfEngine::handleResponse(const QByteArray &response)
|
||||
int token = parts.at(1).toInt();
|
||||
TcfCommand tcf = m_cookieForToken[token];
|
||||
SDEBUG("COMMAND NOT RECOGNIZED FOR TOKEN" << token << tcf.toString());
|
||||
showDebuggerOutput(QString::number(token) + "^"
|
||||
showMessage(QString::number(token) + "^"
|
||||
+ "NOT RECOQNIZED: " + quoteUnprintableLatin1(response),
|
||||
LogOutput);
|
||||
acknowledgeResult();
|
||||
@@ -340,7 +340,7 @@ void TcfEngine::handleResponse(const QByteArray &response)
|
||||
int token = parts.at(1).toInt();
|
||||
QByteArray message = parts.at(2);
|
||||
JsonValue data(parts.at(3));
|
||||
showDebuggerOutput(QString("%1^%2%3").arg(token)
|
||||
showMessage(QString("%1^%2%3").arg(token)
|
||||
.arg(quoteUnprintableLatin1(response))
|
||||
.arg(QString::fromUtf8(data.toString())), LogOutput);
|
||||
TcfCommand tcf = m_cookieForToken[token];
|
||||
@@ -482,7 +482,7 @@ void TcfEngine::sendCommandNow(const TcfCommand &cmd)
|
||||
int result = m_socket->write(cmd.command);
|
||||
Q_UNUSED(result)
|
||||
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));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user