forked from qt-creator/qt-creator
debugger: only update location when the information gets better
The contents of the "original location" field is sometimes worse than what we collected otherwise. Use it only if it points to a readable file. Change-Id: I6c7229ead803e9f7970b8322f29469bfbe350b5d Reviewed-on: http://codereview.qt.nokia.com/1072 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -234,12 +235,17 @@ bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
|
|||||||
return s1 == s2;
|
return s1 == s2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakpointParameters::setLocation(const QByteArray &location)
|
void BreakpointParameters::updateLocation(const QByteArray &location)
|
||||||
{
|
{
|
||||||
if (location.size()) {
|
if (location.size()) {
|
||||||
int pos = location.indexOf(':');
|
int pos = location.indexOf(':');
|
||||||
lineNumber = location.mid(pos + 1).toInt();
|
lineNumber = location.mid(pos + 1).toInt();
|
||||||
fileName = QString::fromUtf8(location.left(pos));
|
QString file = QString::fromUtf8(location.left(pos));
|
||||||
|
if (file.startsWith(QLatin1Char('"')) && file.endsWith(QLatin1Char('"')))
|
||||||
|
file = file.mid(1, file.size() - 2);
|
||||||
|
QFileInfo fi(file);
|
||||||
|
if (fi.isReadable())
|
||||||
|
fileName = fi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ public:
|
|||||||
bool isBreakpoint() const { return !isWatchpoint() && !isTracepoint(); }
|
bool isBreakpoint() const { return !isWatchpoint() && !isTracepoint(); }
|
||||||
bool isTracepoint() const { return tracepoint; }
|
bool isTracepoint() const { return tracepoint; }
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
void setLocation(const QByteArray &location); // file.cpp:42
|
void updateLocation(const QByteArray &location); // file.cpp:42
|
||||||
|
|
||||||
bool operator==(const BreakpointParameters &p) const { return equals(p); }
|
bool operator==(const BreakpointParameters &p) const { return equals(p); }
|
||||||
bool operator!=(const BreakpointParameters &p) const { return !equals(p); }
|
bool operator!=(const BreakpointParameters &p) const { return !equals(p); }
|
||||||
|
|||||||
@@ -2386,7 +2386,7 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
|
|||||||
response.fileName = name;
|
response.fileName = name;
|
||||||
|
|
||||||
if (response.fileName.isEmpty())
|
if (response.fileName.isEmpty())
|
||||||
response.setLocation(originalLocation);
|
response.updateLocation(originalLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GdbEngine::breakLocation(const QString &file) const
|
QString GdbEngine::breakLocation(const QString &file) const
|
||||||
@@ -2847,7 +2847,7 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointModelI
|
|||||||
BreakpointResponse sub;
|
BreakpointResponse sub;
|
||||||
sub.address = address;
|
sub.address = address;
|
||||||
sub.functionName = QString::fromUtf8(function);
|
sub.functionName = QString::fromUtf8(function);
|
||||||
sub.setLocation(location);
|
sub.updateLocation(location);
|
||||||
sub.id = BreakpointResponseId(majorPart, minorPart);
|
sub.id = BreakpointResponseId(majorPart, minorPart);
|
||||||
sub.type = response.type;
|
sub.type = response.type;
|
||||||
sub.address = address;
|
sub.address = address;
|
||||||
@@ -2868,7 +2868,7 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointModelI
|
|||||||
BreakpointResponse sub;
|
BreakpointResponse sub;
|
||||||
sub.address = address;
|
sub.address = address;
|
||||||
sub.functionName = QString::fromUtf8(function);
|
sub.functionName = QString::fromUtf8(function);
|
||||||
sub.setLocation(location);
|
sub.updateLocation(location);
|
||||||
sub.id = BreakpointResponseId(majorPart, minorPart);
|
sub.id = BreakpointResponseId(majorPart, minorPart);
|
||||||
sub.type = response.type;
|
sub.type = response.type;
|
||||||
sub.address = address;
|
sub.address = address;
|
||||||
|
|||||||
Reference in New Issue
Block a user