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
This commit is contained in:
Friedemann Kleint
2011-02-02 14:41:14 +01:00
parent 285d216bed
commit e612e6636b
8 changed files with 142 additions and 67 deletions

View File

@@ -178,7 +178,7 @@ public:
static WatchesSymbolGroup *create(CIDebugSymbols *, std::string *errorMessage); 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: private:
explicit WatchesSymbolGroup(CIDebugSymbolGroup *); explicit WatchesSymbolGroup(CIDebugSymbolGroup *);

View File

@@ -241,6 +241,7 @@ bool BreakHandler::hasWatchpointAt(quint64 address) const
void BreakHandler::saveBreakpoints() void BreakHandler::saveBreakpoints()
{ {
const QString one = _("1");
//qDebug() << "SAVING BREAKPOINTS..."; //qDebug() << "SAVING BREAKPOINTS...";
QTC_ASSERT(debuggerCore(), return); QTC_ASSERT(debuggerCore(), return);
QList<QVariant> list; QList<QVariant> list;
@@ -268,11 +269,13 @@ void BreakHandler::saveBreakpoints()
if (data.threadSpec >= 0) if (data.threadSpec >= 0)
map.insert(_("threadspec"), data.threadSpec); map.insert(_("threadspec"), data.threadSpec);
if (!data.enabled) if (!data.enabled)
map.insert(_("disabled"), _("1")); map.insert(_("disabled"), one);
if (data.useFullPath) if (data.useFullPath)
map.insert(_("usefullpath"), _("1")); map.insert(_("usefullpath"), one);
if (data.tracepoint) if (data.tracepoint)
map.insert(_("tracepoint"), _("1")); map.insert(_("tracepoint"), one);
if (!data.module.isEmpty())
map.insert(_("module"), data.module);
list.append(map); list.append(map);
} }
debuggerCore()->setSessionValue("Breakpoints", list); debuggerCore()->setSessionValue("Breakpoints", list);
@@ -322,6 +325,9 @@ void BreakHandler::loadBreakpoints()
v = map.value(_("type")); v = map.value(_("type"));
if (v.isValid() && v.toInt() != UnknownType) if (v.isValid() && v.toInt() != UnknownType)
data.type = BreakpointType(v.toInt()); data.type = BreakpointType(v.toInt());
v = map.value(_("module"));
if (v.isValid())
data.module = v.toString();
appendBreakpoint(data); appendBreakpoint(data);
} }
//qDebug() << "LOADED BREAKPOINTS" << this << list.size(); //qDebug() << "LOADED BREAKPOINTS" << this << list.size();
@@ -1163,12 +1169,15 @@ QString BreakHandler::BreakpointItem::toToolTip() const
<< "</th><th>" << tr("Requested") << "</th><th>" << tr("Requested")
<< "</th><th>" << tr("Obtained") << "</th></tr>" << "</th><th>" << tr("Obtained") << "</th></tr>"
<< "<tr><td>" << tr("Internal Number:") << "<tr><td>" << tr("Internal Number:")
<< "</td><td>&mdash;</td><td>" << response.number << "</td></tr>" << "</td><td>&mdash;</td><td>" << response.number << "</td></tr>";
<< "<tr><td>" << tr("Function Name:") if (data.type == BreakpointByFunction) {
str << "<tr><td>" << tr("Function Name:")
<< "</td><td>" << data.functionName << "</td><td>" << data.functionName
<< "</td><td>" << response.functionName << "</td><td>" << response.functionName
<< "</td></tr>" << "</td></tr>";
<< "<tr><td>" << tr("File Name:") }
if (data.type == BreakpointByFileAndLine) {
str << "<tr><td>" << tr("File Name:")
<< "</td><td>" << QDir::toNativeSeparators(data.fileName) << "</td><td>" << QDir::toNativeSeparators(data.fileName)
<< "</td><td>" << QDir::toNativeSeparators(response.fileName) << "</td><td>" << QDir::toNativeSeparators(response.fileName)
<< "</td></tr>" << "</td></tr>"
@@ -1177,8 +1186,15 @@ QString BreakHandler::BreakpointItem::toToolTip() const
<< "</td><td>" << response.lineNumber << "</td></tr>" << "</td><td>" << response.lineNumber << "</td></tr>"
<< "<tr><td>" << tr("Corrected Line Number:") << "<tr><td>" << tr("Corrected Line Number:")
<< "</td><td>-" << "</td><td>-"
<< "</td><td>" << response.correctedLineNumber << "</td></tr>" << "</td><td>" << response.correctedLineNumber << "</td></tr>";
<< "<tr><td>" << tr("Breakpoint Address:") }
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>"; << "</td><td>";
formatAddress(str, data.address); formatAddress(str, data.address);
str << "</td><td>"; str << "</td><td>";

