org.objectweb.asm.tree.analysis.Analyzer.getFrames()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.objectweb.asm.tree.analysis.Analyzer.getFrames()方法的一些代码示例,展示了Analyzer.getFrames()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analyzer.getFrames()方法的具体详情如下:
包路径:org.objectweb.asm.tree.analysis.Analyzer
类名称:Analyzer
方法名:getFrames

Analyzer.getFrames介绍

[英]Returns the symbolic stack frame for each instruction of the last recently analyzed method.
[中]返回最近分析的方法的每条指令的符号堆栈帧。

代码示例

代码示例来源:origin: pxb1988/dex2jar

static void printAnalyzerResult(MethodNode method, Analyzer a, final PrintWriter pw)
    throws IllegalArgumentException {
  Frame[] frames = a.getFrames();
  Textifier t = new Textifier();
  TraceMethodVisitor mv = new TraceMethodVisitor(t);

代码示例来源:origin: pxb1988/dex2jar

static void printAnalyzerResult(MethodNode method, Analyzer a, final PrintWriter pw)
    throws IllegalArgumentException, IllegalAccessException {
  Frame[] frames = a.getFrames();
  Textifier t = new Textifier();
  TraceMethodVisitor mv = new TraceMethodVisitor(t);
  String format = "%05d %-" + (method.maxStack + method.maxLocals + 6) + "s|%s";
  for (int j = 0; j < method.instructions.size(); ++j) {
    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()));
      }
      s.append(" : ");
      for (int k = 0; k < f.getStackSize(); ++k) {
        s.append(getShortName(f.getStack(k).toString()));
      }
    }
    pw.printf(format, j, s, buf.get(t)); // mv.text.get(j));
  }
  for (int j = 0; j < method.tryCatchBlocks.size(); ++j) {
    ((TryCatchBlockNode) method.tryCatchBlocks.get(j)).accept(mv);
    pw.print(" " + buf.get(t));
  }
  pw.println();
  pw.flush();
}

代码示例来源:origin: vsilaev/tascalate-javaflow

Frame getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: net.tascalate.javaflow/net.tascalate.javaflow.providers.asm5

Frame getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: dragome/dragome-sdk

public void visitLabel(Label label)
{
  if (currentIndex < labels.size() && label == labels.get(currentIndex))
  {
    int i= canalyzer.getIndex(nodes.get(currentIndex));
    currentFrame= analyzer.getFrames()[i];
  }
  mv.visitLabel(label);
}

代码示例来源:origin: vsilaev/tascalate-javaflow

Frame getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: vsilaev/tascalate-javaflow

Frame<BasicValue> getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame<BasicValue>[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: vsilaev/tascalate-javaflow

Frame getFrameByNode(AbstractInsnNode node) {
  int insIndex = instructions.indexOf(node);
  Frame[] frames = analyzer.getFrames();
  return null == frames || insIndex >= frames.length ? null : frames[insIndex];
}

代码示例来源:origin: EvoSuite/evosuite

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
  }
}

代码示例来源:origin: EvoSuite/evosuite

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;
  }
}

代码示例来源:origin: org.ow2.asm/asm-debug-all

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);

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

Frame<BasicValue> frame = analyzer.getFrames()[i];
if (frame == null) {
 stringBuilder.append('?');

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

Frame<BasicValue> frame = analyzer.getFrames()[i];
if (frame == null) {
 stringBuilder.append('?');

代码示例来源:origin: org.lwjgl.lwjgl/lwjgl_util

private Frame<BasicValue>[] analyse() throws AnalyzerException {
  final Analyzer<BasicValue> a = new Analyzer<BasicValue>(new SimpleVerifier());
  a.analyze(className, this);
  return a.getFrames();
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

e.printStackTrace();
final Frame[] frames = a.getFrames();

代码示例来源:origin: org.kohsuke.droovy/groovy

e.printStackTrace();
final Frame[] frames = a.getFrames();

代码示例来源:origin: jpcsp/jpcsp

/**
 * Remove the dead code - or unreachable code - from a method.
 * 
 * @param method  the method to be updated
 */
private void removeDeadCode(MethodNode method) {
  try {
    // Analyze the method using the BasicInterpreter.
    // As a result, the computed frames are null for instructions
    // that cannot be reached.
    Analyzer analyzer = new Analyzer(new BasicInterpreter());
    analyzer.analyze(specializedClassName, method);
    Frame[] frames = analyzer.getFrames();
    AbstractInsnNode[] insns = method.instructions.toArray();
    for (int i = 0; i < frames.length; i++) {
      AbstractInsnNode insn = insns[i];
      if (frames[i] == null && insn.getType() != AbstractInsnNode.LABEL) {
        // This instruction was not reached by the analyzer
        method.instructions.remove(insn);
        insns[i] = null;
      }
    }
  } catch (AnalyzerException e) {
    // Ignore error
  }
}

代码示例来源:origin: EvoSuite/evosuite

(mn.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC));
  a.analyze(className, mn);
  currentFrames = a.getFrames();
} catch (Exception e) {
  logger.info("1. Error during analysis: " + e);
      (mn.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC));
  a.analyze(className, mn);
  currentFrames = a.getFrames();
} catch (Exception e) {
  logger.info("2. Error during analysis: " + e);

代码示例来源:origin: net.tascalate.javaflow/net.tascalate.javaflow.providers.asm5

Frame[] frames = a.getFrames();
for (int j = 0; j < methods.size(); j++) {
  MethodInsnNode mnode = (MethodInsnNode) methods.get(j);

代码示例来源:origin: EvoSuite/evosuite

Analyzer a = new Analyzer(new StringBooleanInterpreter());
a.analyze(cn.name, mn);
Frame[] frames = a.getFrames();
AbstractInsnNode node = mn.instructions.getFirst();
boolean done = false;

相关文章