Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/controllers/debugcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from helpers.gdboutput import GdbOutput
import logging
from helpers.configstore import ConfigSet, ConfigItem
from helpers.gdbinit import GDBInit


class DebugConfig(ConfigSet):
Expand All @@ -47,13 +48,22 @@ def __init__(self, distributedObjects):
self.distributedObjects = distributedObjects

self.connector = self.distributedObjects.gdb_connector
self.gdbinit = self.distributedObjects.gdb_init
self.signalProxy = self.distributedObjects.signalProxy

self.executableName = None
self.lastCmdWasStep = False

self.ptyhandler.start()

GDBInit.writeFile(self.gdbinit.getPath(),self.gdbinit.getFileName())

self.connector.start()

self.connector.initPrettyPrinter(self.gdbinit.getPath() + self.gdbinit.getFileName())
self.connector.startPrettyPrinting()

self.toggleBeautify = True

self.connector.reader.asyncRecordReceived.connect(self.handleAsyncRecord, Qt.QueuedConnection)

Expand Down Expand Up @@ -131,7 +141,18 @@ def finish(self):
def until(self, file_, line):
self.connector.until(file_, line)
self.lastCmdWasStep = False


def beautify(self):
if self.toggleBeautify:
self.connector.disablePrettyPrinter()
else:
self.connector.enablePrettyPrinter()

self.toggleBeautify = not self.toggleBeautify
self.distributedObjects.localsController.reloadLocals()
self.distributedObjects.watchController.clearModel()
self.distributedObjects.datagraphController.clearDataGraph()

def evaluateExpression(self, exp):
if exp == "":
return None
Expand Down
7 changes: 7 additions & 0 deletions src/controllers/localscontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ def getLocals(self):

for vw in self.variableList.list:
self.add(vw)

def reloadLocals(self):
self.clear()
self.variableList.reloadLocals()

for vw in self.variableList.list:
self.add(vw)
1 change: 1 addition & 0 deletions src/controllers/tooltipcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ def showToolTip(self, exp, pos, parent):

def hideToolTip(self):
self.view.hideLater()

83 changes: 0 additions & 83 deletions src/controllers/tracepointwavecontroller.py

This file was deleted.

6 changes: 4 additions & 2 deletions src/controllers/treeitemcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ def getChildren(self, factory):
Get Children from VariableList for StructVariable
@param factory derived from VarWrapperFactory, factory to look in VariableList for children
"""
if len(self.childItems) == 0:
if (len(self.childItems) == 0) or (self._v.numChild != len(self.childItems)):
self.removeChildren()
for child in self._v.childs:
vwChild = child.makeWrapper(factory)
vwChild.parent = self
vwChild.dataChanged.connect(vwChild.hasChanged)
vwChild.dataChanged.connect(vwChild.hasChanged)
self.addChild(vwChild)
self._v.numChild = len(self.childItems)

return self.childItems

Expand Down
6 changes: 5 additions & 1 deletion src/controllers/watchcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,8 @@ def loadSession(self, xmlHandler):
childnodes = watchParent.childNodes()
for i in range(childnodes.size()):
attr = xmlHandler.getAttributes(childnodes.at(i))
self.addWatch(attr["exp"])
self.addWatch(attr["exp"])

def clearModel(self):
self.model.clear()

21 changes: 13 additions & 8 deletions src/datagraph/datagraphcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, distributedObjects):
## @var vwFactory
# datagraph.datagraphvwfactory.DataGraphVWFactory, private, self-created DataGraphVWFactory
self.vwFactory = DataGraphVWFactory(self.distributedObjects)

## @var variableList
# variables.variablelist.VariableList, private, self-created VariableList
self.variableList = VariableList(self.vwFactory, self.distributedObjects)
Expand Down Expand Up @@ -101,23 +102,27 @@ def addVar(self, varWrapper, xPos=0, yPos=0, addVarToList=True):
@param yPos Integer, the Y-Coordinate of the Position where to add the VariableWrapper
@param addVarToList Boolean, tells if varWrapper should be added to the VariableList too
"""
varWrapper.createView()
self.addGraph(varWrapper, xPos, yPos)
if addVarToList:
self.variableList.addVar(varWrapper)

def addGraph(self, wrapper, xPos=0, yPos=0):
wrapper.createView()
try:
varWrapper.getView().render()
wrapper.getView().render()
except:
from mako import exceptions
logging.error("Caught exception while rendering template: %s", exceptions.text_error_template().render())
varWrapper.setXPos(xPos)
varWrapper.setYPos(yPos)
self.data_graph_view.addItem(varWrapper.getView())
if addVarToList:
self.variableList.addVar(varWrapper)
wrapper.setXPos(xPos)
wrapper.setYPos(yPos)
self.data_graph_view.addItem(wrapper.getView())

def removeVar(self, varWrapper):
""" removes the given varWrapper from the DataGraphView and the PointerList
@param varWrapper variables.variablewrapper.VariableWrapper, the VariableWrapper to remove
"""
self.variableList.removeVar(varWrapper)
if varWrapper in self.variableList:
self.variableList.removeVar(varWrapper)
self.data_graph_view.removeItem(varWrapper.getView())