View File

@@ -63,7 +63,8 @@ bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
&& address == rhs.address && address == rhs.address
&& threadSpec == rhs.threadSpec && threadSpec == rhs.threadSpec
&& functionName == rhs.functionName && functionName == rhs.functionName
&& tracepoint == rhs.tracepoint; && tracepoint == rhs.tracepoint
&& module == rhs.module;
} }
bool BreakpointParameters::conditionsMatch(const QByteArray &other) const bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
@@ -88,10 +89,10 @@ QString BreakpointParameters::toString() const
ts << " FunctionName: " << functionName; ts << " FunctionName: " << functionName;
ts << " UseFullPath: " << useFullPath; ts << " UseFullPath: " << useFullPath;
ts << " Tracepoint: " << tracepoint; ts << " Tracepoint: " << tracepoint;
ts << " Module: " << module;
return result; return result;
} }
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //
// BreakpointParameters // BreakpointParameters

View File

@@ -99,6 +99,7 @@ public:
quint64 address; // Address for watchpoints. quint64 address; // Address for watchpoints.
int threadSpec; // Thread specification. int threadSpec; // Thread specification.
QString functionName; QString functionName;
QString module; // module for file name
bool tracepoint; bool tracepoint;
}; };

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>Debugger::Internal::BreakpointDialog</class> <class>Debugger::Internal::BreakpointDialog</class>
<widget class="QDialog" name="BreakpointDialog"> <widget class="QDialog" name="Debugger::Internal::BreakpointDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>558</width> <width>700</width>
<height>302</height> <height>401</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -19,7 +19,10 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="labelType"> <widget class="QLabel" name="labelType">
<property name="text"> <property name="text">
<string>Breakpoint type:</string> <string>Breakpoint &amp;type:</string>
</property>
<property name="buddy">
<cstring>comboBoxType</cstring>
</property> </property>
</widget> </widget>
</item> </item>
@@ -29,17 +32,23 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="labelFileName"> <widget class="QLabel" name="labelFileName">
<property name="text"> <property name="text">
<string>File name:</string> <string>&amp;File name:</string>
</property>
<property name="buddy">
<cstring>pathChooserFileName</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="Utils::PathChooser" name="pathChooserFileName"/> <widget class="Utils::PathChooser" name="pathChooserFileName" native="true"/>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="labelLineNumber"> <widget class="QLabel" name="labelLineNumber">
<property name="text"> <property name="text">
<string>Line number:</string> <string>&amp;Line number:</string>
</property>
<property name="buddy">
<cstring>lineEditLineNumber</cstring>
</property> </property>
</widget> </widget>
</item> </item>
@@ -56,7 +65,10 @@
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="labelEnabled"> <widget class="QLabel" name="labelEnabled">
<property name="text"> <property name="text">
<string>Enabled:</string> <string>&amp;Enabled:</string>
</property>
<property name="buddy">
<cstring>checkBoxEnabled</cstring>
</property> </property>
</widget> </widget>
</item> </item>
@@ -70,14 +82,20 @@
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="labelUseFullPath"> <widget class="QLabel" name="labelUseFullPath">
<property name="text"> <property name="text">
<string>Use full path:</string> <string>&amp;Use full path:</string>
</property>
<property name="buddy">
<cstring>checkBoxUseFullPath</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="labelAddress"> <widget class="QLabel" name="labelAddress">
<property name="text"> <property name="text">
<string>Address:</string> <string>&amp;Address:</string>
</property>
<property name="buddy">
<cstring>lineEditAddress</cstring>
</property> </property>
</widget> </widget>
</item> </item>
@@ -87,57 +105,85 @@
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="labelFunction"> <widget class="QLabel" name="labelFunction">
<property name="text"> <property name="text">
<string>Function:</string> <string>Fun&amp;ction:</string>
</property>
<property name="buddy">
<cstring>lineEditFunction</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QLineEdit" name="lineEditFunction"/> <widget class="QLineEdit" name="lineEditFunction"/>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<widget class="QLabel" name="labelCondition"> <widget class="QLabel" name="labelCondition">
<property name="text"> <property name="text">
<string>Condition:</string> <string>&amp;Condition:</string>
</property> </property>
</widget> <property name="buddy">
</item> <cstring>lineEditCondition</cstring>
<item row="7" column="1">
<widget class="QLineEdit" name="lineEditCondition"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="labelIgnoreCount">
<property name="text">
<string>Ignore count:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="8" column="1">
<widget class="QLineEdit" name="lineEditIgnoreCount"/> <widget class="QLineEdit" name="lineEditCondition"/>
</item> </item>
<item row="9" column="0"> <item row="9" column="0">
<widget class="QLabel" name="labelThreadSpec"> <widget class="QLabel" name="labelIgnoreCount">
<property name="text"> <property name="text">
<string>Thread specification:</string> <string>&amp;Ignore count:</string>
</property>
<property name="buddy">
<cstring>lineEditIgnoreCount</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="9" column="1">
<widget class="QLineEdit" name="lineEditThreadSpec"/> <widget class="QLineEdit" name="lineEditIgnoreCount"/>
</item>
<item row="10" column="0">
<widget class="QLabel" name="labelThreadSpec">
<property name="text">
<string>&amp;Thread specification:</string>
</property>
<property name="buddy">
<cstring>lineEditThreadSpec</cstring>
</property>
</widget>
</item> </item>
<item row="10" column="1"> <item row="10" column="1">
<widget class="QLineEdit" name="lineEditThreadSpec"/>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="checkBoxTracepoint"> <widget class="QCheckBox" name="checkBoxTracepoint">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="11" column="0">
<widget class="QLabel" name="labelTracepoint"> <widget class="QLabel" name="labelTracepoint">
<property name="text"> <property name="text">
<string>Tracepoint only:</string> <string>T&amp;racepoint only:</string>
</property>
<property name="buddy">
<cstring>checkBoxTracepoint</cstring>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>
@@ -145,12 +191,6 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer> </spacer>
</item> </item>
<item> <item>
@@ -170,7 +210,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>BreakpointDialog</receiver> <receiver>Debugger::Internal::BreakpointDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@@ -186,7 +226,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>BreakpointDialog</receiver> <receiver>Debugger::Internal::BreakpointDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

