forked from qt-creator/qt-creator
Debugger: Mark currently hit breakpoint in breakpoint view
Fixes: QTCREATORBUG-6999 Change-Id: I2b080de0096d1e2bc5b348666adcf4797589fe15 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user