import org.jf.dexlib2.iface.instruction.Instruction; //导入方法依赖的package包/类

/**

* @param code the codeitem that is contained in this body

* @param method the method that is associated with this body

*/

public DexBody(DexFile dexFile, Method method, RefType declaringClassType) {

MethodImplementation code = method.getImplementation();

if (code == null)

throw new RuntimeException("error: no code for method "+ method.getName());

this.declaringClassType = declaringClassType;

tries = code.getTryBlocks();

methodSignature = method.getDefiningClass() +": "+ method.getReturnType() +" "+ method.getName() +"(";

for (MethodParameter mp: method.getParameters())

methodSignature += mp.getType() +",";

List extends CharSequence> paramTypes = method.getParameterTypes();

if (paramTypes != null) {

parameterTypes = new ArrayList();

for (CharSequence type : paramTypes)

parameterTypes.add(DexType.toSoot(type.toString()));

} else {

parameterTypes = Collections.emptyList();

}

isStatic = Modifier.isStatic(method.getAccessFlags());

numRegisters = code.getRegisterCount();

numParameterRegisters = MethodUtil.getParameterRegisterCount(method);

if (!isStatic)

numParameterRegisters--;

instructions = new ArrayList();

instructionAtAddress = new HashMap();

registerLocals = new Local[numRegisters];

int address = 0;

for (Instruction instruction : code.getInstructions()) {

DexlibAbstractInstruction dexInstruction = fromInstruction(instruction, address);

instructions.add(dexInstruction);

instructionAtAddress.put(address, dexInstruction);

Debug.printDbg(" put instruction '", dexInstruction ,"' at 0x", Integer.toHexString(address));

address += instruction.getCodeUnits();

}

// Check taken from Android's dalvik/libdex/DexSwapVerify.cpp

if (numParameterRegisters > numRegisters)

throw new RuntimeException("Malformed dex file: insSize (" + numParameterRegisters

+ ") > registersSize (" + numRegisters + ")");

for (DebugItem di: code.getDebugItems()) {

if (di instanceof ImmutableLineNumber) {

ImmutableLineNumber ln = (ImmutableLineNumber)di;

DexlibAbstractInstruction ins = instructionAtAddress(ln.getCodeAddress());

if (ins == null) {

Debug.printDbg("Line number tag pointing to invalid offset: " + ln.getCodeAddress());

continue;

}

ins.setLineNumber(ln.getLineNumber());

Debug.printDbg("Add line number tag " + ln.getLineNumber() + " for instruction: "

+ instructionAtAddress(ln.getCodeAddress()));

}

}

this.dexFile = dexFile;

}

java instraction_Java Instruction.getCodeUnits方法代码示例相关推荐

  1. java kryo_Kryo框架使用方法代码示例

    Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...

  2. java readtimeout_Java HttpURLConnection.getReadTimeout方法代码示例

    import java.net.HttpURLConnection; //导入方法依赖的package包/类 /** * 得到响应对象 * * @param urlConnection * @retu ...

  3. java invalidate_Java Component.invalidate方法代码示例

    import java.awt.Component; //导入方法依赖的package包/类 /** Installs the component we will embed to display t ...

  4. java hasmoreelements_Java IOException.hasMoreElements方法代码示例

    import java.io.IOException; //导入方法依赖的package包/类 /** * fileName���� ���� package �������� ������ ���� ...

  5. java methode_Java Method.getTypeParameters方法代码示例

    import java.lang.reflect.Method; //导入方法依赖的package包/类 private void validateRuleMethod(MethodRuleDefin ...

  6. java setmethod_Java Operation.setJavaMethod方法代码示例

    import com.sun.tools.internal.ws.processor.model.Operation; //导入方法依赖的package包/类 private void createJ ...

  7. java cancel_Java RunnableFuture.cancel方法代码示例

    import java.util.concurrent.RunnableFuture; //导入方法依赖的package包/类 @Test public void testSnapshotAsyncC ...

  8. java getevent_Java ActionEvent.getWhen方法代码示例

    import java.awt.event.ActionEvent; //导入方法依赖的package包/类 @Override final public void actionPerformed(A ...

  9. java deepcopy_Java JsonNode.deepCopy方法代码示例

    import com.fasterxml.jackson.databind.JsonNode; //导入方法依赖的package包/类 /** * Applies this schema rule t ...

最新文章

  1. Bonjour/Zeroconf with Arduino
  2. 我的学习生涯(Delphi篇) - 21
  3. 我的LINUX学习之路之二十一之web服务器简单搭建
  4. 532 -数组中的K-diff对
  5. Eclipse启动项目报启动上下文失败问题解决方案总结
  6. ParallelActivity
  7. YUV、YUV420P(YU12和YV12)、NV12、NV21编码
  8. Windows 2012 R2 操作系统搭建DHCP-HA集群
  9. php卡盟主站_php卡盟
  10. 311 复制文件的异常处理
  11. 服务器中tomcat内存溢出配置文件修改
  12. 3D旋转相册代码及详细使用教程
  13. imx6,imx7和am335环境变量配置文件
  14. 搜狗linux 命令行,linux 安装搜狗输入法非caodan命令行方式
  15. Matlab模糊综合评价做空气质量经典例题
  16. 5款主流智能音箱入门款测评:苹果小米华为天猫小度,谁的表现更胜一筹?
  17. 2017 php 免费空间,免费空间免费php空间
  18. 局域网中的IP是怎么确定和分配下来的
  19. Markdown 编辑器设置字体大小颜色
  20. 注册非公共邮箱,学校邮箱

热门文章

  1. php接收get数组参数吗,php获取到data参数,如何与数组匹配
  2. 2021云栖大会丨阿里云发布第四代神龙架构,提供业界首个大规模弹性RDMA加速能力
  3. 毫末智行 Fluid 实践:云原生 AI 让汽车变得“更聪明”
  4. AI 云原生浅谈:好未来 AI 中台实践
  5. 合辑 | 面试必备!18篇Java面试疑难点详解
  6. python数据科学讲解_数据科学的概念-Python数据科学技术详解与商业项目实战精讲 - Python学习网...
  7. 游戏中的方块艺术——从艺术生角度浅谈划时代产品“像素风“
  8. 《王者荣耀》游戏技术总监:技术架构与同步方案上做出改变?
  9. dfs——练习demo3(20届周新杰提供)
  10. 201771010102 常惠琢 《2018面向对象程序设计(Java)》第9周学习总结