From e612e6636b42c24aa2e6b31317b4b49d4416c10e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 2 Feb 2011 14:41:14 +0100 Subject: 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 --- src/libs/qtcreatorcdbext/symbolgroup.h | 2 +- src/plugins/debugger/breakhandler.cpp | 34 ++++++--- src/plugins/debugger/breakpoint.cpp | 5 +- src/plugins/debugger/breakpoint.h | 1 + src/plugins/debugger/breakpoint.ui | 102 +++++++++++++++++++-------- src/plugins/debugger/breakwindow.cpp | 46 +++++++----- src/plugins/debugger/cdb/cdbparsehelpers.cpp | 7 +- src/plugins/debugger/debuggerstreamops.cpp | 2 + 8 files changed, 137 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/libs/qtcreatorcdbext/symbolgroup.h b/src/libs/qtcreatorcdbext/symbolgroup.h index 768b574b29..956aa1fd43 100644 --- a/src/libs/qtcreatorcdbext/symbolgroup.h +++ b/src/libs/qtcreatorcdbext/symbolgroup.h @@ -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 *); diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 3ef79dc775..8cdfc1d3b0 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -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 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 << "" << tr("Requested") << "" << tr("Obtained") << "" << "" << tr("Internal Number:") - << "—" << response.number << "" - << "" << tr("Function Name:") + << "—" << response.number << ""; + if (data.type == BreakpointByFunction) { + str << "" << tr("Function Name:") << "" << data.functionName << "" << response.functionName - << "" - << "" << tr("File Name:") + << ""; + } + if (data.type == BreakpointByFileAndLine) { + str << "" << tr("File Name:") << "" << QDir::toNativeSeparators(data.fileName) << "" << QDir::toNativeSeparators(response.fileName) << "" @@ -1177,8 +1186,15 @@ QString BreakHandler::BreakpointItem::toToolTip() const << "" << response.lineNumber << "" << "" << tr("Corrected Line Number:") << "-" - << "" << response.correctedLineNumber << "" - << "" << tr("Breakpoint Address:") + << "" << response.correctedLineNumber << ""; + } + if (data.type == BreakpointByFunction || data.type == BreakpointByFileAndLine) { + str << "" << tr("Module:") + << "" << data.module + << "" << response.module + << ""; + } + str << "" << tr("Breakpoint Address:") << ""; formatAddress(str, data.address); str << ""; diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index 25388d0c35..3a98a620c1 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -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 diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h index 341c945001..cdb7413740 100644 --- a/src/plugins/debugger/breakpoint.h +++ b/src/plugins/debugger/breakpoint.h @@ -99,6 +99,7 @@ public: quint64 address; // Address for watchpoints. int threadSpec; // Thread specification. QString functionName; + QString module; // module for file name bool tracepoint; }; diff --git a/src/plugins/debugger/breakpoint.ui b/src/plugins/debugger/breakpoint.ui index 354119f65c..e03f536136 100644 --- a/src/plugins/debugger/breakpoint.ui +++ b/src/plugins/debugger/breakpoint.ui @@ -1,13 +1,13 @@ Debugger::Internal::BreakpointDialog - + 0 0 - 558 - 302 + 700 + 401 @@ -19,7 +19,10 @@ - Breakpoint type: + Breakpoint &type: + + + comboBoxType @@ -29,17 +32,23 @@ - File name: + &File name: + + + pathChooserFileName - + - Line number: + &Line number: + + + lineEditLineNumber @@ -56,7 +65,10 @@ - Enabled: + &Enabled: + + + checkBoxEnabled @@ -70,14 +82,20 @@ - Use full path: + &Use full path: + + + checkBoxUseFullPath - Address: + &Address: + + + lineEditAddress @@ -87,57 +105,85 @@ - Function: + Fun&ction: + + + lineEditFunction - + - Condition: + &Condition: + + + lineEditCondition - + - + - Ignore count: + &Ignore count: + + + lineEditIgnoreCount - + - + - Thread specification: + &Thread specification: + + + lineEditThreadSpec - + - + - + - Tracepoint only: + T&racepoint only: + + + checkBoxTracepoint + + + + &Module: + + + lineEditModule + + + + + + @@ -145,12 +191,6 @@ Qt::Vertical - - - 20 - 40 - - @@ -170,7 +210,7 @@ buttonBox accepted() - BreakpointDialog + Debugger::Internal::BreakpointDialog accept() @@ -186,7 +226,7 @@ buttonBox rejected() - BreakpointDialog + Debugger::Internal::BreakpointDialog reject() diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 00c2a7e3bf..9aae8f6878 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -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: diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp index 42bbbd3f9e..19ee19be87 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp @@ -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; diff --git a/src/plugins/debugger/debuggerstreamops.cpp b/src/plugins/debugger/debuggerstreamops.cpp index 1c646aed85..b5c4719105 100644 --- a/src/plugins/debugger/debuggerstreamops.cpp +++ b/src/plugins/debugger/debuggerstreamops.cpp @@ -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; } -- cgit v1.2.1