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:
hjk
2011-07-04 14:24:42 +02:00
committed by hjk
parent 7020cdc587
commit 73d3ef0ae6
3 changed files with 12 additions and 6 deletions

View File

@@ -36,6 +36,7 @@
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
namespace Debugger {
namespace Internal {
@@ -234,12 +235,17 @@ bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
return s1 == s2;
}
void BreakpointParameters::setLocation(const QByteArray &location)
void BreakpointParameters::updateLocation(const QByteArray &location)
{
if (location.size()) {
int pos = location.indexOf(':');
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();
}
}