std::unique_ptr<MemMap> map, bool verify, bool verify_checksum, std::string* error_msg) { ScopedTrace trace(std::string("Open dex file from mapped-memory ") + location); CHECK(map.get() != nullptr); if (map->Size() < sizeof(DexFile::Header)) { *error_msg = StringPrintf( "D...
在调用中,mem_map->Begin() 返回内存映射的起始地址,mem_map->Size() 返回映射区域的大小,然后将它们以及其他参数传递给 OpenMemory 函数。 看第二处 DexFile::Open 函数,通过OatFile取得DexFile失败走这个,从Zip存档中打开Dex文件。可从/art/runtime/oat_file_manager.cc中OatFileManager::OpenDexFilesFrom...
1、dalvik_system_DexFile.cc 的 DexFile_createCookieWithDirectBuffer 函数 在DexFile_createCookieWithDirectBuffer 函数中 , 调用的 memcpy 方法中的 dex_mem_map->Begin() 就是 dex 文件的起始地址 , length 是 dex 文件的长度 , 这里可以将内存中的 dex 数据导出 ; 代码语言:javascript 代码运行次数:0 ...
理清.dex、.odex、ART、AOT、OAT 等近似名称的概念和意义。 APK 生成 apk的打包过程 最终apk 内的代码文件为 .dex 文件。 APK 安装运行 基础概念 AOT:编译方式,运行前编译。 JIT:编译方式,动态编译。 Dalvik:Android 5.0 之前默认虚拟机。 ART:Android 5.0 及其之后默认虚拟机。 OAT:Android 私有 ELF 文件格式...
在调用中,mem_map->Begin() 返回内存映射的起始地址,mem_map->Size() 返回映射区域的大小,然后将它们以及其他参数传递给 OpenMemory 函数。 看第二处 DexFile::Open 函数,通过OatFile取得DexFile失败走这个,从Zip存档中打开Dex文件。可从/art/runtime/oat_file_manager.cc中OatFileManager::OpenDexFilesFrom...
std::vector<std::unique_ptr<constDexFile>>OatFileManager::OpenDexFilesFromOat(constchar*dex_location,jobject class_loader,jobjectArray dex_elements,constOatFile**out_oat_file,std::vector<std::string>*error_msgs){ScopedTracetrace(__FUNCTION__);CHECK(dex_location!=nullptr);CHECK(error_msgs!
behavior when accessing// any of the sections via a pointer.CHECK_ALIGNED(begin_, alignof(Header));InitializeSectionsFromMapList();} 源码地址 : /art/runtime/dex_file.cc#DexFile 总结( 兼容 InMemoryDexClassLoader 和 DexClassLoader 两种类加载器的 脱壳点 )...
以boot.art为例,它分为Image Section和Bitmap Section区域。每个Section在文件中的偏移量和大小由ImageSection类来描述。 主要Section介绍:Bitmap Section: Bitmap区域是一个位图,用于描述Object Section里各个Object的地址,以8字节对齐。如果一个比特位的值为1,则它指向Object Section中的一个O...
std::unique_ptr<MemMap> map, bool verify, bool verify_checksum, std::string* error_msg) { ScopedTrace trace(std::string("Open dex file from mapped-memory ") + location); CHECK(map.get() != nullptr); if (map->Size() < sizeof(DexFile::Header)) { ...
static const DexFile* CreateDexFile(JNIEnv* env, std::unique_ptr<MemMap> dex_mem_map) {std::string location = StringPrintf("Anonymous-DexFile@%p-%p",dex_mem_map->Begin(),dex_mem_map->End());std::string error_message;std::unique_ptr<const DexFile> dex_file(DexFile::Open(location...