Giter Club home page Giter Club logo

Comments (7)

waruqi avatar waruqi commented on May 29, 2024

看 backtrace ,也不再 dlopen 里。感觉没啥关系么。。

backtrace:
#0 pc 0006b770 /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime8callMainERKNS_7String8EP7_jclassRKNS_6VectorIS1_EE+291)
#1 pc 00004e58 /data/app/~~2WcSGjc0VXJbQn2IdpFZ9Q==/com.hxsmart.imateinterface--sTWIuB5wXXN5ZlHScoXMA==/lib/arm/libiMateBmpDecode.so

from byopen.

billzbh avatar billzbh commented on May 29, 2024

看 backtrace ,也不再 dlopen 里。感觉没啥关系么。。

backtrace:
#0 pc 0006b770 /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime8callMainERKNS_7String8EP7_jclassRKNS_6VectorIS1_EE+291)
#1 pc 00004e58 /data/app/~~2WcSGjc0VXJbQn2IdpFZ9Q==/com.hxsmart.imateinterface--sTWIuB5wXXN5ZlHScoXMA==/lib/arm/libiMateBmpDecode.so

这个libiMateBmpDecode.so是我自己写的JNI,它通过 by_dlopen打开另一个so库时出了上面的问题。为了对比,我使用默认的 dlopen替换 by_dlopen 打开同一个so库,是正常的。

from byopen.

waruqi avatar waruqi commented on May 29, 2024

可以跟下,具体挂哪行了

from byopen.

billzbh avatar billzbh commented on May 29, 2024

可以跟下,具体挂哪行了

代码这里写上这个:
static JNIEnv* by_jni_getenv()
{
if (!g_tls_jnienv)
{
by_fake_dlctx_ref_t dlctx = by_fake_dlopen("libandroid_runtime.so", BY_RTLD_NOW);
if (dlctx)
{
typedef by_pointer_t (*getJNIEnv_t)();
getJNIEnv_t getJNIEnv = (getJNIEnv_t)by_fake_dlsym(dlctx, "_ZN7android14AndroidRuntime9getJNIEnvEv");

        by_trace("get jnienv: 1111");
        if (getJNIEnv){
            by_trace("get jnienv: 2222");
            g_tls_jnienv = getJNIEnv();
        }
        by_trace("get jnienv: 33333");
        by_fake_dlclose(dlctx);
    }

    // trace
    by_trace("get jnienv: %p", g_tls_jnienv);
}
return g_tls_jnienv;

}

我打开跟踪日志,日志打印到这里就没了。

2021-04-21 15:44:35.130 29742-29742/com.hxsmart.imateinterface I/iMateIdReaderJNI: so-name[4]: libZKwlt2bmp.so == libHSwlt2bmp.so == libwlt2bmpAll.so == libDXwlt2bmp.so
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: fake_dlopen: baseaddr: 0xedc07000, realpath: /system/lib/libandroid_runtime.so, filesize: 1256488
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(0): type: 0, name:
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(1): type: 7, name: .note.android.ident
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(2): type: 7, name: .note.gnu.build-id
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(3): type: 11, name: .dynsym
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: .dynsym: 0xc038b1ac 3437
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(4): type: 1879048191, name: .gnu.version
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(5): type: 1879048190, name: .gnu.version_r
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(6): type: 1879048182, name: .gnu.hash
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(7): type: 3, name: .dynstr
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: .dynstr: 0xc039c524
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(8): type: 1610612737, name: .rel.dyn
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(9): type: 1879047936, name: .relr.dyn
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(10): type: 1879048193, name: .ARM.exidx
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(11): type: 9, name: .rel.plt
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(12): type: 1, name: .ARM.extab
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(13): type: 1, name: .rodata
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(14): type: 1, name: .text
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(15): type: 1, name: .plt
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(16): type: 1, name: .data.rel.ro
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(17): type: 15, name: .fini_array
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(18): type: 14, name: .init_array
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(19): type: 6, name: .dynamic
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(20): type: 1, name: .got
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(21): type: 1, name: .got.plt
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(22): type: 1, name: .data
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(23): type: 8, name: .bss
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(24): type: 1879048195, name: .ARM.attributes
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(25): type: 3, name: .shstrtab
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: elf section(26): type: 1, name: .gnu_debugdata
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: dlsym(_ZN7android14AndroidRuntime9getJNIEnvEv): found at .dynsym/0xedc72771 = 0xedc07000 + 6b771 - 0x0
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: get jnienv: 1111
2021-04-21 15:44:35.144 29742-29742/com.hxsmart.imateinterface I/byOpen: get jnienv: 2222

from byopen.

waruqi avatar waruqi commented on May 29, 2024

那就是调用跪了。。你可以想办法绕过下,或者改下源码,自己透传 jnienv 进去

from byopen.

waruqi avatar waruqi commented on May 29, 2024

应该修复了,可以再试试

from byopen.

sunzj avatar sunzj commented on May 29, 2024

getJNIEnv 在native里调用不行,
image

from byopen.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.