增加/使用/修改smali寄存器 [英] Increase / Use / Modify smali registers

查看:412
本文介绍了增加/使用/修改smali寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我们有一个代码,我们试图在其中插入一些调试日志.每个方法我们需要两个额外的寄存器来启用这些日志.

Background: We have a code, in which we are trying to insert some debug logs. We need two extra registers per method to enable these logs.

到目前为止我们尝试过的是: 1)增加寄存器-由于寄存器> v15破坏了代码,因此无法使用.

What we have tried so far: 1) Increasing registers - Did not work as registers > v15 are breaking the code.

2)将v0和v1寄存器值移动到某些高值寄存器,例如v250或其他内容,然后使用v0-v1并将值从vTMP重新分配回v0-v1-没有错误,但应用程序崩溃,出现编译时验证错误.

2) Moving v0 and v1 register values to some high value registers like v250 or something, then use v0-v1 and reassign values back from vTMP to v0-v1 - No errors but app crashes with Compile time verification error.

推荐答案

听起来您已经很好地理解了1)为何有问题.

It sounds like you have a good grasp of why 1) is problematic.

重新:2)-如果您收到验证错误,则表示您在错误地进行了修改.要对此进行调试,您需要查看art和/或dalvik在首次加载dex文件时(通常在应用程序安装时)报告的实际验证错误.这些错误通常非常好,并且可以提供足够的信息来查明问题所在.

Re: 2) - if you're getting verification errors, then you're doing the modification incorrectly. To debug this, you'll want to look at the actual verification errors reported by art and/or dalvik when it first loads the dex file (typically at application install time). These errors are usually pretty good and give enough info to pinpoint the problem.

您可能会考虑尝试做您需要做的事情而不分配任何新的寄存器.例如您可以使用新功能创建一个新方法,然后只需简单地插入对该方法的方法调用,然后传入所需的任何值/对象即可.

You might consider trying to do what you need to do without allocating any new registers. e.g. You could create a new method with your new functionality and simply insert a method call to that method and pass in whatever values/objects that it needs.

这篇关于增加/使用/修改smali寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