forked from qt-creator/qt-creator
debugger: take actual breakpoints into account for source locations
Change-Id: I5cf2982812456249fca2f233514cb90bb8d3bfe0 Reviewed-on: http://codereview.qt-project.org/5799 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -1259,6 +1259,19 @@ BreakpointModelIds BreakHandler::engineBreakpointIds(DebuggerEngine *engine) con
|
|||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList BreakHandler::engineBreakpointPaths(DebuggerEngine *engine) const
|
||||||
|
{
|
||||||
|
QSet<QString> set;
|
||||||
|
ConstIterator it = m_storage.constBegin(), et = m_storage.constEnd();
|
||||||
|
for ( ; it != et; ++it) {
|
||||||
|
if (it->engine == engine) {
|
||||||
|
if (it->data.type == BreakpointByFileAndLine)
|
||||||
|
set.insert(QFileInfo(it->data.fileName).dir().path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return set.toList();
|
||||||
|
}
|
||||||
|
|
||||||
void BreakHandler::cleanupBreakpoint(BreakpointModelId id)
|
void BreakHandler::cleanupBreakpoint(BreakpointModelId id)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state(id) == BreakpointDead, qDebug() << state(id));
|
QTC_ASSERT(state(id) == BreakpointDead, qDebug() << state(id));
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public:
|
|||||||
BreakpointModelIds engineBreakpointIds(DebuggerEngine *engine) const;
|
BreakpointModelIds engineBreakpointIds(DebuggerEngine *engine) const;
|
||||||
BreakpointModelIds unclaimedBreakpointIds() const;
|
BreakpointModelIds unclaimedBreakpointIds() const;
|
||||||
int size() const { return m_storage.size(); }
|
int size() const { return m_storage.size(); }
|
||||||
|
QStringList engineBreakpointPaths(DebuggerEngine *engine) const;
|
||||||
|
|
||||||
// Find a breakpoint matching approximately the data in needle.
|
// Find a breakpoint matching approximately the data in needle.
|
||||||
BreakpointModelId findSimilarBreakpoint(const BreakpointResponse &needle) const;
|
BreakpointModelId findSimilarBreakpoint(const BreakpointResponse &needle) const;
|
||||||
|
|||||||
@@ -1198,11 +1198,10 @@ void DebuggerPluginPrivate::maybeEnrichParameters(DebuggerStartParameters *sp)
|
|||||||
return;
|
return;
|
||||||
if (sp->sysroot.isEmpty() && (sp->startMode == AttachToRemoteServer
|
if (sp->sysroot.isEmpty() && (sp->startMode == AttachToRemoteServer
|
||||||
|| sp->startMode == StartRemote)) {
|
|| sp->startMode == StartRemote)) {
|
||||||
// FIXME: Get from BaseQtVersion
|
// FIXME: Get from BaseQtVersion.
|
||||||
sp->sysroot = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_SYSROOT"));
|
sp->sysroot = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_SYSROOT"));
|
||||||
//if (sp->sysroot.isEmpty())
|
showMessage(QString::fromLatin1("USING QTC_DEBUGGER_SYSROOT %1")
|
||||||
// sp->sysroot = debuggerCore()->configValue(_("LastSysroot")).toString();
|
.arg(sp->sysroot), LogWarning);
|
||||||
showMessage(QLatin1String("### USING FAKE SYSROOT ###") + sp->sysroot, LogWarning);
|
|
||||||
}
|
}
|
||||||
if (sp->debugInfoLocation.isEmpty())
|
if (sp->debugInfoLocation.isEmpty())
|
||||||
sp->debugInfoLocation = sp->sysroot + "/usr/lib/debug";
|
sp->debugInfoLocation = sp->sysroot + "/usr/lib/debug";
|
||||||
|
|||||||
@@ -4758,34 +4758,11 @@ void GdbEngine::handleAdapterStarted()
|
|||||||
void GdbEngine::setupInferior()
|
void GdbEngine::setupInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
showStatusMessage(tr("Setting up inferior..."));
|
|
||||||
const DebuggerStartParameters &sp = startParameters();
|
|
||||||
const QByteArray debugInfoLocation = sp.debugInfoLocation.toLocal8Bit();
|
|
||||||
if (!debugInfoLocation.isEmpty())
|
|
||||||
postCommand("set debug-file-directory " + debugInfoLocation);
|
|
||||||
// Spaces just will not work.
|
|
||||||
foreach (const QString &src, sp.debugSourceLocation)
|
|
||||||
postCommand("directory " + src.toLocal8Bit());
|
|
||||||
if (!sp.solibSearchPath.isEmpty())
|
|
||||||
postCommand("set solib-search-path " + sp.solibSearchPath.toLocal8Bit());
|
|
||||||
m_gdbAdapter->setupInferior();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::notifyInferiorSetupFailed()
|
|
||||||
{
|
|
||||||
// FIXME: that's not enough to stop gdb from getting confused
|
|
||||||
// by a timeout of the adapter.
|
|
||||||
//resetCommandQueue();
|
|
||||||
DebuggerEngine::notifyInferiorSetupFailed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::handleInferiorPrepared()
|
|
||||||
{
|
|
||||||
typedef GlobalDebuggerOptions::SourcePathMap SourcePathMap;
|
typedef GlobalDebuggerOptions::SourcePathMap SourcePathMap;
|
||||||
typedef SourcePathMap::const_iterator SourcePathMapIterator;
|
typedef SourcePathMap::const_iterator SourcePathMapIterator;
|
||||||
const DebuggerStartParameters &sp = startParameters();
|
|
||||||
|
|
||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
showStatusMessage(tr("Setting up inferior..."));
|
||||||
|
const DebuggerStartParameters &sp = startParameters();
|
||||||
|
|
||||||
// Apply source path mappings from global options.
|
// Apply source path mappings from global options.
|
||||||
const SourcePathMap sourcePathMap =
|
const SourcePathMap sourcePathMap =
|
||||||
@@ -4804,6 +4781,39 @@ void GdbEngine::handleInferiorPrepared()
|
|||||||
if (!sp.sysroot.isEmpty())
|
if (!sp.sysroot.isEmpty())
|
||||||
postCommand("set substitute-path / " + sp.sysroot.toLocal8Bit());
|
postCommand("set substitute-path / " + sp.sysroot.toLocal8Bit());
|
||||||
|
|
||||||
|
const QByteArray debugInfoLocation = sp.debugInfoLocation.toLocal8Bit();
|
||||||
|
if (!debugInfoLocation.isEmpty())
|
||||||
|
postCommand("set debug-file-directory " + debugInfoLocation);
|
||||||
|
|
||||||
|
// Spaces just will not work.
|
||||||
|
foreach (const QString &src, sp.debugSourceLocation)
|
||||||
|
postCommand("directory " + src.toLocal8Bit());
|
||||||
|
if (!sp.solibSearchPath.isEmpty())
|
||||||
|
postCommand("set solib-search-path " + sp.solibSearchPath.toLocal8Bit());
|
||||||
|
|
||||||
|
// Take locations of actual breakpoints into account.
|
||||||
|
if (debuggerCore()->boolSetting(AutoEnrichParameters)) {
|
||||||
|
foreach (const QString &src, breakHandler()->engineBreakpointPaths(this))
|
||||||
|
postCommand("directory " + src.toLocal8Bit());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_gdbAdapter->setupInferior();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::notifyInferiorSetupFailed()
|
||||||
|
{
|
||||||
|
// FIXME: that's not enough to stop gdb from getting confused
|
||||||
|
// by a timeout of the adapter.
|
||||||
|
//resetCommandQueue();
|
||||||
|
DebuggerEngine::notifyInferiorSetupFailed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::handleInferiorPrepared()
|
||||||
|
{
|
||||||
|
const DebuggerStartParameters &sp = startParameters();
|
||||||
|
|
||||||
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
|
|
||||||
// Initial attempt to set breakpoints.
|
// Initial attempt to set breakpoints.
|
||||||
if (sp.startMode != AttachCore && !isSlaveEngine()) {
|
if (sp.startMode != AttachCore && !isSlaveEngine()) {
|
||||||
showStatusMessage(tr("Setting breakpoints..."));
|
showStatusMessage(tr("Setting breakpoints..."));
|
||||||
|
|||||||
Reference in New Issue
Block a user