Increase / Use / Modify smali registers

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:54:43

问题


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.

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

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.

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.



来源:https://stackoverflow.com/questions/38501985/increase-use-modify-smali-registers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!