16#ifndef LIEF_OAT_BINARY_H
17#define LIEF_OAT_BINARY_H
20#include "LIEF/visibility.h"
22#include "LIEF/ELF/Binary.hpp"
23#include "LIEF/OAT/Header.hpp"
24#include "LIEF/DEX/deopt.hpp"
45 using dex_files_t = std::vector<std::unique_ptr<DEX::File>>;
49 using classes_t = std::unordered_map<std::string, Class*>;
50 using classes_list_t = std::vector<std::unique_ptr<Class>>;
54 using oat_dex_files_t = std::vector<std::unique_ptr<DexFile>>;
58 using methods_t = std::vector<std::unique_ptr<Method>>;
62 using dex2dex_info_t = std::unordered_map<const DEX::File*, DEX::dex2dex_info_t>;
85 bool has_class(
const std::string& class_name)
const;
92 Class* get_class(
const std::string& class_name);
98 Class* get_class(
size_t index);
104 dex2dex_info_t dex2dex_info()
const;
106 std::string dex2dex_json_info();
108 bool has_vdex()
const {
109 return vdex_ !=
nullptr;
113 return bin->
format() == Binary::FORMATS::OAT;
120 LIEF_API
friend std::ostream& operator<<(std::ostream& os,
const Binary& binary);
124 void add_class(std::unique_ptr<Class> cls);
128 dex_files_t dex_files_;
129 oat_dex_files_t oat_dex_files_;
132 classes_list_t classes_list_;
135 std::unique_ptr<VDEX::File> vdex_;
Abstract binary that exposes an uniform API for the different executable file formats.
Definition Abstract/Binary.hpp:39
FORMATS format() const
Executable format (ELF, PE, Mach-O) of the underlying binary.
Definition Abstract/Binary.hpp:98
Class which represents an ELF binary.
Definition ELF/Binary.hpp:59
Definition OAT/Binary.hpp:41
it_dex_files dex_files()
Iterator over LIEF::DEX::File.
void accept(Visitor &visitor) const override
Method associated with the visitor pattern.
const Class * get_class(size_t index) const
Return the LIEF::OAT::Class at the given index or a nullptr if it does not exist.
bool has_class(const std::string &class_name) const
Check if the current OAT has the given class.
const Class * get_class(const std::string &class_name) const
Return the LIEF::OAT::Class with the given name or a nullptr if the class can't be found.
it_oat_dex_files oat_dex_files()
Iterator over LIEF::OAT::DexFile.
it_const_methods methods() const
Iterator over LIEF::OAT::Method.
it_const_classes classes() const
Iterator over LIEF::OAT::Class.
const Header & header() const
OAT Header.
Definition OAT/Class.hpp:35
Class to parse an OAT file to produce an OAT::Binary.
Definition OAT/Parser.hpp:38
Definition Visitor.hpp:219
Iterator which returns reference on container's values.
Definition iterators.hpp:48
LIEF namespace.
Definition Abstract/Binary.hpp:32