View File

@@ -85,7 +85,8 @@ private:
FunctionPart = 0x2, FunctionPart = 0x2,
AddressPart = 0x4, AddressPart = 0x4,
ConditionPart = 0x8, ConditionPart = 0x8,
AllParts = FileAndLinePart|FunctionPart|AddressPart|ConditionPart ModulePart = 0x10,
AllParts = FileAndLinePart|FunctionPart|AddressPart|ConditionPart|ModulePart
}; };
void setPartsEnabled(unsigned partsMask); void setPartsEnabled(unsigned partsMask);
@@ -168,28 +169,33 @@ void BreakpointDialog::setPartsEnabled(unsigned partsMask)
m_ui.lineEditCondition->setEnabled(partsMask & ConditionPart); m_ui.lineEditCondition->setEnabled(partsMask & ConditionPart);
m_ui.lineEditIgnoreCount->setEnabled(partsMask & ConditionPart); m_ui.lineEditIgnoreCount->setEnabled(partsMask & ConditionPart);
m_ui.lineEditThreadSpec->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) void BreakpointDialog::clearOtherParts(unsigned partsMask)
{ {
partsMask = ~partsMask; const unsigned inversedPartsMask = ~partsMask;
if (partsMask & FileAndLinePart) { if (inversedPartsMask & FileAndLinePart) {
m_ui.pathChooserFileName->setPath(QString()); m_ui.pathChooserFileName->setPath(QString());
m_ui.lineEditLineNumber->clear(); m_ui.lineEditLineNumber->clear();
m_ui.checkBoxUseFullPath->setChecked(false); m_ui.checkBoxUseFullPath->setChecked(false);
} }
if (partsMask & FunctionPart) if (inversedPartsMask & FunctionPart)
m_ui.lineEditFunction->clear(); m_ui.lineEditFunction->clear();
if (partsMask & AddressPart) if (inversedPartsMask & AddressPart)
m_ui.lineEditAddress->clear(); m_ui.lineEditAddress->clear();
if (partsMask & ConditionPart) { if (inversedPartsMask & ConditionPart) {
m_ui.lineEditCondition->setText(QString()); m_ui.lineEditCondition->clear();
m_ui.lineEditIgnoreCount->setText(QString()); m_ui.lineEditIgnoreCount->clear();
m_ui.lineEditThreadSpec->setText(QString()); m_ui.lineEditThreadSpec->clear();
} }
if (inversedPartsMask & ModulePart)
m_ui.lineEditModule->clear();
} }
void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data) const void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data) const
@@ -214,6 +220,8 @@ void BreakpointDialog::getParts(unsigned partsMask, BreakpointParameters *data)
data->threadSpec = data->threadSpec =
BreakHandler::threadSpecFromDisplay(m_ui.lineEditThreadSpec->text()); BreakHandler::threadSpecFromDisplay(m_ui.lineEditThreadSpec->text());
} }
if (partsMask & ModulePart)
data->module = m_ui.lineEditModule->text();
} }
void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data) void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
@@ -245,6 +253,8 @@ void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
m_ui.lineEditThreadSpec-> m_ui.lineEditThreadSpec->
setText(BreakHandler::displayFromThreadSpec(data.threadSpec)); setText(BreakHandler::displayFromThreadSpec(data.threadSpec));
} }
if (mask & ModulePart)
m_ui.lineEditModule->setText(data.module);
} }
void BreakpointDialog::typeChanged(int) void BreakpointDialog::typeChanged(int)
@@ -257,10 +267,10 @@ void BreakpointDialog::typeChanged(int)
case UnknownType: case UnknownType:
break; break;
case BreakpointByFileAndLine: case BreakpointByFileAndLine:
getParts(FileAndLinePart, &m_savedParameters); getParts(FileAndLinePart|ModulePart, &m_savedParameters);
break; break;
case BreakpointByFunction: case BreakpointByFunction:
getParts(FunctionPart, &m_savedParameters); getParts(FunctionPart|ModulePart, &m_savedParameters);
break; break;
case BreakpointAtThrow: case BreakpointAtThrow:
case BreakpointAtCatch: case BreakpointAtCatch:
@@ -277,18 +287,18 @@ void BreakpointDialog::typeChanged(int)
case UnknownType: case UnknownType:
break; break;
case BreakpointByFileAndLine: case BreakpointByFileAndLine:
setParts(FileAndLinePart|ConditionPart, m_savedParameters); setParts(FileAndLinePart|ConditionPart|ModulePart, m_savedParameters);
setPartsEnabled(FileAndLinePart|ConditionPart); setPartsEnabled(FileAndLinePart|ConditionPart|ModulePart);
clearOtherParts(FileAndLinePart|ConditionPart); clearOtherParts(FileAndLinePart|ConditionPart|ModulePart);
break; break;
case BreakpointByFunction: case BreakpointByFunction:
setParts(FunctionPart|ConditionPart, m_savedParameters); setParts(FunctionPart|ConditionPart|ModulePart, m_savedParameters);
setPartsEnabled(FunctionPart|ConditionPart); setPartsEnabled(FunctionPart|ConditionPart|ModulePart);
clearOtherParts(FunctionPart|ConditionPart); clearOtherParts(FunctionPart|ConditionPart|ModulePart);
break; break;
case BreakpointAtThrow: case BreakpointAtThrow:
case BreakpointAtCatch: case BreakpointAtCatch:
clearOtherParts(ConditionPart); clearOtherParts(ConditionPart|ModulePart);
setPartsEnabled(ConditionPart); setPartsEnabled(ConditionPart);
break; break;
case BreakpointAtMain: case BreakpointAtMain:

