Esempio n. 1
0
def compose_stack_frame(context):
    instruction = helpers.get_current_instruction(context)
    return {
        'instruction': None if instruction is None else str(instruction),
        'location':
        None if instruction is None else instruction.source_file_position,
        'method': helpers.get_current_method(context),
        'class': helpers.get_type(context)
    }
Esempio n. 2
0
def compose_stack_frame(context):
    instruction = helpers.get_current_instruction(context)
    method = helpers.get_current_method(context)
    return {
        'instruction': None if instruction is None else str(instruction),
        'location':
        None if instruction is None else instruction.source_file_position,
        'methodName': None if method is None else method.name,
        'typeName': None if method is None else method.declaring_type.name
    }
Esempio n. 3
0
def compose_stack_frame(context):
    instruction = helpers.get_current_instruction(context)
    method = helpers.get_current_method(context)
    return {
        'instruction': None if instruction is None else unicode(instruction),
        'location':
        None if instruction is None else instruction.source_file_position,
        'method': None if method is None else method.name,
        'class': None if method is None else method.murano_class.name
    }
Esempio n. 4
0
def compose_stack_frame(context):
    instruction = helpers.get_current_instruction(context)
    return {
        'instruction': None if instruction is None
        else str(instruction),

        'location': None if instruction is None
        else instruction.source_file_position,

        'method': helpers.get_current_method(context),
        'class': helpers.get_type(context)
    }
Esempio n. 5
0
def compose_stack_frame(context):
    instruction = helpers.get_current_instruction(context)
    method = helpers.get_current_method(context)
    return {
        'instruction': None if instruction is None
        else six.text_type(instruction),

        'location': None if instruction is None
        else instruction.source_file_position,

        'methodName': None if method is None else method.name,
        'typeName': None if method is None else method.declaring_type.name
    }
Esempio n. 6
0
def compose_stack_frame(context):
    instruction = helpers.get_current_instruction(context)
    method = helpers.get_current_method(context)
    return {
        'instruction': None if instruction is None
        else unicode(instruction),

        'location': None if instruction is None
        else instruction.source_file_position,

        'method': None if method is None else method.name,
        'class': None if method is None else method.murano_class.name
    }
Esempio n. 7
0
    def initialize(self, _context, includeNativeFrames=True):
        frames = []
        context = _context
        while True:
            if not context:
                break
            instruction = helpers.get_current_instruction(context)
            frames.append({
                'instruction': None if instruction is None
                else str(instruction),

                'location': None if instruction is None
                else instruction.source_file_position,

                'method': helpers.get_current_method(context),
                'class': helpers.get_type(context)
            })
            context = helpers.get_caller_context(context)
        frames.pop()
        frames.reverse()

        if includeNativeFrames:
            class InstructionStub(object):
                def __init__(self, title, position):
                    self._title = title
                    self.source_file_position = position

                def __str__(self):
                    return self._title

            native_frames = []
            for frame in inspect.trace()[1:]:
                info = inspect.getframeinfo(frame[0])
                position = yaql_expression.YaqlExpressionFilePosition(
                    os.path.abspath(info.filename), info.lineno,
                    -1, -1, -1, -1, -1)
                instruction = InstructionStub(
                    info.code_context[0].strip(), position)
                method = info.function
                native_frames.append({
                    'instruction': instruction,
                    'method': method,
                    'class': None
                })
            frames.extend(native_frames)

        self.set_property('frames', frames)
Esempio n. 8
0
    def initialize(self, _context, includeNativeFrames=True):
        frames = []
        context = _context
        while True:
            if not context:
                break
            instruction = helpers.get_current_instruction(context)
            frames.append({
                'instruction': None if instruction is None
                else str(instruction),

                'location': None if instruction is None
                else instruction.source_file_position,

                'method': helpers.get_current_method(context),
                'class': helpers.get_type(context)
            })
            context = helpers.get_caller_context(context)
        frames.pop()
        frames.reverse()

        if includeNativeFrames:
            native_frames = []
            for frame in inspect.trace()[1:]:
                location = yaql_expression.YaqlExpressionFilePosition(
                    os.path.abspath(frame[1]), frame[2],
                    -1, -1, -1, -1, -1)
                method = frame[3]
                native_frames.append({
                    'instruction': frame[4][0].strip(),
                    'location': location,
                    'method': method,
                    'class': None
                })
            frames.extend(native_frames)

        self.set_property('frames', frames)