Native 启动-动态/静态&libc &linker
https://www.cnblogs.com/ilocker/p/4645308.html
https://www.cnblogs.com/ilocker/p/4645308.html
修改LD_PRELOAD hook java native 库函数
https://blog.csdn.net/m0_57036414/article/details/126811772
Native malloc_debug &wrap
https://developer.android.google.cn/ndk/guides/wrap-script
https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md
malloc_debug 使用
https://www.cnblogs.com/zzcperf/articles/11615655.html
https://www.cnblogs.com/zzcperf/p/9563389.html
malloc hook 方案实现
https://cloud.tencent.com/developer/article/1817357
bionic/libc/bionic/libc_init_dynamic.cpp
__libc_init(...)
->
__libc_init_malloc(...)
->
bionic/libc/bionic/malloc_common_dynamic.cpp
100 static constexpr char kHooksSharedLib[] = "libc_malloc_hooks.so";
101 static constexpr char kHooksPrefix[] = "hooks";
102 static constexpr char kHooksPropertyEnable[] = "libc.debug.hooks.enable";
103 static constexpr char kHooksEnvEnable[] = "LIBC_HOOKS_ENABLE";
104
105 static constexpr char kDebugSharedLib[] = "libc_malloc_debug.so";
106 static constexpr char kDebugPrefix[] = "debug";
107 static constexpr char kDebugPropertyOptions[] = "libc.debug.malloc.options";
108 static constexpr char kDebugPropertyProgram[] = "libc.debug.malloc.program";
109 static constexpr char kDebugEnvOptions[] = "LIBC_DEBUG_MALLOC_OPTIONS";
kDebugEnvOptions 如果设置了,则options 就取设置的值;如果没有设置再判断kDebugPropertyOptions,如果设置了,options 就取其值,再判断kDebugPropertyProgram,如果设置了但是跟当前processName 不同,则返回false,否则返回true;
返回true,就会InstallHooks
返回false,则会判断kHooksEnvEnable和kHooksPropertyEnable 跟上面kDebugEnvOptions和kDebugPropertyOptions判断一样,
返回true ,options 会清空并InstallHooks
bionic/libc/bionic/malloc_heapprofd.cpp
bionic/libc/bionic/osvelte_malloc_debug.cpp