def addPointer(self, fromView, toView):
Expand Down
18 changes: 9 additions & 9 deletions src/datagraph/datagraphvw.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def prepareContextMenu(self, menu):
action.setChecked(self.vertical)

def render(self, role, **kwargs):
self.varWrapper.getChildren()
return HtmlTemplateHandler.render(self, role, vertical=self.vertical, **kwargs)


Expand Down Expand Up @@ -204,7 +205,7 @@ def render(self, role, **kwargs):
def setFilter(self, f):
VariableWrapper.setFilter(self, f)
self.setDirty(True)


class ComplexDataGraphVW(DataGraphVW):
def __init__(self, variable, distributedObjects, vwFactory, templateHandler):
Expand All @@ -221,14 +222,13 @@ def __init__(self, variable, distributedObjects, vwFactory, templateHandler):
def setOpen(self, open_):
self.isOpen = open_
self.setDirty(True)

def getChildren(self):
""" returns list of children as DataGraphVWs; creates the wrappers if they haven't yet been
@return list of datagraph.datagraphvw.DataGraphVW """
if not self.childrenWrapper:
self.childrenWrapper = []
for childVar in self.childs:
wrapper = childVar.makeWrapper(self.vwFactory)
wrapper.setExistingView(self.getView(), self)
self.childrenWrapper.append(wrapper)
return self.childrenWrapper
self.childrenWrapper = []
for childVar in self.childs:
wrapper = childVar.makeWrapper(self.vwFactory)
wrapper.setExistingView(self.getView(), self)
self.childrenWrapper.append(wrapper)
return self.childrenWrapper
46 changes: 46 additions & 0 deletions src/datagraph/svgimage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# ricodebug - A GDB frontend which focuses on visually supported
# debugging using data structure graphs and SystemC features.
#
# Copyright (C) 2011 The ricodebug project team at the
# Upper Austrian University Of Applied Sciences Hagenberg,
# Department Embedded Systems Design
#
# This file is part of ricodebug.
#
# ricodebug is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# For further information see <http://syscdbg.hagenberg.servus.at/>.

from PyQt4.QtCore import QObject, pyqtSignal


class SVGImage(QObject):
changed = pyqtSignal(str)

def __init__(self, name, fileObject):
QObject.__init__(self)
self.name = name
self.fileObject = fileObject
self.imageContent = fileObject.read()
self.inScope = True

def refresh(self):
self.fileObject.seek(0)
self.imageContent = self.fileObject.read()

def die(self):
pass

def __str__(self):
return self.name
55 changes: 55 additions & 0 deletions src/datagraph/svgvw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ricodebug - A GDB frontend which focuses on visually supported
# debugging using data structure graphs and SystemC features.
#
# Copyright (C) 2011 The ricodebug project team at the
# Upper Austrian University Of Applied Sciences Hagenberg,
# Department Embedded Systems Design
#
# This file is part of ricodebug.
#
# ricodebug is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# For further information see <http://syscdbg.hagenberg.servus.at/>.

from .datagraphvw import HtmlTemplateHandler, DataGraphVW
from .htmlvariableview import HtmlVariableView


class SVGDataGraphVW(DataGraphVW):
""" Wrapper for SVG Images """

def __init__(self, image, distributedObjects):
""" Constructor
@param image SVG image to wrap with the new DataGraphVW
@param distributedObjects the DistributedObjects-Instance
"""
DataGraphVW.__init__(self, image, distributedObjects)
self.image = image
self.templateHandler = HtmlTemplateHandler(self,
self.distributedObjects,
"svgview.mako")

def showContent(self):
self.image.refresh()
return self.image.imageContent

def showName(self):
return str(self.image)

def render(self, role, **kwargs):
return self.templateHandler.render(role)

def createView(self):
self._view = HtmlVariableView(self, self.distributedObjects)
self.parentWrapper = self._view
2 changes: 2 additions & 0 deletions src/datagraph/templates/svgview.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<tr><th>${varWrapper.showName()}</th></tr>
<tr><td>${varWrapper.showContent()}<td></tr>
15 changes: 15 additions & 0 deletions src/helpers/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ def __init__(self):
"Del var from Watch", "+",
"Remove selected variable from watchview-window")

###############################################
## miscellaneous
###############################################
self.Beautify = self.__createAction(":/icons/images/beautify.png",
"Beautify", None, "Pretty Print of Objects")

def getAddToWatchAction(self, name, slot):
a = self.createEx(name)
a.setText("Add '%s' to watch window" % name)
Expand All @@ -155,6 +161,15 @@ def getAddToTracepointAction(self, varname, tpname, slot):
a.triggeredEx.connect(slot)
return a

def getAddSVGToDatagraphAction(self, name, slot):
a = self.createEx(name)
a.setText(str(name))
a.setIcon(QtGui.QIcon(":/icons/images/insert.png"))
a.setIconVisibleInMenu(True)
a.triggeredEx.connect(slot)
return a


def createEx(self, parameter):
return self.ActionEx(parameter, self)

Expand Down
Loading