Debugger: Change default gdb engine breakpoint "path usage" to "full"

Setting breakpoints by file name and line does not work robustly when
using gdb, with neither the full path, nor with just the baseline. Since
typically one of the options work, Creator offers a per-breakpoint choice
of which approach to use. Traditionally, using the full path broke more
often, so the default was "short". Lately (gdb 7.3+) using the full path
seems to be more robust, so the default should be changed. Manual
overriding to "short" is still possible.

Change-Id: I9e857c86a63964bdacf9bebc5444ea752e5974f8
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Kai Koehne
2013-04-10 09:27:07 +02:00
committed by hjk
parent 21e7a6ecca
commit cb857b47a2
2 changed files with 25 additions and 2 deletions

View File

@@ -2480,6 +2480,8 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
} else if (child.hasName("pending")) { } else if (child.hasName("pending")) {
// Any content here would be interesting only if we did accept // Any content here would be interesting only if we did accept
// spontaneously appearing breakpoints (user using gdb commands). // spontaneously appearing breakpoints (user using gdb commands).
if (file.isEmpty())
file = child.data();
response.pending = true; response.pending = true;
} else if (child.hasName("at")) { } else if (child.hasName("at")) {
// Happens with gdb 6.4 symbianelf. // Happens with gdb 6.4 symbianelf.
@@ -2541,6 +2543,16 @@ QString GdbEngine::breakLocation(const QString &file) const
return where; return where;
} }
BreakpointPathUsage GdbEngine::defaultEngineBreakpointPathUsage() const
{
// e.g. MinGW gdb 70200 (part of Nokia Qt SDK)
// fails to set breakpoints with absolute paths if
// the source path isn't canonical
if (m_gdbVersion < 70300)
return BreakpointUseShortPath;
return BreakpointUseFullPath;
}
QByteArray GdbEngine::breakpointLocation(BreakpointModelId id) QByteArray GdbEngine::breakpointLocation(BreakpointModelId id)
{ {
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
@@ -2560,7 +2572,11 @@ QByteArray GdbEngine::breakpointLocation(BreakpointModelId id)
if (data.type == BreakpointByAddress) if (data.type == BreakpointByAddress)
return addressSpec(data.address); return addressSpec(data.address);
const QString fileName = data.pathUsage == BreakpointUseFullPath BreakpointPathUsage usage = data.pathUsage;
if (usage == BreakpointPathUsageEngineDefault)
usage = defaultEngineBreakpointPathUsage();
const QString fileName = usage == BreakpointUseFullPath
? data.fileName : breakLocation(data.fileName); ? data.fileName : breakLocation(data.fileName);
// The argument is simply a C-quoted version of the argument to the // The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants. // non-MI "break" command, including the "original" quoting it wants.
@@ -2571,8 +2587,14 @@ QByteArray GdbEngine::breakpointLocation(BreakpointModelId id)
QByteArray GdbEngine::breakpointLocation2(BreakpointModelId id) QByteArray GdbEngine::breakpointLocation2(BreakpointModelId id)
{ {
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
const BreakpointParameters &data = handler->breakpointData(id); const BreakpointParameters &data = handler->breakpointData(id);
const QString fileName = data.pathUsage == BreakpointUseFullPath
BreakpointPathUsage usage = data.pathUsage;
if (usage == BreakpointPathUsageEngineDefault)
usage = defaultEngineBreakpointPathUsage();
const QString fileName = usage == BreakpointUseFullPath
? data.fileName : breakLocation(data.fileName); ? data.fileName : breakLocation(data.fileName);
return GdbMi::escapeCString(fileName.toLocal8Bit()) + ':' return GdbMi::escapeCString(fileName.toLocal8Bit()) + ':'
+ QByteArray::number(data.lineNumber); + QByteArray::number(data.lineNumber);

View File

@@ -456,6 +456,7 @@ private: ////////// View & Data Stuff //////////
void handleInfoLine(const GdbResponse &response); void handleInfoLine(const GdbResponse &response);
void extractDataFromInfoBreak(const QString &output, BreakpointModelId); void extractDataFromInfoBreak(const QString &output, BreakpointModelId);
void updateResponse(BreakpointResponse &response, const GdbMi &bkpt); void updateResponse(BreakpointResponse &response, const GdbMi &bkpt);
BreakpointPathUsage defaultEngineBreakpointPathUsage() const;
QByteArray breakpointLocation(BreakpointModelId id); // For gdb/MI. QByteArray breakpointLocation(BreakpointModelId id); // For gdb/MI.
QByteArray breakpointLocation2(BreakpointModelId id); // For gdb/CLI fallback. QByteArray breakpointLocation2(BreakpointModelId id); // For gdb/CLI fallback.
QString breakLocation(const QString &file) const; QString breakLocation(const QString &file) const;