当前位置: 首页>>代码示例>>Java>>正文


Java Analyzer.getFrames方法代码示例

本文整理汇总了Java中org.objectweb.asm.tree.analysis.Analyzer.getFrames方法的典型用法代码示例。如果您正苦于以下问题:Java Analyzer.getFrames方法的具体用法?Java Analyzer.getFrames怎么用?Java Analyzer.getFrames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.objectweb.asm.tree.analysis.Analyzer的用法示例。


在下文中一共展示了Analyzer.getFrames方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printAnalyzerResult

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
static void printAnalyzerResult(MethodNode method, Analyzer<BasicValue> a,
        final PrintWriter pw) {
    Frame<BasicValue>[] frames = a.getFrames();
    Textifier t = new Textifier();
    TraceMethodVisitor mv = new TraceMethodVisitor(t);

    pw.println(method.name + method.desc);
    for (int j = 0; j < method.instructions.size(); ++j) {
        method.instructions.get(j).accept(mv);

        StringBuilder sb = new StringBuilder();
        Frame<BasicValue> f = frames[j];
        if (f == null) {
            sb.append('?');
        } else {
            for (int k = 0; k < f.getLocals(); ++k) {
                sb.append(getShortName(f.getLocal(k).toString()))
                        .append(' ');
            }
            sb.append(" : ");
            for (int k = 0; k < f.getStackSize(); ++k) {
                sb.append(getShortName(f.getStack(k).toString()))
                        .append(' ');
            }
        }
        while (sb.length() < method.maxStack + method.maxLocals + 1) {
            sb.append(' ');
        }
        pw.print(Integer.toString(j + 100000).substring(1));
        pw.print(" " + sb + " : " + t.text.get(t.text.size() - 1));
    }
    for (int j = 0; j < method.tryCatchBlocks.size(); ++j) {
        method.tryCatchBlocks.get(j).accept(mv);
        pw.print(" " + t.text.get(t.text.size() - 1));
    }
    pw.println();
}
 
开发者ID:ItzSomebody,项目名称:DirectLeaks-AntiReleak-Remover,代码行数:38,代码来源:CheckClassAdapter.java

