Commit a4d7fb2f authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Fix compilation, centralize breakpoint type detection.

Reviewed-by: hjk
parent 61e99b3d
......@@ -1197,6 +1197,23 @@ void CdbEngine::selectThread(int index)
}
}
bool CdbEngine::stateAcceptsBreakpointChanges() const
{
switch (state()) {
case InferiorRunOk:
case InferiorStopOk:
return true;
default:
break;
}
return false;
}
bool CdbEngine::acceptsBreakpoint(BreakpointId id) const
{
return DebuggerEngine::isCppBreakpoint(breakHandler()->breakpointData(id));
}
void CdbEngine::attemptBreakpointSynchronization()
{
if (!m_d->m_hDebuggeeProcess) // Sometimes called from the breakpoint Window
......@@ -1751,7 +1768,7 @@ void CdbEnginePrivate::updateStackTrace()
void CdbEnginePrivate::updateModules()
{
QList<Module> modules;
Modules modules;
QString errorMessage;
if (!getModuleList(interfaces().debugSymbols, &modules, &errorMessage))
m_engine->warning(msgFunctionFailed(Q_FUNC_INFO, errorMessage));
......
......@@ -83,6 +83,8 @@ public:
virtual void activateFrame(int index);
virtual void selectThread(int index);
virtual bool stateAcceptsBreakpointChanges() const;
virtual bool acceptsBreakpoint(BreakpointId id) const;
virtual void attemptBreakpointSynchronization();
virtual void setRegisterValue(int regnr, const QString &value);
......
......@@ -1669,6 +1669,23 @@ static inline BreakPointSyncType breakPointSyncType(const BreakHandler *handler,
return added ? BreakpointsAdded : BreakpointsUnchanged;
}
bool CdbEngine::stateAcceptsBreakpointChanges() const
{
switch (state()) {
case InferiorRunOk:
case InferiorStopOk:
return true;
default:
break;
}
return false;
}
bool CdbEngine::acceptsBreakpoint(BreakpointId id) const
{
return DebuggerEngine::isCppBreakpoint(breakHandler()->breakpointData(id));
}
void CdbEngine::attemptBreakpointSynchronization()
{
// Check if there is anything to be done at all.
......
......@@ -101,6 +101,8 @@ public:
virtual void activateFrame(int index);
virtual void selectThread(int index);
virtual bool stateAcceptsBreakpointChanges() const;
virtual bool acceptsBreakpoint(BreakpointId id) const;
virtual void attemptBreakpointSynchronization();
virtual void fetchDisassembler(Debugger::Internal::DisassemblerViewAgent *agent);
......
......@@ -1403,6 +1403,15 @@ void DebuggerEngine::showStoppedByExceptionMessageBox(const QString &description
showMessageBox(QMessageBox::Information, tr("Exception Triggered"), msg);
}
bool DebuggerEngine::isCppBreakpoint(const BreakpointParameters &p)
{
// Qml is currently only file
if (p.type != BreakpointByFileAndLine)
return true;
return !p.fileName.endsWith(QLatin1String(".qml"), Qt::CaseInsensitive)
&& !p.fileName.endsWith(QLatin1String(".js"), Qt::CaseInsensitive);
}
} // namespace Debugger
#include "debuggerengine.moc"
......@@ -345,6 +345,8 @@ protected:
void showStoppedBySignalMessageBox(const QString meaning, QString name);
void showStoppedByExceptionMessageBox(const QString &description);
static bool isCppBreakpoint(const Internal::BreakpointParameters &p);
private:
// Wrapper engine needs access to state of its subengines.
friend class QmlCppEngine;
......
......@@ -344,7 +344,7 @@ DebuggerEngineType DebuggerRunControlPrivate::engineForExecutable
// We need the CDB debugger in order to be able to debug VS
// executables.
if (d->checkDebugConfiguration(ProjectExplorer::ToolChain_MSVC,
if (DebuggerRunControl::checkDebugConfiguration(ProjectExplorer::ToolChain_MSVC,
&m_errorMessage, 0, &m_settingsIdHint)) {
if (enabledEngineTypes & CdbEngineType)
return CdbEngineType;
......@@ -372,7 +372,7 @@ DebuggerEngineType DebuggerRunControlPrivate::engineForMode
if (startMode != AttachToRemote && (enabledEngineTypes & CdbEngineType))
return CdbEngineType;
if (startMode == AttachCrashedExternal) {
m_errorMessage = tr("There is no debugging engine available for post-mortem debugging.");
m_errorMessage = DebuggerRunControl::tr("There is no debugging engine available for post-mortem debugging.");
return NoEngineType;
}
return GdbEngineType;
......
......@@ -87,7 +87,7 @@ bool AbstractGdbAdapter::prepareWinCommand()
if (perr != Utils::QtcProcess::SplitOk) {
// perr == BadQuoting is never returned on Windows
// FIXME? QTCREATORBUG-2809
m_engine->handleAdapterStartFailed(QApplication::translate("DebuggerEngine", // Same message in CdbEngine
m_engine->handleAdapterStartFailed(QCoreApplication::translate("DebuggerEngine", // Same message in CdbEngine
"Debugging complex command lines is currently not supported under Windows"), QString());
return false;
}
......
......@@ -2568,9 +2568,7 @@ void GdbEngine::attemptBreakpointSynchronization()
bool GdbEngine::acceptsBreakpoint(BreakpointId id) const
{
const QString fileName = breakHandler()->fileName(id);
return !fileName.endsWith(QLatin1String("js"))
&& !fileName.endsWith(QLatin1String("qml"));
return DebuggerEngine::isCppBreakpoint(breakHandler()->breakpointData(id));
}
void GdbEngine::insertBreakpoint(BreakpointId id)
......@@ -2733,7 +2731,7 @@ void GdbEngine::handleShowModuleSymbols(const GdbResponse &response)
foreach (const QByteArray &line, file.readAll().split('\n')) {
if (line.isEmpty())
continue;
if (!line.at(0) == '[')
if (line.at(0) != '[')
continue;
int posCode = line.indexOf(']') + 2;
int posAddress = line.indexOf("0x", posCode);
......
......@@ -496,9 +496,7 @@ void QmlEngine::attemptBreakpointSynchronization()
bool QmlEngine::acceptsBreakpoint(BreakpointId id) const
{
const QString fileName = breakHandler()->fileName(id);
return fileName.endsWith(QLatin1String(".qml"))
|| fileName.endsWith(QLatin1String(".js"));
return !DebuggerEngine::isCppBreakpoint(breakHandler()->breakpointData(id));
}
void QmlEngine::loadSymbols(const QString &moduleName)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment