1 //===-- ZipFileResolver.h ---------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_HOST_ZIPFILERESOLVER_H 10 #define LLDB_HOST_ZIPFILERESOLVER_H 11 12 #include "lldb/lldb-private.h" 13 14 namespace lldb_private { 15 16 /// In Android API level 23 and above, bionic dynamic linker is able to load 17 /// .so file directly from APK or .zip file. This is a utility class to resolve 18 /// the file spec in order to get the zip path and the .so file offset and size 19 /// if the file spec contains "zip_path!/so_path". 20 /// https://android.googlesource.com/platform/bionic/+/master/ 21 /// android-changes-for-ndk-developers.md# 22 /// opening-shared-libraries-directly-from-an-apk 23 class ZipFileResolver { 24 public: 25 enum FileKind { 26 eFileKindInvalid = 0, 27 eFileKindNormal, 28 eFileKindZip, 29 }; 30 31 static bool ResolveSharedLibraryPath(const FileSpec &file_spec, 32 FileKind &file_kind, 33 std::string &file_path, 34 lldb::offset_t &so_file_offset, 35 lldb::offset_t &so_file_size); 36 }; 37 38 } // end of namespace lldb_private 39 40 #endif // LLDB_HOST_ZIPFILERESOLVER_H 41