From 0cc6ab6c5104f565a0a3256b5b2b31c6383be189 Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Tue, 20 Mar 2012 22:57:52 +0800 Subject: Add ELF extractor to oatdump. (cherry picked from commit 0228e7eacadb1c829e4e1064bec0792c2696e66f) Change-Id: I649b14b6f8ec9ba43f82c3670f88b064ac008ada --- src/oat_file.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/oat_file.h') diff --git a/src/oat_file.h b/src/oat_file.h index 3243fe2..8ef8308 100644 --- a/src/oat_file.h +++ b/src/oat_file.h @@ -211,10 +211,39 @@ class OatFile { DISALLOW_COPY_AND_ASSIGN(OatDexFile); }; + class OatElfImage { + public: + const byte* begin() const { + return elf_addr_; + } + + const byte* end() const { + return (elf_addr_ + elf_size_); + } + + size_t size() const { + return elf_size_; + } + + private: + OatElfImage(const OatFile* oat_file, const byte* addr, uint32_t size); + + const OatFile* oat_file_; + const byte* elf_addr_; + uint32_t elf_size_; + + friend class OatFile; + DISALLOW_COPY_AND_ASSIGN(OatElfImage); + }; + const OatDexFile* GetOatDexFile(const std::string& dex_file_location, bool warn_if_not_found = true) const; std::vector GetOatDexFiles() const; + const OatElfImage* GetOatElfImage(size_t i) const { + return oat_elf_images_[i]; + } + size_t Size() const { return End() - Begin(); } @@ -237,6 +266,8 @@ class OatFile { typedef std::map Table; Table oat_dex_files_; + std::vector oat_elf_images_; + friend class OatClass; friend class OatDexFile; friend class OatDumper; // For GetBase and GetLimit -- cgit v1.1