namespace verifier { class VerifierDeps;
} // namespace verifier
// VDEX files contain extracted DEX files. The VdexFile class maps the file to // memory and provides tools for accessing its individual sections. // // In the description below, D is the number of dex files. // // File format: // VdexFileHeader fixed-length header // VdexSectionHeader[kNumberOfSections] // // Checksum section // VdexChecksum[D] // // Optionally: // DexSection // DEX[0] array of the input DEX files // DEX[1] // ... // DEX[D-1] // // VerifierDeps // 4-byte alignment // uint32[D] DexFileDeps offsets for each dex file // DexFileDeps[D][] verification dependencies // 4-byte alignment // uint32[class_def_size] TypeAssignability offsets (kNotVerifiedMarker for a class // that isn't verified) // uint32 Offset of end of AssignabilityType sets // uint8[] AssignabilityType sets // 4-byte alignment // uint32 Number of strings // uint32[] String data offsets for each string // uint8[] String data
// The format version of the verifier deps header and the verifier deps. // TODO: Revert the dex header checks in VdexFile::IsValid when this is bumped. // Last update: Introduce vdex sections. static constexpr uint8_t kVdexVersion[] = { '0', '2', '7', '\0' };
// Returns nullptr if the vdex file cannot be opened or is not valid.
EXPORT static std::unique_ptr<VdexFile> Open(const std::string& vdex_filename, bool low_4gb,
std::string* error_msg);
// Returns nullptr if the vdex file cannot be opened or is not valid.
EXPORT static std::unique_ptr<VdexFile> Open(int file_fd,
off_t start,
size_t vdex_length, const std::string& vdex_filename, bool low_4gb,
std::string* error_msg);
// This method is for iterating over the dex files in the vdex. If `cursor` is null, // the first dex file is returned. If `cursor` is not null, it must point to a dex // file and this method returns the next dex file if there is one, or null if there // is none.
EXPORT const uint8_t* GetNextDexFileData(const uint8_t* cursor, uint32_t dex_file_index) const;
// Get the location checksum of the dex file number `dex_file_index`.
uint32_t GetLocationChecksum(uint32_t dex_file_index) const {
DCHECK_LT(dex_file_index, GetNumberOfDexFiles()); return GetDexChecksumAt(dex_file_index);
}
// Writes a vdex into `path` and returns true on success. // The vdex will not contain a dex section but will store checksums of `dex_files`, // encoded `verifier_deps`, as well as the current boot class path cheksum and // encoded `class_loader_context`. staticbool WriteToDisk(const std::string& path, const std::vector<const DexFile*>& dex_files, const verifier::VerifierDeps& verifier_deps,
std::string* error_msg);
// Returns true if the dex file checksums stored in the vdex header match // the checksums in `dex_headers`. Both the number of dex files and their // order must match too. bool MatchesDexFileChecksums(const std::vector<const DexFile::Header*>& dex_headers) const;
// Return the name of the underlying `MemMap` of the vdex file, typically the // location on disk of the vdex file. const std::string& GetName() const { return mmap_.GetName();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.