Commit e612e663 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Add a module to breakpoint.

To speed up CDB, lldb. Add to dialogs, serialize.
Move breakpoint.ui into Debugger::Internal, add buddies.

Rubber-stamped-by: hjk
parent 285d216b
......@@ -178,7 +178,7 @@ public:
static WatchesSymbolGroup *create(CIDebugSymbols *, std::string *errorMessage);
static inline std::string fixWatchExpression(CIDebugSymbols *s, const std::string &ex);
static std::string fixWatchExpression(CIDebugSymbols *s, const std::string &ex);
private:
explicit WatchesSymbolGroup(CIDebugSymbolGroup *);
......
......@@ -241,6 +241,7 @@ bool BreakHandler::hasWatchpointAt(quint64 address) const
void BreakHandler::saveBreakpoints()
{
const QString one = _("1");
//qDebug() << "SAVING BREAKPOINTS...";
QTC_ASSERT(debuggerCore(), return);
QList<QVariant> list;
......@@ -268,11 +269,13 @@ void BreakHandler::saveBreakpoints()
if (data.threadSpec >= 0)
map.insert(_("threadspec"), data.threadSpec);
if (!data.enabled)
map.insert(_("disabled"), _("1"));
map.insert(_("disabled"), one);
if (data.useFullPath)
map.insert(_("usefullpath"), _("1"));
map.insert(_("usefullpath"), one);
if (data.tracepoint)
map.insert(_("tracepoint"), _("1"));
map.insert(_("tracepoint"), one);
if (!data.module.isEmpty())
map.insert(_("module"), data.module);
list.append(map);
}
debuggerCore()->setSessionValue("Breakpoints", list);
......@@ -322,6 +325,9 @@ void BreakHandler::loadBreakpoints()
v = map.value(_("type"));
if (v.isValid() && v.toInt() != UnknownType)
data.type = BreakpointType(v.toInt());
v = map.value(_("module"));
if (v.isValid())
data.module = v.toString();
appendBreakpoint(data);
}
//qDebug() << "LOADED BREAKPOINTS" << this << list.size();
......@@ -1163,12 +1169,15 @@ QString BreakHandler::BreakpointItem::toToolTip() const
<< "</th><th>" << tr("Requested")
<< "</th><th>" << tr("Obtained") << "</th></tr>"
<< "<tr><td>" << tr("Internal Number:")
<< "</td><td>&mdash;</td><td>" << response.number << "</td></tr>"
<< "<tr><td>" << tr("Function Name:")
<< "</td><td>&mdash;</td><td>" << response.number << "</td></tr>";
if (data.type == BreakpointByFunction) {
str << "<tr><td>" << tr("Function Name:")
<< "</td><td>" << data.functionName
<< "</td><td>" << response.functionName
<< "</td></tr>"
<< "<tr><td>" << tr("File Name:")
<< "</td></tr>";
}
if (data.type == BreakpointByFileAndLine) {
str << "<tr><td>" << tr("File Name:")
<< "</td><td>" << QDir::toNativeSeparators(data.fileName)
<< "</td><td>" << QDir::toNativeSeparators(response.fileName)
<< "</td></tr>"
......@@ -1177,8 +1186,15 @@ QString BreakHandler::BreakpointItem::toToolTip() const
<< "</td><td>" << response.lineNumber << "</td></tr>"
<< "<tr><td>" << tr("Corrected Line Number:")
<< "</td><td>-"
<< "</td><td>" << response.correctedLineNumber << "</td></tr>"
<< "<tr><td>" << tr("Breakpoint Address:")
<< "</td><td>" << response.correctedLineNumber << "</td></tr>";
}
if (data.type == BreakpointByFunction || data.type == BreakpointByFileAndLine) {
str << "<tr><td>" << tr("Module:")
<< "</td><td>" << data.module
<< "</td><td>" << response.module
<< "</td></tr>";
}
str << "<tr><td>" << tr("Breakpoint Address:")
<< "</td><td>";
formatAddress(str, data.address);
str << "</td><td>";
......
......@@ -63,7 +63,8 @@ bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
&& address == rhs.address
&& threadSpec == rhs.threadSpec
&& functionName == rhs.functionName
&& tracepoint == rhs.tracepoint;
&& tracepoint == rhs.tracepoint
&& module == rhs.module;
}
bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
......@@ -88,10 +89,10 @@ QString BreakpointParameters::toString() const
ts << " FunctionName: " << functionName;
ts << " UseFullPath: " << useFullPath;
ts << " Tracepoint: " << tracepoint;
ts << " Module: " << module;
return result;
}
//////////////////////////////////////////////////////////////////
//
// BreakpointParameters
......
......@@ -99,6 +99,7 @@ public:
quint64 address; // Address for watchpoints.
int threadSpec; // Thread specification.
QString functionName;
QString module; // module for file name
bool tracepoint;
};
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger::Internal::BreakpointDialog</class>
<widget class="QDialog" name="BreakpointDialog">
<widget class="QDialog" name="Debugger::Internal::BreakpointDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>558</width>
<height>302</height>
<width>700</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
......@@ -19,7 +19,10 @@
<item row="0" column="0">
<widget class="QLabel" name="labelType">
<property name="text">
<string>Breakpoint type:</string>
<string>Breakpoint &amp;type:</string>
</property>
<property name="buddy">
<cstring>comboBoxType</cstring>
</property>
</widget>
</item>
......@@ -29,17 +32,23 @@
<item row="1" column="0">
<widget class="QLabel" name="labelFileName">
<property name="text">
<string>File name:</string>
<string>&amp;File name:</string>
</property>
<property name="buddy">
<cstring>pathChooserFileName</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Utils::PathChooser" name="pathChooserFileName"/>
<widget class="Utils::PathChooser" name="pathChooserFileName" native="true"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelLineNumber">
<property name="text">
<string>Line number:</string>
<string>&amp;Line number:</string>
</property>
<property name="buddy">
<cstring>lineEditLineNumber</cstring>
</property>
</widget>
</item>
......@@ -56,7 +65,10 @@
<item row="3" column="0">
<widget class="QLabel" name="labelEnabled">
<property name="text">
<string>Enabled:</string>
<string>&amp;Enabled:</string>
</property>
<property name="buddy">
<cstring>checkBoxEnabled</cstring>
</property>
</widget>
</item>
......@@ -70,14 +82,20 @@
<item row="4" column="0">
<widget class="QLabel" name="labelUseFullPath">
<property name="text">
<string>Use full path:</string>
<string>&amp;Use full path:</string>
</property>
<property name="buddy">
<cstring>checkBoxUseFullPath</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelAddress">
<property name="text">
<string>Address:</string>
<string>&amp;Address:</string>
</property>
<property name="buddy">
<cstring>lineEditAddress</cstring>
</property>
</widget>
</item>
......@@ -87,57 +105,85 @@
<item row="6" column="0">
<widget class="QLabel" name="labelFunction">
<property name="text">
<string>Function:</string>
<string>Fun&amp;ction:</string>
</property>
<property name="buddy">
<cstring>lineEditFunction</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEditFunction"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="labelCondition">
<property name="text">
<string>Condition:</string>
<string>&amp;Condition:</string>
</property>
<property name="buddy">
<cstring>lineEditCondition</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QLineEdit" name="lineEditCondition"/>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="labelIgnoreCount">
<property name="text">
<string>Ignore count:</string>
<string>&amp;Ignore count:</string>
</property>
<property name="buddy">
<cstring>lineEditIgnoreCount</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QLineEdit" name="lineEditIgnoreCount"/>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="labelThreadSpec">
<property name="text">
<string>Thread specification:</string>
<string>&amp;Thread specification:</string>
</property>
<property name="buddy">
<cstring>lineEditThreadSpec</cstring>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="QLineEdit" name="lineEditThreadSpec"/>
</item>
<item row="10" column="1">
<item row="11" column="1">
<widget class="QCheckBox" name="checkBoxTracepoint">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="10" column="0">
<item row="11" column="0">
<widget class="QLabel" name="labelTracepoint">
<property name="text">
<string>Tracepoint only:</string>
<string>T&amp;racepoint only:</string>
</property>
<property name="buddy">
<cstring>checkBoxTracepoint</cstring>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelModule">
<property name="text">
<string>&amp;Module:</string>
</property>
<property name="buddy">
<cstring>lineEditModule</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="lineEditModule"/>
</item>
</layout>
</item>
<item>
......@@ -145,12 +191,6 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
......@@ -170,7 +210,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>BreakpointDialog</receiver>
<receiver>Debugger::Internal::BreakpointDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
......@@ -186,7 +226,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>BreakpointDialog</receiver>
<receiver>Debugger::Internal::BreakpointDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
......
......@@ -85,7 +85,8 @@ private:
FunctionPart = 0x2,
AddressPart = 0x4,
ConditionPart = 0x8,
AllParts = FileAndLinePart|FunctionPart|AddressPart|ConditionPart
ModulePart = 0x10,
AllParts = FileAndLinePart|FunctionPart|AddressPart|ConditionPart|ModulePart
};
void setPartsEnabled(unsigned partsMask);
......@@ -168,28 +169,33 @@ void BreakpointDialog::setPartsEnabled(unsigned partsMask)
m_ui.lineEditCondition->setEnabled(partsMask & ConditionPart);
m_ui.lineEditIgnoreCount->setEnabled(partsMask & ConditionPart);
m_ui.lineEditThreadSpec->setEnabled(partsMask & ConditionPart);
m_ui.labelModule->setEnabled(partsMask & ModulePart);
m_ui.lineEditModule->setEnabled(partsMask & ModulePart);
}
void BreakpointDialog::clearOtherParts(unsigned partsMask)
{
partsMask = ~partsMask;
if (partsMask & FileAndLinePart) {
const unsigned inversedPartsMask = ~partsMask;
if (inversedPartsMask & FileAndLinePart) {
m_ui.pathChooserFileName->setPath(QString());
m_ui.lineEditLineNumber->clear();
m_ui.checkBoxUseFullPath->setChecked(false);
}
if (partsMask & FunctionPart)
if (inversedPartsMask & FunctionPart)
m_ui.lineEditFunction->clear();
if (partsMask & AddressPart)
if (inversedPartsMask & AddressPart)
m_ui.lineEditAddress->clear();
if (partsMask & ConditionPart) {
m_ui.lineEditCondition->setText(QString());
m_ui.lineEditIgnoreCount->setText(QString());
m_ui.lineEditThreadSpec->setText(QString());
if (inversedPartsMask & ConditionPart) {
m_ui.lineEditCondition->clear();
m_ui.lineEditIgnoreCount->clear();
m_ui.lineEditThreadSpec->clear();
}
if (inversedPartsMask & ModulePart)
m_ui.lineEditModule->clear();
}
void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data) const
......@@ -214,6 +220,8 @@ void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data)
data->threadSpec =
BreakHandler::threadSpecFromDisplay(m_ui.lineEditThreadSpec->text());
}
if (partsMask & ModulePart)
data->module = m_ui.lineEditModule->text();
}
void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
......@@ -245,6 +253,8 @@ void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
m_ui.lineEditThreadSpec->
setText(BreakHandler::displayFromThreadSpec(data.threadSpec));
}
if (mask & ModulePart)
m_ui.lineEditModule->setText(data.module);
}
void BreakpointDialog::typeChanged(int)
......@@ -257,10 +267,10 @@ void BreakpointDialog::typeChanged(int)
case UnknownType:
break;
case BreakpointByFileAndLine:
getParts(FileAndLinePart, &m_savedParameters);
getParts(FileAndLinePart|ModulePart, &m_savedParameters);
break;
case BreakpointByFunction:
getParts(FunctionPart, &m_savedParameters);
getParts(FunctionPart|ModulePart, &m_savedParameters);
break;
case BreakpointAtThrow:
case BreakpointAtCatch:
......@@ -277,18 +287,18 @@ void BreakpointDialog::typeChanged(int)
case UnknownType:
break;
case BreakpointByFileAndLine:
setParts(FileAndLinePart|ConditionPart, m_savedParameters);
setPartsEnabled(FileAndLinePart|ConditionPart);
clearOtherParts(FileAndLinePart|ConditionPart);
setParts(FileAndLinePart|ConditionPart|ModulePart, m_savedParameters);
setPartsEnabled(FileAndLinePart|ConditionPart|ModulePart);
clearOtherParts(FileAndLinePart|ConditionPart|ModulePart);
break;
case BreakpointByFunction:
setParts(FunctionPart|ConditionPart, m_savedParameters);
setPartsEnabled(FunctionPart|ConditionPart);
clearOtherParts(FunctionPart|ConditionPart);
setParts(FunctionPart|ConditionPart|ModulePart, m_savedParameters);
setPartsEnabled(FunctionPart|ConditionPart|ModulePart);
clearOtherParts(FunctionPart|ConditionPart|ModulePart);
break;
case BreakpointAtThrow:
case BreakpointAtCatch:
clearOtherParts(ConditionPart);
clearOtherParts(ConditionPart|ModulePart);
setPartsEnabled(ConditionPart);
break;
case BreakpointAtMain:
......
......@@ -85,10 +85,15 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn, bool onesho
str << hex << hexPrefixOn << bp.address << hexPrefixOff << dec;
break;
case BreakpointByFunction:
if (!bp.module.isEmpty())
str << bp.module << '!';
str << bp.functionName;
break;
case BreakpointByFileAndLine:
str << '`' << QDir::toNativeSeparators(bp.fileName) << ':' << bp.lineNumber << '`';
str << '`';
if (!bp.module.isEmpty())
str << bp.module << '!';
str << QDir::toNativeSeparators(bp.fileName) << ':' << bp.lineNumber << '`';
break;
case Watchpoint:
str << "rw 1 " << hex << hexPrefixOn << bp.address << hexPrefixOff << dec;
......
......@@ -186,6 +186,7 @@ QDataStream &operator<<(QDataStream &stream, const BreakpointParameters &s)
stream << s.functionName;
stream << s.useFullPath;
stream << s.tracepoint;
stream << s.module;
return stream;
}
......@@ -203,6 +204,7 @@ QDataStream &operator>>(QDataStream &stream, BreakpointParameters &s)
stream >> str; s.functionName = str;
stream >> b; s.useFullPath = b;
stream >> b; s.tracepoint = b;
stream >> str ; s.module = str;
return stream;
}
......
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