16#ifndef LIEF_DEX_FILE_H
17#define LIEF_DEX_FILE_H
43 using classes_t = std::unordered_map<std::string, Class*>;
48 using methods_t = std::vector<std::unique_ptr<Method>>;
52 using strings_t = std::vector<std::unique_ptr<std::string>>;
56 using types_t = std::vector<std::unique_ptr<Type>>;
64 using fields_t = std::vector<std::unique_ptr<Field>>;
76 const std::string&
name()
const;
78 void name(
const std::string& name);
93 bool has_class(
const std::string& class_name)
const;
136 std::string
save(
const std::string& path =
"",
bool deoptimize =
true)
const;
138 std::vector<uint8_t>
raw(
bool deoptimize =
true)
const;
150 void add_class(std::unique_ptr<Class> cls);
152 static void deoptimize_nop(uint8_t* inst_ptr, uint32_t value);
153 static void deoptimize_return(uint8_t* inst_ptr, uint32_t value);
154 static void deoptimize_invoke_virtual(uint8_t* inst_ptr, uint32_t value,
OPCODES new_inst);
155 static void deoptimize_instance_field_access(uint8_t* inst_ptr, uint32_t value,
OPCODES new_inst);
158 std::string location_;
170 std::vector<uint8_t> original_data_;
Class which represents a DEX Class (i.e. a Java/Kotlin class)
Definition DEX/Class.hpp:35
Class that represents a DEX file.
Definition DEX/File.hpp:39
void accept(Visitor &visitor) const override
std::vector< std::unique_ptr< Type > > types_t
Definition DEX/File.hpp:56
it_const_methods methods() const
Return an iterator over all the DEX::Method used in this DEX file.
void location(const std::string &location)
Class * get_class(const std::string &class_name)
std::vector< uint8_t > raw(bool deoptimize=true) const
it_const_fields fields() const
Return an iterator over all the DEX::Field used in this DEX file.
std::unordered_map< std::string, Class * > classes_t
Definition DEX/File.hpp:43
std::string save(const std::string &path="", bool deoptimize=true) const
Extract the current dex file and deoptimize it.
std::vector< std::unique_ptr< Class > > classes_list_t
Definition DEX/File.hpp:44
std::vector< std::unique_ptr< std::string > > strings_t
Definition DEX/File.hpp:52
it_const_types types() const
Type pool.
Class * get_class(size_t index)
const Header & header() const
DEX header.
it_const_strings strings() const
String pool.
it_const_classes classes() const
All classes used in the DEX file
dex2dex_info_t dex2dex_info() const
De-optimize information.
const std::string & location() const
Location of this file.
const Class * get_class(const std::string &class_name) const
Return the DEX::Class object associated with the given name.
it_const_prototypes prototypes() const
bool has_class(const std::string &class_name) const
Check if the given class name exists.
File(const File ©)=delete
friend std::ostream & operator<<(std::ostream &os, const File &file)
const Class * get_class(size_t index) const
Return the DEX::Class object associated with the given index.
const MapList & map() const
DEX Map.
std::vector< std::unique_ptr< Field > > fields_t
Definition DEX/File.hpp:64
it_prototypes prototypes()
Prototype pool.
File & operator=(const File ©)=delete
std::vector< std::unique_ptr< Method > > methods_t
Definition DEX/File.hpp:48
const std::string & name() const
Name of this file.
std::string dex2dex_json_info() const
De-optimize information as JSON.
void name(const std::string &name)
std::vector< std::unique_ptr< Prototype > > prototypes_t
Definition DEX/File.hpp:60
dex_version_t version() const
Version of the current DEX file.
Class which represents the map_list structure that follows the main DEX header.
Definition MapList.hpp:37
Class which parses a DEX file to produce a DEX::File object.
Definition DEX/Parser.hpp:38
Definition Visitor.hpp:224
Iterator which returns reference on container's values.
Definition iterators.hpp:48
OPCODES
The Dalvik Opcodes.
Definition instructions.hpp:32
uint32_t dex_version_t
Definition DEX/types.hpp:23
std::unordered_map< Class *, dex2dex_class_info_t > dex2dex_info_t
Definition deopt.hpp:29
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41