Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
OODebug::JavaDebugger Class Reference

Public Types

enum class  BreakpointAction : int { Resume , Stop }
 Indicates wether we should resume after the breakpoint or not. More...
 
using BreakpointId = int
 The type of a breakpoint id. More...
 
using BreakpointListener = std::function< BreakpointAction(Model::Node *, const BreakpointEvent &)>
 
enum class  BreakpointType : int { Internal , User }
 Type of a Breakpoint: Internal means the user will not see the breakpoint. More...
 
using ProgramExitSingleShot = std::function< void()>
 
using ValueHandler = std::function< void(JavaDebugger *, Values, QList< Probes::ValueCalculator >, PlotOverlay *)>
 

Public Member Functions

BreakpointId addBreakpoint (Model::Node *location, BreakpointType type)
 Adds a new breakpoint at the given location and with the given type. More...
 
void addBreakpointListener (qint64 breakpointId, BreakpointListener listener)
 
void addProgramExitLister (ProgramExitSingleShot listener)
 Register a listener for the next program exit. More...
 
Interaction::CommandResultdebugTree (Model::TreeManager *manager, const QString &pathToProjectContainerDirectory)
 Starts a debug session for the current project. More...
 
Interaction::CommandResultprobe (OOVisualization::VStatementItemList *itemList, const QStringList &arguments, int itemIndex)
 
void removeBreakpoint (BreakpointId breakpointId)
 Removes the breakpoint with the id breakpointId and any BreakpointListeners associated with it. More...
 
bool resume (Visualization::Item *target, QKeyEvent *event)
 
bool step (Visualization::Item *target, QKeyEvent *event)
 
bool suspend (Visualization::Item *target, QKeyEvent *event)
 
bool toggleBreakpoint (Visualization::Item *target, QKeyEvent *event)
 
bool trackVariable (Visualization::Item *target, QKeyEvent *event)
 

Static Public Member Functions

static JavaDebuggerinstance ()
 

Private Member Functions

 JavaDebugger ()
 
void addBreakpointAt (Model::Node *node)
 
void breaktAtParentClassLoad (Model::Node *node)
 
BreakpointListener createListenerFor (std::shared_ptr< VariableObserver > observer, PlotOverlay *plotOverlay)
 
QPair< PlotOverlay::PlotType, ValueHandlerdefaultPlotTypeAndValueHandlerFor (QList< OOModel::VariableDeclaration * > variables)
 
void handleArray (Values values, QList< Probes::ValueCalculator > valueCalculators, PlotOverlay *plotOverlay)
 
void handleBreakpoint (BreakpointEvent breakpointEvent)
 
void handleClassPrepare (Event)
 
void handleSingleStep (SingleStepEvent singleStep)
 
void handleValues (Values values, QList< Probes::ValueCalculator > valueCalculators, PlotOverlay *plotOverlay)
 
void handleVMStart (Event)
 
bool isParentClassLoaded (Model::Node *node)
 
void removeBreakpointAt (Model::Node *node)
 
void removeHighlightFromCurrentLine ()
 
void resume ()
 
void toggleLineHighlight (Visualization::Item *item, bool highlight, bool closingBracket=false)
 
void trySetBreakpoints ()
 

Private Attributes

QSet< Model::Node * > breakOnLoadClasses_
 
QMultiHash< Model::Node *, BreakpointIdbreakpointIds_
 
QHash< qint64, BreakpointListenerbreakpointListeners_
 
Visualization::ItemcurrentLineItem_ {}
 
qint64 currentThreadId_ {}
 
DebugConnector debugConnector_
 
QVector< ProgramExitSingleShotexitListeners_
 
BreakpointId nextBreakpointId_ {0}
 
QMultiHash< Model::Node *, std::shared_ptr< VariableObserver > > nodeObservedBy_
 
QMultiHash< Model::Node *, ProbeVisualizationprobes_
 
QHash< qint32, Model::Node * > setBreakpoints_
 
QHash< Model::Node *, TrackedVariabletrackedVariables_
 
QSet< Model::Node * > unsetBreakpoints_
 
QHash< Model::Node *, UserVisibleBreakpointuserBreakpoints_
 
DebugUtils utils_ {&debugConnector_}
 

Static Private Attributes

