summaryrefslogtreecommitdiff
path: root/src/plugins/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r--src/plugins/debugger/breakhandler.cpp12
-rw-r--r--src/plugins/debugger/breakpoint.cpp27
-rw-r--r--src/plugins/debugger/breakpoint.h1
3 files changed, 38 insertions, 2 deletions
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 0bc771de6b..e80b898aae 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -396,7 +396,11 @@ void BreakHandler::loadBreakpoints()
v = map.value(_("message"));
if (v.isValid())
data.message = v.toString();
- appendBreakpoint(data);
+ if (data.isValid()) {
+ appendBreakpoint(data);
+ } else {
+ qWarning("Not restoring invalid breakpoint: %s", qPrintable(data.toString()));
+ }
}
//qDebug() << "LOADED BREAKPOINTS" << this << list.size();
}
@@ -1036,7 +1040,11 @@ static int currentId = 0;
void BreakHandler::appendBreakpoint(const BreakpointParameters &data)
{
- QTC_ASSERT(data.type != UnknownType, return);
+ if (!data.isValid()) {
+ qWarning("Not adding invalid breakpoint: %s", qPrintable(data.toString()));
+ return;
+ }
+
BreakpointModelId id(++currentId);
const int row = m_storage.size();
beginInsertRows(QModelIndex(), row, row);
diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp
index c61892c09b..c0d9347977 100644
--- a/src/plugins/debugger/breakpoint.cpp
+++ b/src/plugins/debugger/breakpoint.cpp
@@ -220,6 +220,33 @@ BreakpointParts BreakpointParameters::differencesTo
return parts;
}
+bool BreakpointParameters::isValid() const
+{
+ switch (type) {
+ case Debugger::Internal::BreakpointByFileAndLine:
+ return !fileName.isEmpty() && lineNumber > 0;
+ case Debugger::Internal::BreakpointByFunction:
+ return !functionName.isEmpty();
+ case Debugger::Internal::WatchpointAtAddress:
+ case Debugger::Internal::BreakpointByAddress:
+ return address != 0;
+ case Debugger::Internal::BreakpointAtThrow:
+ case Debugger::Internal::BreakpointAtCatch:
+ case Debugger::Internal::BreakpointAtMain:
+ case Debugger::Internal::BreakpointAtFork:
+ case Debugger::Internal::BreakpointAtExec:
+ case Debugger::Internal::BreakpointAtSysCall:
+ case Debugger::Internal::BreakpointOnQmlSignalHandler:
+ case Debugger::Internal::BreakpointAtJavaScriptThrow:
+ break;
+ case Debugger::Internal::WatchpointAtExpression:
+ return !expression.isEmpty();
+ case Debugger::Internal::UnknownType:
+ return false;
+ }
+ return true;
+}
+
bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
{
return !differencesTo(rhs);
diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h
index b1636be10c..a04a718bf2 100644
--- a/src/plugins/debugger/breakpoint.h
+++ b/src/plugins/debugger/breakpoint.h
@@ -203,6 +203,7 @@ class BreakpointParameters
public:
explicit BreakpointParameters(BreakpointType = UnknownType);
BreakpointParts differencesTo(const BreakpointParameters &rhs) const;
+ bool isValid() const;
bool equals(const BreakpointParameters &rhs) const;
bool conditionsMatch(const QByteArray &other) const;
bool isWatchpoint() const