Commit cb857b47 authored by Kai Koehne's avatar Kai Koehne Committed by hjk

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: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent 21e7a6ec
......@@ -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);
......
......@@ -456,6 +456,7 @@ private: ////////// View & Data Stuff //////////
void handleInfoLine(const GdbResponse &response);
void extractDataFromInfoBreak(const QString &output, BreakpointModelId);
void updateResponse(BreakpointResponse &response, const GdbMi &bkpt);
BreakpointPathUsage defaultEngineBreakpointPathUsage() const;
QByteArray breakpointLocation(BreakpointModelId id); // For gdb/MI.
QByteArray breakpointLocation2(BreakpointModelId id); // For gdb/CLI fallback.
QString breakLocation(const QString &file) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment