Debugging: Pass a DebuggingLanguage arg in executeDebuggerCommand()

Change-Id: I99eedc86c987615072b7400051b61700b98ebab3
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Aurindam Jana
2012-04-10 09:36:15 +02:00
committed by hjk
parent e2d8a9600e
commit 3d32f42b7d
17 changed files with 32 additions and 28 deletions

View File

@@ -1357,8 +1357,9 @@ void CdbEngine::handleThreads(const CdbExtensionCommandPtr &reply)
} }
} }
void CdbEngine::executeDebuggerCommand(const QString &command) void CdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
if (languages & CppLanguage)
postCommand(command.toLocal8Bit(), QuietCommand); postCommand(command.toLocal8Bit(), QuietCommand);
} }

View File

@@ -115,7 +115,7 @@ public:
virtual void executeRunToFunction(const QString &functionName); virtual void executeRunToFunction(const QString &functionName);
virtual void executeJumpToLine(const ContextData &data); virtual void executeJumpToLine(const ContextData &data);
virtual void assignValueInDebugger(const WatchData *w, const QString &expr, const QVariant &value); virtual void assignValueInDebugger(const WatchData *w, const QString &expr, const QVariant &value);
virtual void executeDebuggerCommand(const QString &command); virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
virtual void activateFrame(int index); virtual void activateFrame(int index);
virtual void selectThread(int index); virtual void selectThread(int index);

View File

@@ -118,7 +118,7 @@ public:
const QVector<Symbol> &symbols) = 0; const QVector<Symbol> &symbols) = 0;
virtual void openMemoryEditor() = 0; virtual void openMemoryEditor() = 0;
virtual void languagesChanged() = 0; virtual void languagesChanged() = 0;
virtual void executeDebuggerCommand(const QString &command) = 0; virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages) = 0;
virtual bool evaluateScriptExpression(const QString &expression) = 0; virtual bool evaluateScriptExpression(const QString &expression) = 0;
virtual Utils::SavedAction *action(int code) const = 0; virtual Utils::SavedAction *action(int code) const = 0;

View File

@@ -1674,7 +1674,7 @@ void DebuggerEngine::executeJumpToLine(const ContextData &)
{ {
} }
void DebuggerEngine::executeDebuggerCommand(const QString &) void DebuggerEngine::executeDebuggerCommand(const QString &, DebuggerLanguages)
{ {
showStatusMessage(tr("This debugger cannot handle user input.")); showStatusMessage(tr("This debugger cannot handle user input."));
} }

View File

@@ -362,7 +362,7 @@ protected:
virtual void executeRunToLine(const Internal::ContextData &data); virtual void executeRunToLine(const Internal::ContextData &data);
virtual void executeRunToFunction(const QString &functionName); virtual void executeRunToFunction(const QString &functionName);
virtual void executeJumpToLine(const Internal::ContextData &data); virtual void executeJumpToLine(const Internal::ContextData &data);
virtual void executeDebuggerCommand(const QString &command); virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
virtual bool evaluateScriptExpression(const QString &expression); virtual bool evaluateScriptExpression(const QString &expression);
virtual void frameUp(); virtual void frameUp();

View File

@@ -846,7 +846,7 @@ public slots:
void aboutToUnloadSession(); void aboutToUnloadSession();
void aboutToSaveSession(); void aboutToSaveSession();
void executeDebuggerCommand(const QString &command); void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
bool evaluateScriptExpression(const QString &expression); bool evaluateScriptExpression(const QString &expression);
void coreShutdown(); void coreShutdown();
@@ -2526,10 +2526,10 @@ void DebuggerPluginPrivate::aboutToSaveSession()
m_breakHandler->saveSessionData(); m_breakHandler->saveSessionData();
} }
void DebuggerPluginPrivate::executeDebuggerCommand(const QString &command) void DebuggerPluginPrivate::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
if (currentEngine()->acceptsDebuggerCommands()) if (currentEngine()->acceptsDebuggerCommands())
currentEngine()->executeDebuggerCommand(command); currentEngine()->executeDebuggerCommand(command, languages);
else else
showStatusMessage(tr("User commands are not accepted in the current state.")); showStatusMessage(tr("User commands are not accepted in the current state."));
} }

View File

@@ -1234,8 +1234,10 @@ bool GdbEngine::acceptsDebuggerCommands() const
|| state() == InferiorUnrunnable; || state() == InferiorUnrunnable;
} }
void GdbEngine::executeDebuggerCommand(const QString &command) void GdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
if (!(languages & CppLanguage))
return;
QTC_CHECK(acceptsDebuggerCommands()); QTC_CHECK(acceptsDebuggerCommands());
GdbCommand cmd; GdbCommand cmd;
cmd.command = command.toLatin1(); cmd.command = command.toLatin1();

View File

@@ -242,7 +242,7 @@ private: ////////// General Interface //////////
virtual void abortDebugger(); virtual void abortDebugger();
virtual bool acceptsDebuggerCommands() const; virtual bool acceptsDebuggerCommands() const;
virtual void executeDebuggerCommand(const QString &command); virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
virtual QByteArray qtNamespace() const { return m_dumperHelper.qtNamespace(); } virtual QByteArray qtNamespace() const { return m_dumperHelper.qtNamespace(); }
virtual void setQtNamespace(const QByteArray &ns) virtual void setQtNamespace(const QByteArray &ns)
{ return m_dumperHelper.setQtNamespace(ns); } { return m_dumperHelper.setQtNamespace(ns); }