static const QString BREAKPOINT_OVERLAY_GROUP {"Breakpoint overlay"}
 
static const QString CURRENT_LINE_OVERLAY_GROUP {"CurrentLine"}
 
static const QString MONITOR_OVERLAY_GROUP {"MonitorOverlay"}
 
static const QString PLOT_OVERLAY_GROUP {"PlotOverlay"}
 

Member Typedef Documentation

◆ BreakpointId

The type of a breakpoint id.

◆ BreakpointListener

◆ ProgramExitSingleShot

using OODebug::JavaDebugger::ProgramExitSingleShot = std::function<void ()>

◆ ValueHandler

Member Enumeration Documentation

◆ BreakpointAction

Indicates wether we should resume after the breakpoint or not.

Enumerator
Resume 
Stop 

◆ BreakpointType

Type of a Breakpoint: Internal means the user will not see the breakpoint.

This is useful for breakpoints where one wants to auto resume. (e.g. count how many times a statement is executed) User means there will be an icon notifying the user about the existince of the user.

Enumerator
Internal 
User 

Constructor & Destructor Documentation

◆ JavaDebugger()

OODebug::JavaDebugger::JavaDebugger ( )
private

Member Function Documentation

◆ addBreakpoint()

JavaDebugger::BreakpointId OODebug::JavaDebugger::addBreakpoint ( Model::Node location,
BreakpointType  type 
)

Adds a new breakpoint at the given location and with the given type.

Returns the id of this breakpoint, the id is always greater than 0.

◆ addBreakpointAt()

void OODebug::JavaDebugger::addBreakpointAt ( Model::Node node)
private

◆ addBreakpointListener()

void OODebug::JavaDebugger::addBreakpointListener ( qint64  breakpointId,
BreakpointListener  listener 
)
inline

◆ addProgramExitLister()

void OODebug::JavaDebugger::addProgramExitLister ( JavaDebugger::ProgramExitSingleShot  listener)
inline

Register a listener for the next program exit.

Once the event happened the listener will be destroyed and not called in any subsequent event.

◆ breaktAtParentClassLoad()

void OODebug::JavaDebugger::breaktAtParentClassLoad ( Model::Node node)
private

◆ createListenerFor()

JavaDebugger::BreakpointListener OODebug::JavaDebugger::createListenerFor ( std::shared_ptr< VariableObserver observer,
PlotOverlay plotOverlay 
)
private

◆ debugTree()

Interaction::CommandResult * OODebug::JavaDebugger::debugTree ( Model::TreeManager manager,
const QString &  pathToProjectContainerDirectory 
)

Starts a debug session for the current project.

Returns if everything was okay in a CommandResult.

◆ defaultPlotTypeAndValueHandlerFor()

QPair< PlotOverlay::PlotType, JavaDebugger::ValueHandler > OODebug::JavaDebugger::defaultPlotTypeAndValueHandlerFor ( QList< OOModel::VariableDeclaration * >  variables)
private

◆ handleArray()

void OODebug::JavaDebugger::handleArray ( Values  values,
QList< Probes::ValueCalculator valueCalculators,
PlotOverlay plotOverlay 
)
private

◆ handleBreakpoint()

void OODebug::JavaDebugger::handleBreakpoint ( BreakpointEvent  breakpointEvent)
private

◆ handleClassPrepare()

void OODebug::JavaDebugger::handleClassPrepare ( Event  )
private

◆ handleSingleStep()

void OODebug::JavaDebugger::handleSingleStep ( SingleStepEvent  singleStep)
private

◆ handleValues()

void OODebug::JavaDebugger::handleValues ( Values  values,
QList< Probes::ValueCalculator valueCalculators,
PlotOverlay plotOverlay 
)
private

◆ handleVMStart()

void OODebug::JavaDebugger::handleVMStart ( Event  )
private

◆ instance()

JavaDebugger & OODebug::JavaDebugger::instance ( )
static

◆ isParentClassLoaded()

bool OODebug::JavaDebugger::isParentClassLoaded ( Model::Node node)
private

◆ probe()

Interaction::CommandResult * OODebug::JavaDebugger::probe ( OOVisualization::VStatementItemList itemList,
const QStringList &  arguments,
int  itemIndex 
)

