aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/breakhandler.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2021-01-06 11:52:37 +0100
committerhjk <[email protected]>2021-01-07 12:09:40 +0000
commit111cc934fd99d4abc2b46bdab54fabf006409331 (patch)
tree28b2538188fb90abbc11ab41f78e7b27ee95b014 /src/plugins/debugger/breakhandler.cpp
parent41982acec318213b1fca30e18d1febda4292161f (diff)
Debugger: Mark currently hit breakpoint in breakpoint view
Fixes: QTCREATORBUG-6999 Change-Id: I2b080de0096d1e2bc5b348666adcf4797589fe15 Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins/debugger/breakhandler.cpp')
-rw-r--r--src/plugins/debugger/breakhandler.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 491efd90533..fa40001b897 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -1051,7 +1051,7 @@ QVariant BreakpointItem::data(int column, int role) const
if (role == Qt::DisplayRole)
return m_displayName.isEmpty() ? m_responseId : m_displayName;
if (role == Qt::DecorationRole)
- return icon();
+ return icon(m_needsLocationMarker);
break;
case BreakpointFunctionColumn:
if (role == Qt::DisplayRole) {
@@ -1259,6 +1259,14 @@ void BreakpointItem::gotoState(BreakpointState target, BreakpointState assumedCu
setState(target);
}
+void BreakpointItem::setNeedsLocationMarker(bool needsLocationMarker)
+{
+ if (m_needsLocationMarker == needsLocationMarker)
+ return;
+ m_needsLocationMarker = needsLocationMarker;
+ update();
+}
+
void BreakHandler::updateDisassemblerMarker(const Breakpoint &bp)
{
return m_engine->disassemblerAgent()->updateBreakpointMarker(bp);
@@ -1272,6 +1280,30 @@ void BreakHandler::removeDisassemblerMarker(const Breakpoint &bp)
gbp->updateMarker();
}
+static bool matches(const Location &loc, const BreakpointParameters &bp)
+{
+ if (loc.fileName() == bp.fileName && loc.lineNumber() == bp.lineNumber && bp.lineNumber > 0)
+ return true;
+ if (loc.address() == bp.address && bp.address > 0)
+ return true;
+ return false;
+}
+
+void BreakHandler::setLocation(const Location &loc)
+{
+ forItemsAtLevel<1>([loc](Breakpoint bp) {
+ bool needsMarker = matches(loc, bp->parameters());
+ if (GlobalBreakpoint gpb = bp->globalBreakpoint())
+ needsMarker = needsMarker || matches(loc, gpb->requestedParameters());
+ bp->setNeedsLocationMarker(needsMarker);
+ });
+}
+
+void BreakHandler::resetLocation()
+{
+ forItemsAtLevel<1>([](Breakpoint bp) { bp->setNeedsLocationMarker(false); });
+}
+
void BreakpointItem::setState(BreakpointState state)
{
//qDebug() << "BREAKPOINT STATE TRANSITION, ID: " << m_id
@@ -1881,7 +1913,7 @@ void BreakpointItem::updateMarker()
m_marker = new BreakpointMarker(this, file, line);
}
-QIcon BreakpointItem::icon() const
+QIcon BreakpointItem::icon(bool withLocationMarker) const
{
// FIXME: This seems to be called on each cursor blink as soon as the
// cursor is near a line with a breakpoint marker (+/- 2 lines or so).
@@ -1894,7 +1926,8 @@ QIcon BreakpointItem::icon() const
if (!m_parameters.enabled)
return Icons::BREAKPOINT_DISABLED.icon();
if (m_state == BreakpointInserted && !m_parameters.pending)
- return Icons::BREAKPOINT.icon();
+ return withLocationMarker ? Icons::BREAKPOINT_WITH_LOCATION.icon()
+ : Icons::BREAKPOINT.icon();
return Icons::BREAKPOINT_PENDING.icon();
}
@@ -2737,6 +2770,7 @@ void BreakpointManager::editBreakpoints(const GlobalBreakpoints &gbps, QWidget *
BreakpointManager::createBreakpoint(newParams);
}
}
+
void BreakpointManager::saveSessionData()
{
QList<QVariant> list;