View File

@@ -389,12 +389,13 @@ LogWindow::LogWindow(QWidget *parent)
void LogWindow::executeLine() void LogWindow::executeLine()
{ {
m_ignoreNextInputEcho = true; m_ignoreNextInputEcho = true;
debuggerCore()->executeDebuggerCommand(m_inputText->textCursor().block().text()); debuggerCore()->executeDebuggerCommand(m_inputText->textCursor().block().text(),
CppLanguage);
} }
void LogWindow::sendCommand() void LogWindow::sendCommand()
{ {
debuggerCore()->executeDebuggerCommand(m_commandEdit->text()); debuggerCore()->executeDebuggerCommand(m_commandEdit->text(), CppLanguage);
} }
void LogWindow::showOutput(int channel, const QString &output) void LogWindow::showOutput(int channel, const QString &output)

View File

@@ -98,8 +98,10 @@ PdbEngine::PdbEngine(const DebuggerStartParameters &startParameters)
PdbEngine::~PdbEngine() PdbEngine::~PdbEngine()
{} {}
void PdbEngine::executeDebuggerCommand(const QString &command) void PdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
if (!(languages & CppLanguage))
return;
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
//XSDEBUG("PdbEngine::executeDebuggerCommand:" << command); //XSDEBUG("PdbEngine::executeDebuggerCommand:" << command);
if (state() == DebuggerNotReady) { if (state() == DebuggerNotReady) {

View File

@@ -97,7 +97,7 @@ private:
void assignValueInDebugger(const WatchData *data, void assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value); const QString &expr, const QVariant &value);
void executeDebuggerCommand(const QString &command); void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
void loadSymbols(const QString &moduleName); void loadSymbols(const QString &moduleName);
void loadAllSymbols(); void loadAllSymbols();

View File

@@ -409,13 +409,10 @@ void QmlCppEngine::executeJumpToLine(const ContextData &data)
d->m_activeEngine->executeJumpToLine(data); d->m_activeEngine->executeJumpToLine(data);
} }
void QmlCppEngine::executeDebuggerCommand(const QString &command) void QmlCppEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
if (d->m_qmlEngine->state() == InferiorStopOk) { d->m_qmlEngine->executeDebuggerCommand(command, languages);
d->m_qmlEngine->executeDebuggerCommand(command); d->m_cppEngine->executeDebuggerCommand(command, languages);
} else {
d->m_cppEngine->executeDebuggerCommand(command);
}
} }
bool QmlCppEngine::evaluateScriptExpression(const QString &expression) bool QmlCppEngine::evaluateScriptExpression(const QString &expression)

View File

@@ -116,7 +116,7 @@ protected:
void executeRunToLine(const ContextData &data); void executeRunToLine(const ContextData &data);
void executeRunToFunction(const QString &functionName); void executeRunToFunction(const QString &functionName);
void executeJumpToLine(const ContextData &data); void executeJumpToLine(const ContextData &data);
void executeDebuggerCommand(const QString &command); void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
bool evaluateScriptExpression(const QString &expression); bool evaluateScriptExpression(const QString &expression);
void setupEngine(); void setupEngine();

View File

@@ -1141,9 +1141,9 @@ void QmlEngine::appendDebugOutput(QtMsgType type, const QString &message,
qtMessageLogHandler()->appendItem(item); qtMessageLogHandler()->appendItem(item);
} }
void QmlEngine::executeDebuggerCommand(const QString& command) void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
if (d->m_adapter.activeDebuggerClient()) { if ((languages & QmlLanguage) && d->m_adapter.activeDebuggerClient()) {
d->m_adapter.activeDebuggerClient()->executeDebuggerCommand(command); d->m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
} }
} }
@@ -1183,7 +1183,7 @@ bool QmlEngine::evaluateScriptExpression(const QString& expression)
} }
} }
} else { } else {
executeDebuggerCommand(expression); executeDebuggerCommand(expression, QmlLanguage);
} }
} else { } else {
didEvaluate = false; didEvaluate = false;

View File

@@ -151,7 +151,7 @@ private:
bool supportsThreads() const { return false; } bool supportsThreads() const { return false; }
void updateWatchData(const WatchData &data, void updateWatchData(const WatchData &data,
const WatchUpdateFlags &flags); const WatchUpdateFlags &flags);
void executeDebuggerCommand(const QString &command); void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
bool evaluateScriptExpression(const QString &expression); bool evaluateScriptExpression(const QString &expression);
bool hasCapability(unsigned) const; bool hasCapability(unsigned) const;

View File

@@ -214,9 +214,10 @@ ScriptEngine::~ScriptEngine()
{ {
} }
void ScriptEngine::executeDebuggerCommand(const QString &command) void ScriptEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{ {
Q_UNUSED(command) Q_UNUSED(command)
Q_UNUSED(languages)
XSDEBUG("FIXME: ScriptEngine::executeDebuggerCommand()"); XSDEBUG("FIXME: ScriptEngine::executeDebuggerCommand()");
} }

View File

@@ -95,7 +95,7 @@ private:
void assignValueInDebugger(const WatchData *w, void assignValueInDebugger(const WatchData *w,
const QString &expr, const QVariant &value); const QString &expr, const QVariant &value);
void executeDebuggerCommand(const QString &command); void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
void loadSymbols(const QString &moduleName); void loadSymbols(const QString &moduleName);
void loadAllSymbols(); void loadAllSymbols();