diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 038bdc16d59b778163b8482fd8b06e2516ecd2e2..e46c934b71170f2cc6b7919c83393dd4a90eee95 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -270,8 +270,8 @@ void BreakHandler::saveBreakpoints() map.insert(_("threadspec"), data.threadSpec); if (!data.enabled) map.insert(_("disabled"), one); - if (data.useFullPath) - map.insert(_("usefullpath"), one); + if (data.pathUsage != BreakpointPathUsageEngineDefault) + map.insert(_("usefullpath"), QString::number(data.pathUsage)); if (data.tracepoint) map.insert(_("tracepoint"), one); if (!data.module.isEmpty()) @@ -320,7 +320,7 @@ void BreakHandler::loadBreakpoints() data.enabled = !v.toInt(); v = map.value(_("usefullpath")); if (v.isValid()) - data.useFullPath = bool(v.toInt()); + data.pathUsage = static_cast<BreakpointPathUsage>(v.toInt()); v = map.value(_("tracepoint")); if (v.isValid()) data.tracepoint = bool(v.toInt()); @@ -585,7 +585,7 @@ void BreakHandler::setter(BreakpointId id, const type &value) \ SETTER(type, getter, setter) -PROPERTY(bool, useFullPath, setUseFullPath) +PROPERTY(BreakpointPathUsage, pathUsage, setPathUsage) PROPERTY(QString, fileName, setFileName) PROPERTY(QString, functionName, setFunctionName) PROPERTY(BreakpointType, type, setType) diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 34dbd26e97a8409f40187d64c8244977d9616279..4c191953a71a17dc9a64fc1a90bf7813d990f66e 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -106,8 +106,8 @@ public: // Getter retrieves property value. // Setter sets property value and triggers update if changed. - bool useFullPath(BreakpointId id) const; - void setUseFullPath(BreakpointId, const bool &on); + BreakpointPathUsage pathUsage(BreakpointId id) const; + void setPathUsage(BreakpointId, const BreakpointPathUsage &u); QByteArray condition(BreakpointId id) const; void setCondition(BreakpointId, const QByteArray &condition); int ignoreCount(BreakpointId id) const; diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index 06331dc8eefa7a801dfec30dbb2725c7bb4820ad..7dd21a7bc87aa791f88efff3f1b3a7e45a3e8506 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -52,7 +52,7 @@ namespace Internal { */ BreakpointParameters::BreakpointParameters(BreakpointType t) - : type(t), enabled(true), useFullPath(false), + : type(t), enabled(true), pathUsage(BreakpointPathUsageEngineDefault), ignoreCount(0), lineNumber(0), address(0), threadSpec(-1), tracepoint(false) {} @@ -61,7 +61,7 @@ bool BreakpointParameters::equals(const BreakpointParameters &rhs) const { return type == rhs.type && enabled == rhs.enabled - && useFullPath == rhs.useFullPath + && pathUsage == rhs.pathUsage && fileName == rhs.fileName && conditionsMatch(rhs.condition) && ignoreCount == rhs.ignoreCount @@ -94,7 +94,7 @@ QString BreakpointParameters::toString() const ts << " LineNumber: " << lineNumber; ts << " Address: " << address; ts << " FunctionName: " << functionName; - ts << " UseFullPath: " << useFullPath; + ts << " PathUsage: " << pathUsage; ts << " Tracepoint: " << tracepoint; ts << " Module: " << module; ts << " Command: " << command; diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h index a477e90b011b644c5f005b612693a670d356ad54..722adbacc5025855e495756539e8f7894b39e37e 100644 --- a/src/plugins/debugger/breakpoint.h +++ b/src/plugins/debugger/breakpoint.h @@ -76,6 +76,14 @@ enum BreakpointState BreakpointDead }; +//! \enum Debugger::Internal::BreakpointPathUsage +enum BreakpointPathUsage +{ + BreakpointPathUsageEngineDefault, //!< Default value that suits the engine. + BreakpointUseFullPath, //!< Use full path to avoid ambiguities. Slow with gdb. + BreakpointUseShortPath //!< Use filename only, in case source files are relocated. +}; + class BreakpointParameters { public: @@ -93,7 +101,7 @@ public: BreakpointType type; //!< Type of breakpoint. bool enabled; //!< Should we talk to the debugger engine? - bool useFullPath; //!< Should we use the full path when setting the bp? + BreakpointPathUsage pathUsage; //!< Should we use the full path when setting the bp? QString fileName; //!< Short name of source file. QByteArray condition; //!< Condition associated with breakpoint. int ignoreCount; //!< Ignore count associated with breakpoint. diff --git a/src/plugins/debugger/breakpoint.ui b/src/plugins/debugger/breakpoint.ui index 92dd5295c76fbdd172578ffd5203145c30157fc0..bbda2e2815caca1f444216d5cd083ee2900101ee 100644 --- a/src/plugins/debugger/breakpoint.ui +++ b/src/plugins/debugger/breakpoint.ui @@ -136,17 +136,10 @@ <item row="1" column="0"> <widget class="QLabel" name="labelUseFullPath"> <property name="text"> - <string>&Use full path:</string> + <string>Pat&h:</string> </property> <property name="buddy"> - <cstring>checkBoxUseFullPath</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="checkBoxUseFullPath"> - <property name="text"> - <string/> + <cstring>comboBoxPathUsage</cstring> </property> </widget> </item> @@ -176,6 +169,25 @@ <item row="3" column="1"> <widget class="QLineEdit" name="lineEditCommand"/> </item> + <item row="1" column="1"> + <widget class="QComboBox" name="comboBoxPathUsage"> + <item> + <property name="text"> + <string>Use Engine Default</string> + </property> + </item> + <item> + <property name="text"> + <string>Use Full Path</string> + </property> + </item> + <item> + <property name="text"> + <string>Use File Name</string> + </property> + </item> + </widget> + </item> </layout> </item> <item> @@ -212,7 +224,7 @@ <item row="2" column="0"> <widget class="QLabel" name="labelThreadSpec"> <property name="text"> - <string>T&hread specification:</string> + <string>&Thread specification:</string> </property> <property name="buddy"> <cstring>lineEditThreadSpec</cstring> diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 88d0e99ee5994c35f37cf4d1c88abd7b60d9f218..cf8b2beaa7f395d5e159e658037437db135d85cd 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -140,6 +140,17 @@ BreakpointDialog::BreakpointDialog(unsigned engineCapabilities, QWidget *parent) m_ui.labelCommand->setToolTip(commandToolTip); m_ui.spinBoxIgnoreCount->setMinimum(0); m_ui.spinBoxIgnoreCount->setMaximum(2147483647); + const QString pathToolTip = + tr("<html><head/><body><p>Determines how the path is specified when setting breakpoints:</p><ul>" + "<li><i>Use Engine Default</i>: Preferred setting of the debugger engine.</li>" + "<li><i>Use Full Path</i>: Pass full path, avoiding ambiguities should files of the same " + "name exist in several modules. This is the engine default for CDB and LLDB.</li>" + "<li><i>Use File Name</i>: Pass the file name only. This is useful " + "when using a source tree whose location does not match the one used when building the modules. " + "It is the engine default for gdb as using full paths can be slow with this engine.</li>" + "</ul></body></html>"); + m_ui.labelUseFullPath->setToolTip(pathToolTip); + m_ui.comboBoxPathUsage->setToolTip(pathToolTip); } void BreakpointDialog::setType(BreakpointType type) @@ -180,7 +191,7 @@ void BreakpointDialog::setPartsEnabled(unsigned partsMask) m_ui.labelLineNumber->setEnabled(partsMask & FileAndLinePart); m_ui.lineEditLineNumber->setEnabled(partsMask & FileAndLinePart); m_ui.labelUseFullPath->setEnabled(partsMask & FileAndLinePart); - m_ui.checkBoxUseFullPath->setEnabled(partsMask & FileAndLinePart); + m_ui.comboBoxPathUsage->setEnabled(partsMask & FileAndLinePart); m_ui.labelFunction->setEnabled(partsMask & FunctionPart); m_ui.lineEditFunction->setEnabled(partsMask & FunctionPart); @@ -205,7 +216,7 @@ void BreakpointDialog::clearOtherParts(unsigned partsMask) if (invertedPartsMask & FileAndLinePart) { m_ui.pathChooserFileName->setPath(QString()); m_ui.lineEditLineNumber->clear(); - m_ui.checkBoxUseFullPath->setChecked(false); + m_ui.comboBoxPathUsage->setCurrentIndex(BreakpointPathUsageEngineDefault); } if (invertedPartsMask & FunctionPart) @@ -232,7 +243,7 @@ void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data) if (partsMask & FileAndLinePart) { data->lineNumber = m_ui.lineEditLineNumber->text().toInt(); - data->useFullPath = m_ui.checkBoxUseFullPath->isChecked(); + data->pathUsage = static_cast<BreakpointPathUsage>(m_ui.comboBoxPathUsage->currentIndex()); data->fileName = m_ui.pathChooserFileName->path(); } if (partsMask & FunctionPart) @@ -255,7 +266,7 @@ void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data) void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data) { m_ui.checkBoxEnabled->setChecked(data.enabled); - m_ui.checkBoxUseFullPath->setChecked(data.useFullPath); + m_ui.comboBoxPathUsage->setCurrentIndex(data.pathUsage); m_ui.lineEditCommand->setText(data.command); if (mask & FileAndLinePart) { diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp index f6236e3d0fabefc6a667cffcd9b59a3abe3dcc8d..5e3c7b07399d638b68d6ef4684f43533f35b236d 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp @@ -97,7 +97,12 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn, str << '`'; if (!bp.module.isEmpty()) str << bp.module << '!'; - str << QDir::toNativeSeparators(bp.fileName) << ':' << bp.lineNumber << '`'; + if (bp.pathUsage == BreakpointUseShortPath) { + str << QFileInfo(bp.fileName).fileName(); + } else { + str << QDir::toNativeSeparators(bp.fileName); + } + str << ':' << bp.lineNumber << '`'; break; case Watchpoint: str << "rw 1 " << hex << hexPrefixOn << bp.address << hexPrefixOff << dec; diff --git a/src/plugins/debugger/debuggerstreamops.cpp b/src/plugins/debugger/debuggerstreamops.cpp index d95f592b8821e4b61af938f6c8414ee719d67c3a..75cab5badff30e821cb8ce66e3f3dd4adf4d20fa 100644 --- a/src/plugins/debugger/debuggerstreamops.cpp +++ b/src/plugins/debugger/debuggerstreamops.cpp @@ -184,7 +184,7 @@ QDataStream &operator<<(QDataStream &stream, const BreakpointParameters &s) stream << quint64(s.lineNumber); stream << quint64(s.address); stream << s.functionName; - stream << s.useFullPath; + stream << int(s.pathUsage); stream << s.tracepoint; stream << s.module; stream << s.command; @@ -203,7 +203,7 @@ QDataStream &operator>>(QDataStream &stream, BreakpointParameters &s) stream >> t; s.lineNumber = t; stream >> t; s.address = t; stream >> str; s.functionName = str; - stream >> b; s.useFullPath = b; + stream >> t; s.pathUsage = static_cast<BreakpointPathUsage>(t); stream >> b; s.tracepoint = b; stream >> str ; s.module = str; stream >> str ; s.command = str; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index b95ecb5e2b0976334dc9cc915e9ea7bb1d8db42e..8f3a66cfa4bf06c297880d9d0632e3cde4094738 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2251,7 +2251,7 @@ QByteArray GdbEngine::breakpointLocation(BreakpointId id) if (data.type == BreakpointByAddress) return addressSpec(data.address); - const QString fileName = data.useFullPath + const QString fileName = data.pathUsage == 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.