Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于寻找字段和内部类的处理? #64

Open
Tresalute opened this issue Dec 15, 2021 · 0 comments
Open

关于寻找字段和内部类的处理? #64

Tresalute opened this issue Dec 15, 2021 · 0 comments

Comments

@Tresalute
Copy link

  1. 第一个问题是寻找字段时提示查找不到,然后抛出一个错误,我通过定位源代码并手动更改了一下修复了这个问题(我不知道这是否是科学的,我的代码能力很差。注释的部分是出现问题的代码。)

`

file: jni_env.py

function: get_object_field

@native_method
def get_object_field(self, mu, env, obj_idx, field_id):
    obj = self.get_reference(obj_idx)

    if not isinstance(obj, jobject):
        raise ValueError('Expected a jobject.')

    field = obj.value.find_field_by_id(field_id)
    # field = obj.value.__class__.find_field_by_id(field_id) 《《《

    if field is None:
        # TODO: Proper Java error?
        raise RuntimeError("Could not find field %d in object %s by id." % (field_id, obj.value.jvm_name))

    logger.debug("JNIEnv->GetObjectField(%s, %s <%s>) was called" % (obj.value.jvm_name,
                                                                     field.name,
                                                                     field.signature))

    return getattr(obj.value, field.name)

`
2. 我在模拟调试某个so文件时,他对内部类的相关属性进行了操作,AEmu目前似乎不支持这个功能(也可能是我没弄对?)
下面是出现的Debug信息

2021-12-15 17:29:09,826 DEBUG androidemu.java.jni_env | JNIEnv->FindClass(android/app/ActivityThread$AppBindData) was called
2021-12-15 17:29:13,362 DEBUG androidemu.java.jni_env | JNIEnv->GetFieldId(3 [android/app/ActivityThread$AppBindData], info, Landroid/app/LoadedApk;) was called

我正在试图添加一些新的功能来解决这个问题,但没有什么太好的想法。
希望得到一些意见或帮助。
感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant