Android 中 liblog 和 libcutils 的编译 trick -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

    在做 Android Porting 的时候,我们修改的 liblog

    而在调试的时候,我用 gcc -E 展开 LOGE的调用就是 __android_log_print

    它只在 system/core/liblog/logd_write.c, 但我每次修改 __android_log_print 都不生效

    因此我怀疑有别的 symbol 取代了它

    用readelf 查看,果然 liblog.so 中有的symbol, 在 libcutils 中也有

    ?

    $ /opt/broadcom/stbgcc-4.5.3-2.4/bin/mipsel-linux-readelf -s out/target/product/alien_broadcom_stb/system/lib/liblog.so | grep print

    10: 0000328c  324 FUNC   GLOBAL DEFAULT   9 android_log_printLogLine

    15: 00001c28  160 FUNC   GLOBAL DEFAULT   9 __android_log_print

    18: 00001cc8  144 FUNC   GLOBAL DEFAULT   9 __android_log_buf_print

    21: 00001bb8  112 FUNC   GLOBAL DEFAULT   9 __android_log_vprint

    27: 000033d0  444 FUNC   GLOBAL DEFAULT   9 logprint_run_tests

    34: 00005950    0 FUNC   GLOBAL DEFAULT UND printf

    42: 000058f0    0 FUNC   GLOBAL DEFAULT UND vsnprintf

    45: 000058c0    0 FUNC   GLOBAL DEFAULT UND fprintf

    71: 000057f0    0 FUNC   GLOBAL DEFAULT UND snprintf

    $ /opt/broadcom/stbgcc-4.5.3-2.4/bin/mipsel-linux-readelf -s out/target/product/alien_broadcom_stb/system/lib/libcutils | grep print

    payne@payne-desktop:~/bjb$ /opt/broadcom/7425b2/stbgcc-4.5.3-2.4/bin/mipsel-linux-readelf -s out/target/product/alien_broadcom_stb/system/lib/libcutils.so | grep print

    40: 00006078  324 FUNC   GLOBAL DEFAULT   9 android_log_printLogLine

    68: 00010670    8 FUNC   GLOBAL DEFAULT   9 mspace_footprint

    81: 00004ab4  144 FUNC   GLOBAL DEFAULT   9 __android_log_buf_print

    110: 000049c4  112 FUNC   GLOBAL DEFAULT   9 __android_log_vprint

    142: 000106c4    8 FUNC   GLOBAL DEFAULT   9 mspace_max_footprint

    149: 000061bc  444 FUNC   GLOBAL DEFAULT   9 logprint_run_tests

    204: 000187a0    0 FUNC   GLOBAL DEFAULT UND sprintf

    206: 00018790    0 FUNC   GLOBAL DEFAULT UND vsnprintf

    215: 00018720    0 FUNC   GLOBAL DEFAULT UND fprintf

    246: 00018670    0 FUNC   GLOBAL DEFAULT UND asprintf

    276: 00004a34  128 FUNC   GLOBAL DEFAULT   9 __android_log_print

    284: 00018520    0 FUNC   GLOBAL DEFAULT UND snprintf

    参看了 libcutils 的Android.mk, 它果然把 liblog 的静态库,加入到自己,

Android 中 liblog 和 libcutils 的编译 trick

电脑资料

Android 中 liblog 和 libcutils 的编译 trick》(https://www.unjs.com)。程序运行的 libcutils 中 __android_log_print 始终没有更新,所以看不到改动结果。

    因此,每次用 mmm system/core/liblog 重编译 liblog的时候,也要同时用 mmm system/core/libcutils 更新 libctils

最新文章