コード例 #1
0
ファイル: script.py プロジェクト: B-Rich/gcc-python-plugin
def verify_traces(optpass, fun):
    # Only run in one pass
    # FIXME: should we be adding our own pass for this?
    if optpass.name == '*warn_function_return':
        if fun:
            traces = get_traces(fun)

            # We should have a single trace
            #print('traces: %r' % traces)
            assert len(traces) == 1
            state = traces[0].states[-1]
            print('_Py_NoneStruct.ob_refcnt: %s'
                  % state.get_value_of_field_by_varname('_Py_NoneStruct', 'ob_refcnt'))
            print('state.return_rvalue: %r' % state.return_rvalue)
コード例 #2
0
def verify_traces(optpass, fun):
    # Only run in one pass
    # FIXME: should we be adding our own pass for this?
    if optpass.name == '*warn_function_return':
        if fun:
            traces = get_traces(fun)

            # We should have two traces
            # print('traces: %r' % traces)
            assert len(traces) == 2

            # Verify the "success" trace:
            state = traces[0].states[-1]
            print('Trace 0:')
            print('  returned: %r' % state.return_rvalue)

            # Verify the "fail" trace:
            state = traces[1].states[-1]
            print('Trace 1:')
            print('  returned: %r' % state.return_rvalue)