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")) {
// Any content here would be interesting only if we did accept
// spontaneously appearing breakpoints (user using gdb commands).
if (file.isEmpty())
file = child.data();
response.pending = true;
} else if (child.hasName("at")) {
// Happens with gdb 6.4 symbianelf.
@@ -2541,6 +2543,16 @@ QString GdbEngine::breakLocation(const QString &file) const
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)
{
BreakHandler *handler = breakHandler();
@@ -2560,7 +2572,11 @@ QByteArray GdbEngine::breakpointLocation(BreakpointModelId id)
if (data.type == BreakpointByAddress)
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);
// The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants.
@@ -2571,8 +2587,14 @@ QByteArray GdbEngine::breakpointLocation(BreakpointModelId id)
QByteArray GdbEngine::breakpointLocation2(BreakpointModelId id)
{
BreakHandler *handler = breakHandler();
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);
return GdbMi::escapeCString(fileName.toLocal8Bit()) + ':'
+ QByteArray::number(data.lineNumber);