Ejemplo n.º 1
0
class Tracepoint(Breakpoint):
    """This class is used as a tracepoint in tracepointmodel.
    Basically Tracpoints are Breakpoint but they are extended
    with tracedVariables (list of Variable-Value-Pairs).
    Every Tracepoint contains some variables that are traced.
    Tracepoints are breakpoints and stop program then get
    information of asked variables and then continue program
    """
    def __init__(self, breakpoint, connector, do, nr):
        Breakpoint.__init__(self, breakpoint, connector)
        self.name = "TP #%s" % nr
        self.variableList = VariableList(PlainVariableFactory, do)
        self.wave = []

        self.tooltip = "Tracepoint"

    icon = property(lambda self: Icons.tp if self.enabled else Icons.bp_dis)
    tracedVariables = property(lambda self: [v.exp for v in self.variableList])

    def addVar(self, variableToTrace):
        """ add a var to trace its value
        @param variableToTrace: variable name of the variable that should be traced"""
        vw = self.variableList.addVarByName(variableToTrace)
        newValueList = ValueList(variableToTrace, vw.type)
        self.wave.append(newValueList)

        # FIXME: emit dataChanged to make sure the views are updated

    def recordData(self):
        """tracepoint occurred: get values of all traced variables then continue debugging """
        for varList in self.wave:
            for v in self.variableList.items():
                if v.uniqueName == varList.name:
                    varList.addValue(v.type, v.value)
Ejemplo n.º 2
0
class Tracepoint(Breakpoint):
    """This class is used as a tracepoint in tracepointmodel.
    Basically Tracpoints are Breakpoint but they are extended
    with tracedVariables (list of Variable-Value-Pairs).
    Every Tracepoint contains some variables that are traced.
    Tracepoints are breakpoints and stop program then get
    information of asked variables and then continue program
    """

    def __init__(self, breakpoint, connector, do, nr):
        Breakpoint.__init__(self, breakpoint, connector)
        self.name = "TP #%s" % nr
        self.variableList = VariableList(PlainVariableFactory, do)
        self.wave = []

        self.tooltip = "Tracepoint"

    icon = property(lambda self: Icons.tp if self.enabled else Icons.bp_dis)
    tracedVariables = property(lambda self: [v.exp for v in self.variableList])

    def addVar(self, variableToTrace):
        """ add a var to trace its value
        @param variableToTrace: variable name of the variable that should be traced"""
        vw = self.variableList.addVarByName(variableToTrace)
        newValueList = ValueList(variableToTrace, vw.type)
        self.wave.append(newValueList)

        # FIXME: emit dataChanged to make sure the views are updated

    def recordData(self):
        """tracepoint occurred: get values of all traced variables then continue debugging """
        for varList in self.wave:
            for v in self.variableList.items():
                if v.uniqueName == varList.name:
                    varList.addValue(v.type, v.value)