forked from qt-creator/qt-creator
Debugger: Change UseFullPath setting to an enumeration.
Introducing EngineDefault such that CDB/LLDB can use full paths by default and gdb can use short paths. Reviewed-by: hjk
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user