View File

@@ -85,10 +85,15 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn, bool onesho
str << hex << hexPrefixOn << bp.address << hexPrefixOff << dec; str << hex << hexPrefixOn << bp.address << hexPrefixOff << dec;
break; break;
case BreakpointByFunction: case BreakpointByFunction:
if (!bp.module.isEmpty())
str << bp.module << '!';
str << bp.functionName; str << bp.functionName;
break; break;
case BreakpointByFileAndLine: 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; break;
case Watchpoint: case Watchpoint:
str << "rw 1 " << hex << hexPrefixOn << bp.address << hexPrefixOff << dec; str << "rw 1 " << hex << hexPrefixOn << bp.address << hexPrefixOff << dec;

View File

@@ -186,6 +186,7 @@ QDataStream &operator<<(QDataStream &stream, const BreakpointParameters &s)
stream << s.functionName; stream << s.functionName;
stream << s.useFullPath; stream << s.useFullPath;
stream << s.tracepoint; stream << s.tracepoint;
stream << s.module;
return stream; return stream;
} }
@@ -203,6 +204,7 @@ QDataStream &operator>>(QDataStream &stream, BreakpointParameters &s)
stream >> str; s.functionName = str; stream >> str; s.functionName = str;
stream >> b; s.useFullPath = b; stream >> b; s.useFullPath = b;
stream >> b; s.tracepoint = b; stream >> b; s.tracepoint = b;
stream >> str ; s.module = str;
return stream; return stream;
} }