◆ removeBreakpoint()

void OODebug::JavaDebugger::removeBreakpoint ( BreakpointId  breakpointId)

Removes the breakpoint with the id breakpointId and any BreakpointListeners associated with it.

◆ removeBreakpointAt()

void OODebug::JavaDebugger::removeBreakpointAt ( Model::Node node)
private

◆ removeHighlightFromCurrentLine()

void OODebug::JavaDebugger::removeHighlightFromCurrentLine ( )
private

◆ resume() [1/2]

void OODebug::JavaDebugger::resume ( )
private

◆ resume() [2/2]

bool OODebug::JavaDebugger::resume ( Visualization::Item target,
QKeyEvent *  event 
)

◆ step()

bool OODebug::JavaDebugger::step ( Visualization::Item target,
QKeyEvent *  event 
)

◆ suspend()

bool OODebug::JavaDebugger::suspend ( Visualization::Item target,
QKeyEvent *  event 
)

◆ toggleBreakpoint()

bool OODebug::JavaDebugger::toggleBreakpoint ( Visualization::Item target,
QKeyEvent *  event 
)

◆ toggleLineHighlight()

void OODebug::JavaDebugger::toggleLineHighlight ( Visualization::Item item,
bool  highlight,
bool  closingBracket = false 
)
private

◆ trackVariable()

bool OODebug::JavaDebugger::trackVariable ( Visualization::Item target,
QKeyEvent *  event 
)

◆ trySetBreakpoints()

void OODebug::JavaDebugger::trySetBreakpoints ( )
private

Member Data Documentation

◆ breakOnLoadClasses_

QSet<Model::Node*> OODebug::JavaDebugger::breakOnLoadClasses_
private

◆ BREAKPOINT_OVERLAY_GROUP

const QString OODebug::JavaDebugger::BREAKPOINT_OVERLAY_GROUP {"Breakpoint overlay"}
staticprivate

◆ breakpointIds_

QMultiHash<Model::Node*, BreakpointId> OODebug::JavaDebugger::breakpointIds_
private

◆ breakpointListeners_

QHash<qint64, BreakpointListener> OODebug::JavaDebugger::breakpointListeners_
private

◆ CURRENT_LINE_OVERLAY_GROUP

const QString OODebug::JavaDebugger::CURRENT_LINE_OVERLAY_GROUP {"CurrentLine"}
staticprivate

◆ currentLineItem_

Visualization::Item* OODebug::JavaDebugger::currentLineItem_ {}
private

◆ currentThreadId_

qint64 OODebug::JavaDebugger::currentThreadId_ {}
private

◆ debugConnector_

DebugConnector OODebug::JavaDebugger::debugConnector_
private

◆ exitListeners_

QVector<ProgramExitSingleShot> OODebug::JavaDebugger::exitListeners_
private

◆ MONITOR_OVERLAY_GROUP

const QString OODebug::JavaDebugger::MONITOR_OVERLAY_GROUP {"MonitorOverlay"}
staticprivate

◆ nextBreakpointId_

BreakpointId OODebug::JavaDebugger::nextBreakpointId_ {0}
private

◆ nodeObservedBy_

QMultiHash<Model::Node*, std::shared_ptr<VariableObserver> > OODebug::JavaDebugger::nodeObservedBy_
private

◆ PLOT_OVERLAY_GROUP

const QString OODebug::JavaDebugger::PLOT_OVERLAY_GROUP {"PlotOverlay"}
staticprivate

◆ probes_

QMultiHash<Model::Node*, ProbeVisualization> OODebug::JavaDebugger::probes_
private

◆ setBreakpoints_

QHash<qint32, Model::Node*> OODebug::JavaDebugger::setBreakpoints_
private

◆ trackedVariables_

QHash<Model::Node*, TrackedVariable> OODebug::JavaDebugger::trackedVariables_
private

◆ unsetBreakpoints_

QSet<Model::Node*> OODebug::JavaDebugger::unsetBreakpoints_
private

◆ userBreakpoints_

QHash<Model::Node*, UserVisibleBreakpoint> OODebug::JavaDebugger::userBreakpoints_
private

◆ utils_

DebugUtils OODebug::JavaDebugger::utils_ {&debugConnector_}
private