示例2: getArrayFrames

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
private Frame[] getArrayFrames(MethodNode mn) {
	try {
		Analyzer a = new Analyzer(new BooleanArrayInterpreter());
		a.analyze(cn.name, mn);
		return a.getFrames();
	} catch (Exception e) {
		logger.info("[Array] Error during analysis: " + e);
		return null;
	}
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:11,代码来源:BooleanTestabilityTransformation.java

示例3: getFrames

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
private void getFrames(MethodNode mn, String className) {
	try {
		Analyzer a = new Analyzer(new BooleanValueInterpreter(mn.desc,
		        (mn.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC));
		a.analyze(className, mn);
		this.frames = a.getFrames();
	} catch (Exception e) {
		logger.info("1. Error during analysis: " + e);
		//e.printStackTrace();
		// TODO: Handle error
	}

}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:14,代码来源:MutationInstrumentation.java

示例4: printAnalyzerResult

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
static void printAnalyzerResult(MethodNode method, Analyzer<BasicValue> a,
        final PrintWriter pw) {
    Frame<BasicValue>[] frames = a.getFrames();
    Textifier t = new Textifier();
    TraceMethodVisitor mv = new TraceMethodVisitor(t);

    pw.println(method.name + method.desc);
    for (int j = 0; j < method.instructions.size(); ++j) {
        method.instructions.get(j).accept(mv);

        StringBuffer s = new StringBuffer();
        Frame<BasicValue> f = frames[j];
        if (f == null) {
            s.append('?');
        } else {
            for (int k = 0; k < f.getLocals(); ++k) {
                s.append(getShortName(f.getLocal(k).toString()))
                        .append(' ');
            }
            s.append(" : ");
            for (int k = 0; k < f.getStackSize(); ++k) {
                s.append(getShortName(f.getStack(k).toString()))
                        .append(' ');
            }
        }
        while (s.length() < method.maxStack + method.maxLocals + 1) {
            s.append(' ');
        }
        pw.print(Integer.toString(j + 100000).substring(1));
        pw.print(" " + s + " : " + t.text.get(t.text.size() - 1));
    }
    for (int j = 0; j < method.tryCatchBlocks.size(); ++j) {
        method.tryCatchBlocks.get(j).accept(mv);
        pw.print(" " + t.text.get(t.text.size() - 1));
    }
    pw.println();
}
 
开发者ID:bcleenders,项目名称:Bramspr,代码行数:38,代码来源:CheckClassAdapter.java

示例5: getFrames

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
public static <V extends Value> Frame<V>[] getFrames(Analyzer<V> analyzer,
        String clazz, MethodNode method) {

    try {
        analyzer.analyze(clazz, method);
    } catch (AnalyzerException e) {
        throw new DiSLFatalException("Cause by AnalyzerException : \n"
                + e.getMessage());
    }

    return analyzer.getFrames();
}
 
开发者ID:mur47x111,项目名称:svm-fasttagging,代码行数:13,代码来源:FrameHelper.java

示例6: printMethod

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
private static void printMethod(final Analyzer a, final PrintStream out, final MethodNode method) {
    final Frame[] frames = a.getFrames();

    final Textifier textifier = new Textifier();
    final TraceMethodVisitor mv = new TraceMethodVisitor(textifier);

    out.println(method.name + method.desc);
    for (int j = 0; j < method.instructions.size(); ++j) {
        method.instructions.get(j).accept(mv);

        final StringBuffer s = new StringBuffer();
        final Frame f = frames[j];
        if (f == null) {
            s.append('?');
        } else {
            for (int k = 0; k < f.getLocals(); ++k) {
                s.append(getShortName(f.getLocal(k).toString())).append(' ');
            }
            s.append(" : ");
            for (int k = 0; k < f.getStackSize(); ++k) {
                s.append(getShortName(f.getStack(k).toString())).append(' ');
            }
        }
        while (s.length() < method.maxStack + method.maxLocals + 1) {
            s.append(' ');
        }
        out.print(Integer.toString(j + 100000).substring(1));
        out.print(" " + s + " : " + textifier.text.get(j));
    }
    for (int j = 0; j < method.tryCatchBlocks.size(); ++j) {
        ((TryCatchBlockNode) method.tryCatchBlocks.get(j)).accept(mv);
        out.print(" " + textifier.text.get(method.instructions.size()+j));
    }
    out.println(" MAXSTACK " + method.maxStack);
    out.println(" MAXLOCALS " + method.maxLocals);
    out.println();
}
 
开发者ID:hammacher,项目名称:javaslicer,代码行数:38,代码来源:Transformer.java

示例7: printAnalyzerResult

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
static void printAnalyzerResult(
    MethodNode method,
    Analyzer<BasicValue> a,
    final PrintWriter pw)
{
    Frame<BasicValue>[] frames = a.getFrames();
    Textifier t = new Textifier();
    TraceMethodVisitor mv = new TraceMethodVisitor(t);

    pw.println(method.name + method.desc);
    for (int j = 0; j < method.instructions.size(); ++j) {
        method.instructions.get(j).accept(mv);

        StringBuffer s = new StringBuffer();
        Frame<BasicValue> f = frames[j];
        if (f == null) {
            s.append('?');
        } else {
            for (int k = 0; k < f.getLocals(); ++k) {
                s.append(getShortName(f.getLocal(k).toString()))
                        .append(' ');
            }
            s.append(" : ");
            for (int k = 0; k < f.getStackSize(); ++k) {
                s.append(getShortName(f.getStack(k).toString()))
                        .append(' ');
            }
        }
        while (s.length() < method.maxStack + method.maxLocals + 1) {
            s.append(' ');
        }
        pw.print(Integer.toString(j + 100000).substring(1));
        pw.print(" " + s + " : " + t.text.get(t.text.size() - 1));
    }
    for (int j = 0; j < method.tryCatchBlocks.size(); ++j) {
        method.tryCatchBlocks.get(j).accept(mv);
        pw.print(" " + t.text.get(t.text.size() - 1));
    }
    pw.println();
}
 
开发者ID:nxmatic,项目名称:objectweb-asm-4.0,代码行数:41,代码来源:CheckClassAdapter.java

示例8: verify

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
/**
 * Checks a given class
 *
 * @param cr a <code>ClassReader</code> that contains bytecode for the analysis.
 * @param dump true if bytecode should be printed out not only when errors are found.
 * @param pw write where results going to be printed
 */
public static void verify(ClassReader cr, boolean dump, PrintWriter pw) {
    ClassNode cn = new ClassNode();
    cr.accept(new CheckClassAdapter(cn), true);

    List methods = cn.methods;
    for (int i = 0; i < methods.size(); ++i) {
        MethodNode method = (MethodNode) methods.get(i);
        if (method.instructions.size() > 0) {
            Analyzer a = new Analyzer(new SimpleVerifier(Type.getType("L"
                    + cn.name + ";"),
                    Type.getType("L" + cn.superName + ";"),
                    (cn.access & Opcodes.ACC_INTERFACE) != 0));
            try {
                a.analyze(cn.name, method);
                if (!dump) {
                    continue;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            Frame[] frames = a.getFrames();

            TraceMethodVisitor mv = new TraceMethodVisitor();

            pw.println(method.name + method.desc);
            for (int j = 0; j < method.instructions.size(); ++j) {
                ((AbstractInsnNode) method.instructions.get(j)).accept(mv);

                StringBuffer s = new StringBuffer();
                Frame f = frames[j];
                if (f == null) {
                    s.append('?');
                } else {
                    for (int k = 0; k < f.getLocals(); ++k) {
                        s.append(getShortName(f.getLocal(k).toString()))
                                .append(' ');
                    }
                    s.append(" : ");
                    for (int k = 0; k < f.getStackSize(); ++k) {
                        s.append(getShortName(f.getStack(k).toString()))
                                .append(' ');
                    }
                }
                while (s.length() < method.maxStack + method.maxLocals + 1)
                {
                    s.append(' ');
                }
                pw.print(Integer.toString(j + 100000).substring(1));
                pw.print(" " + s + " : " + mv.buf); // mv.text.get(j));
            }
            for (int j = 0; j < method.tryCatchBlocks.size(); ++j) {
                ((TryCatchBlockNode) method.tryCatchBlocks.get(j)).accept(mv);
                pw.print(" " + mv.buf);
            }
            pw.println();
        }
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:66,代码来源:CheckClassAdapter.java

示例9: verify

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
/**
 * Checks a given class
 * 
 * @param cr a <code>ClassReader</code> that contains bytecode for the analysis. 
 * @param dump true if bytecode should be printed out not only when errors are found.
 * @param pw write where results going to be printed
 */
public static void verify(ClassReader cr, boolean dump, PrintWriter pw) {
    ClassNode cn = new ClassNode();
    cr.accept(new CheckClassAdapter(cn), true);

    List methods = cn.methods;
    for (int i = 0; i < methods.size(); ++i) {
        MethodNode method = (MethodNode) methods.get(i);
        if (method.instructions.size() > 0) {
            Analyzer a = new Analyzer(new SimpleVerifier(Type.getType("L"
                    + cn.name + ";"),
                    Type.getType("L" + cn.superName + ";"),
                    (cn.access & Opcodes.ACC_INTERFACE) != 0));
            try {
                a.analyze(cn.name, method);
                if (!dump) {
                    continue;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            Frame[] frames = a.getFrames();

            TraceMethodVisitor mv = new TraceMethodVisitor();

            pw.println(method.name + method.desc);
            for (int j = 0; j < method.instructions.size(); ++j) {
                ((AbstractInsnNode) method.instructions.get(j)).accept(mv);
                
                StringBuffer s = new StringBuffer();
                Frame f = frames[j];
                if (f == null) {
                    s.append('?');
                } else {
                    for (int k = 0; k < f.getLocals(); ++k) {
                        s.append(getShortName(f.getLocal(k).toString()))
                                .append(' ');
                    }
                    s.append(" : ");
                    for (int k = 0; k < f.getStackSize(); ++k) {
                        s.append(getShortName(f.getStack(k).toString()))
                                .append(' ');
                    }
                }
                while (s.length() < method.maxStack + method.maxLocals + 1)
                {
                    s.append(' ');
                }
                pw.print(Integer.toString(j + 100000).substring(1));
                pw.print(" " + s + " : " + mv.buf); // mv.text.get(j));
            }
            for (int j = 0; j < method.tryCatchBlocks.size(); ++j) {
                ((TryCatchBlockNode) method.tryCatchBlocks.get(j)).accept(mv);
                pw.print(" " + mv.buf);
            }
            pw.println();
        }
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:66,代码来源:CheckClassAdapter.java

示例10: main

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
    ClassReader cr = new ClassReader("Analysis");
    ClassNode cn = new ClassNode();
    cr.accept(cn, ClassReader.SKIP_DEBUG);

    List<MethodNode> methods = cn.methods;
    for (int i = 0; i < methods.size(); ++i) {
        MethodNode method = methods.get(i);
        if (method.instructions.size() > 0) {
            if (!analyze(cn, method)) {
                Analyzer<?> a = new Analyzer<BasicValue>(
                        new BasicVerifier());
                try {
                    a.analyze(cn.name, method);
                } catch (Exception ignored) {
                }
                final Frame<?>[] frames = a.getFrames();

                Textifier t = new Textifier() {
                    @Override
                    public void visitMaxs(final int maxStack,
                            final int maxLocals) {
                        for (int i = 0; i < text.size(); ++i) {
                            StringBuilder s = new StringBuilder(
                                    frames[i] == null ? "null"
                                            : frames[i].toString());
                            while (s.length() < Math.max(20, maxStack
                                    + maxLocals + 1)) {
                                s.append(' ');
                            }
                            System.err.print(Integer.toString(i + 1000)
                                    .substring(1)
                                    + " "
                                    + s
                                    + " : "
                                    + text.get(i));
                        }
                        System.err.println();
                    }
                };
                MethodVisitor mv = new TraceMethodVisitor(t);
                for (int j = 0; j < method.instructions.size(); ++j) {
                    Object insn = method.instructions.get(j);
                    ((AbstractInsnNode) insn).accept(mv);
                }
                mv.visitMaxs(0, 0);
            }
        }
    }
}
 
开发者ID:lrytz,项目名称:asm-legacy-svn-clone,代码行数:51,代码来源:Analysis.java

示例11: main

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
    ClassReader cr = new ClassReader("Analysis");
    ClassNode cn = new ClassNode();
    cr.accept(cn, ClassReader.SKIP_DEBUG);

    List<MethodNode> methods = cn.methods;
    for (int i = 0; i < methods.size(); ++i) {
        MethodNode method = methods.get(i);
        if (method.instructions.size() > 0) {
            if (!analyze(cn, method)) {
                Analyzer<?> a = new Analyzer<BasicValue>(
                        new BasicVerifier());
                try {
                    a.analyze(cn.name, method);
                } catch (Exception ignored) {
                }
                final Frame<?>[] frames = a.getFrames();

                Textifier t = new Textifier() {
                    @Override
                    public void visitMaxs(final int maxStack,
                            final int maxLocals) {
                        for (int i = 0; i < text.size(); ++i) {
                            StringBuffer s = new StringBuffer(
                                    frames[i] == null ? "null"
                                            : frames[i].toString());
                            while (s.length() < Math.max(20, maxStack
                                    + maxLocals + 1)) {
                                s.append(' ');
                            }
                            System.err.print(Integer.toString(i + 1000)
                                    .substring(1)
                                    + " "
                                    + s
                                    + " : "
                                    + text.get(i));
                        }
                        System.err.println();
                    }
                };
                MethodVisitor mv = new TraceMethodVisitor(t);
                for (int j = 0; j < method.instructions.size(); ++j) {
                    Object insn = method.instructions.get(j);
                    ((AbstractInsnNode) insn).accept(mv);
                }
                mv.visitMaxs(0, 0);
            }
        }
    }
}
 
开发者ID:llbit,项目名称:ow2-asm,代码行数:51,代码来源:Analysis.java

示例12: main

import org.objectweb.asm.tree.analysis.Analyzer; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
    ClassReader cr = new ClassReader("Analysis");
    ClassNode cn = new ClassNode();
    cr.accept(cn, ClassReader.SKIP_DEBUG);

    List<MethodNode> methods = cn.methods;
    for (int i = 0; i < methods.size(); ++i) {
        MethodNode method = methods.get(i);
        if (method.instructions.size() > 0) {
            if (!analyze(cn, method)) {
                Analyzer<?> a = new Analyzer<BasicValue>(new BasicVerifier());
                try {
                    a.analyze(cn.name, method);
                } catch (Exception ignored) {
                }
                final Frame<?>[] frames = a.getFrames();

                Textifier t = new Textifier() {
                    @Override
                    public void visitMaxs(
                        final int maxStack,
                        final int maxLocals)
                    {
                        for (int i = 0; i < text.size(); ++i) {
                            StringBuffer s = new StringBuffer(frames[i] == null
                                    ? "null"
                                    : frames[i].toString());
                            while (s.length() < Math.max(20, maxStack
                                    + maxLocals + 1))
                            {
                                s.append(' ');
                            }
                            System.err.print(Integer.toString(i + 1000)
                                    .substring(1)
                                    + " " + s + " : " + text.get(i));
                        }
                        System.err.println();
                    }
                };
                MethodVisitor mv = new TraceMethodVisitor(t);
                for (int j = 0; j < method.instructions.size(); ++j) {
                    Object insn = method.instructions.get(j);
                    ((AbstractInsnNode) insn).accept(mv);
                }
                mv.visitMaxs(0, 0);
            }
        }
    }
}
 
开发者ID:nxmatic,项目名称:objectweb-asm-4.0,代码行数:50,代码来源:Analysis.java


注:本文中的org.objectweb.asm.tree.analysis.Analyzer.getFrames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。