diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 459d11da3dbb3869cda3b1243216e3ba3eaed9e8..2095f8a86420efc21ba19a6964d6cfc90e6ac4b1 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -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); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 1a4d77c580d37d043982cea3f0a4590d89df7f34..6d50c9f1fd7db2992854b53e8cc63703518454e7 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -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;