Exemplo n.º 1
0
    def inext(self):
        """ Read a single trace msg container object from the input
        file.

        The input file is a fixed-size (?!) file, where each
        fixed-sized message
        """

        if (self.position >= self.size):
            raise StopIteration()

        (size, self.position) = decoder._DecodeVarint(self.data, self.position)

        raw_data = self.data[self.position:self.position + size]
        self.position = self.position + size

        trace_msg_container = tracemsg_pb2.TraceMsgContainer()
        try:
            trace_msg_container.ParseFromString(raw_data)
            pass
        except message.DecodeError as e:
            trace_msg_container == None
            raise

        if trace_msg_container == None:
            raise StopIteration()
        else:
            return trace_msg_container
Exemplo n.º 2
0
    def next(self):
        if (self.position >= len(self.data)):
            raise StopIteration()

        trace_msg_container = tracemsg_pb2.TraceMsgContainer()

        json_str = json.dumps(self.data[self.position])
        trace_msg_container = Parse(json_str, trace_msg_container)
        self.position = self.position + 1

        return trace_msg_container
Exemplo n.º 3
0
    def _get_ci_exit(self):
        cont = tracemsg_pb2.TraceMsgContainer()

        cont.msg.type = TraceMsgContainer.TraceMsg.CALLIN_EXIT
        cont.msg.message_id = 1
        cont.msg.thread_id = 2
        cont.msg.is_activity_thread = 1

        ci = cont.msg.callinExit
        ci.class_name = "class_name"
        ci.method_name = "method_name"
        self._get_value(ci.return_value)

        return cont
Exemplo n.º 4
0
    def _get_cb_exit(self):
        cont = tracemsg_pb2.TraceMsgContainer()

        cont.msg.type = TraceMsgContainer.TraceMsg.CALLBACK_EXIT
        cont.msg.message_id = 1
        cont.msg.thread_id = 2
        cont.msg.is_activity_thread = 1

        cb = cont.msg.callbackExit
        cb.class_name = "class_name"
        cb.method_name = "method_name"
        self._get_value(cb.return_value)

        return cont
Exemplo n.º 5
0
    def _get_cb_exception(self):
        cont = tracemsg_pb2.TraceMsgContainer()

        cont.msg.type = TraceMsgContainer.TraceMsg.CALLBACK_EXCEPTION
        cont.msg.message_id = 1
        cont.msg.thread_id = 2
        cont.msg.is_activity_thread = 1

        cbe = cont.msg.callbackException
        cbe.throwing_class_name = "class_name"
        cbe.throwing_method_name = "method_name"
        cbe.type = "type"
        stack_trace1 = cbe.stack_trace.add()
        stack_trace1.method = "m1"
        stack_trace1.class_name = "c1"

        return cont
Exemplo n.º 6
0
    def _get_ci_exception(self):
        cont = tracemsg_pb2.TraceMsgContainer()

        cont.msg.type = TraceMsgContainer.TraceMsg.CALLIN_EXEPION
        cont.msg.message_id = 1
        cont.msg.thread_id = 2
        cont.msg.is_activity_thread = 1

        cie = cont.msg.callinException
        cie.throwing_class_name = "class_name"
        cie.throwing_method_name = "method_name"
        cie.type = "type"
        cie.exception_message = "exception message"
        stack_trace1 = cie.stack_trace.add()
        stack_trace1.method = "m1"
        stack_trace1.class_name = "c1"

        return cont
Exemplo n.º 7
0
    def _get_ci_entry(self):
        cont = tracemsg_pb2.TraceMsgContainer()

        cont.msg.type = TraceMsgContainer.TraceMsg.CALLIN_ENTRY
        cont.msg.message_id = 1
        cont.msg.thread_id = 2
        cont.msg.is_activity_thread = 1

        ci = cont.msg.callinEntry

        ci.class_name = "class_name"
        ci.method_name = "method_name"
        self._get_value(ci.param_list.add())
        self._get_value(ci.param_list.add())
        self._get_value(ci.param_list.add())

        self._get_value(ci.caller)

        return cont
Exemplo n.º 8
0
    def _get_cb_entry(self):
        cont = tracemsg_pb2.TraceMsgContainer()

        cont.msg.type = TraceMsgContainer.TraceMsg.CALLBACK_ENTRY
        cont.msg.message_id = 1
        cont.msg.thread_id = 2
        cont.msg.is_activity_thread = 1

        cb = cont.msg.callbackEntry

        cb.class_name = "class_name"
        cb.method_name = "method_name"
        self._get_value(cb.param_list.add())
        self._get_value(cb.param_list.add())
        self._get_value(cb.param_list.add())

        cb.callback_caller_class = "cb caller class"
        cb.callback_caller_method = "cb caller method"
        cb.method_parameter_types.append("param 1")
        cb.method_parameter_types.append("param 2")
        cb.method_parameter_types.append("param 3")

        cb.method_returnType = "return type"
        # repeated FrameworkOverride framework_overrides = 9;
        cb.receiver_first_framework_super = "fwk super"

        override = cb.framework_overrides.add()
        override.method = "method_name"
        override.class_name = "first"
        override.is_interface = False

        override = cb.framework_overrides.add()
        override.method = "method_name"
        override.class_name = "second"
        override.is_interface = False

        override = cb.framework_overrides.add()
        override.method = "method_name"
        override.class_name = "interface"
        override.is_interface = True

        return cont