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;
|
||||
|
@@ -39,13 +39,14 @@ namespace Utils { class ItemViewEvent; }
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class BreakpointItem;
|
||||
class BreakpointMarker;
|
||||
class BreakHandler;
|
||||
class BreakpointItem;
|
||||
class BreakpointManager;
|
||||
class BreakpointMarker;
|
||||
class DebuggerCommand;
|
||||
class DebuggerEngine;
|
||||
class BreakpointManager;
|
||||
class GlobalBreakpointMarker;
|
||||
class Location;
|
||||
|
||||
class SubBreakpointItem : public QObject, public Utils::TypedTreeItem<Utils::TreeItem, BreakpointItem>
|
||||
{
|
||||
@@ -122,7 +123,7 @@ public:
|
||||
|
||||
QVariant data(int column, int role) const final;
|
||||
|
||||
QIcon icon() const;
|
||||
QIcon icon(bool withLocationMarker = false) const;
|
||||
|
||||
void setMarkerFileAndLine(const Utils::FilePath &fileName, int lineNumber);
|
||||
bool needsChange() const;
|
||||
@@ -197,6 +198,8 @@ public:
|
||||
const GlobalBreakpoint globalBreakpoint() const;
|
||||
void gotoState(BreakpointState target, BreakpointState assumedCurrent);
|
||||
|
||||
void setNeedsLocationMarker(bool needsLocationMarker);
|
||||
|
||||
private:
|
||||
void destroyMarker();
|
||||
void updateMarker();
|
||||
@@ -209,6 +212,7 @@ private:
|
||||
BreakpointMarker *m_marker = nullptr;
|
||||
QString m_responseId; //!< Breakpoint number or id assigned by or used in the debugger backend.
|
||||
QString m_displayName;
|
||||
bool m_needsLocationMarker = false;
|
||||
};
|
||||
|
||||
using Breakpoint = QPointer<BreakpointItem>;
|
||||
@@ -261,6 +265,9 @@ public:
|
||||
void updateDisassemblerMarker(const Breakpoint &bp);
|
||||
void removeDisassemblerMarker(const Breakpoint &bp);
|
||||
|
||||
void setLocation(const Location &loc);
|
||||
void resetLocation();
|
||||
|
||||
private:
|
||||
Breakpoint findBreakpointByIndex(const QModelIndex &index) const;
|
||||
Breakpoints findBreakpointsByIndex(const QList<QModelIndex> &list) const;
|
||||
|
@@ -448,6 +448,7 @@ public:
|
||||
m_stackHandler.resetLocation();
|
||||
m_disassemblerAgent.resetLocation();
|
||||
m_toolTipManager.resetLocation();
|
||||
m_breakHandler.resetLocation();
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -1110,6 +1111,8 @@ void DebuggerEngine::gotoLocation(const Location &loc)
|
||||
d->m_locationMark.reset(new LocationMark(this, loc.fileName(), line));
|
||||
d->m_locationMark->setToolTip(tr("Current debugger location of %1").arg(displayName()));
|
||||
}
|
||||
|
||||
d->m_breakHandler.setLocation(loc);
|
||||
}
|
||||
|
||||
void DebuggerEngine::gotoCurrentLocation()
|
||||
|
@@ -37,6 +37,9 @@ const Icon BREAKPOINT_DISABLED({
|
||||
const Icon BREAKPOINT_PENDING({
|
||||
{":/utils/images/filledcircle.png", Theme::IconsErrorColor},
|
||||
{":/debugger/images/breakpoint_pending_overlay.png", Theme::PanelTextColorDark}}, Icon::IconStyleOptions(Icon::Tint | Icon::PunchEdges));
|
||||
const Icon BREAKPOINT_WITH_LOCATION({
|
||||
{":/utils/images/filledcircle.png", Theme::IconsErrorColor},
|
||||
{":/debugger/images/location.png", Theme::IconsWarningToolBarColor}}, Icon::Tint);
|
||||
const Icon BREAKPOINTS(
|
||||
":/debugger/images/debugger_breakpoints.png");
|
||||
const Icon WATCHPOINT({
|
||||
|
@@ -42,6 +42,7 @@ DEBUGGER_EXPORT extern const Utils::Icon TRACEPOINT_TOOLBAR;
|
||||
extern const Utils::Icon BREAKPOINT;
|
||||
extern const Utils::Icon BREAKPOINT_DISABLED;
|
||||
extern const Utils::Icon BREAKPOINT_PENDING;
|
||||
extern const Utils::Icon BREAKPOINT_WITH_LOCATION;
|
||||
extern const Utils::Icon BREAKPOINTS;
|
||||
extern const Utils::Icon WATCHPOINT;
|
||||
extern const Utils::Icon CONTINUE;
|
||||
|
Reference in New Issue
Block a user