|
typedef struct KUNAI::DEX::Disassembler::_handler_data | handler_data |
| Information for the handler of exceptions, handler type, the start address of it and basic blocks.
|
|
typedef struct KUNAI::DEX::Disassembler::_exceptions_data | exceptions_data |
| Information for the exceptions in the code.
|
|
using | instructions_t = std::unordered_map< EncodedMethod *, std::vector< std::unique_ptr< Instruction > > > |
| For those who just want the full set of instructions it is possible to retrieve a vector with all the instructions from the method, it is not needed that these are sorted in any way
|
|
|
| Disassembler ()=default |
| Constructor of the internal Disassembler for Dalvik.
|
|
void | set_parser (Parser *parser) |
| Set the parser for the disassembler.
|
|
std::unique_ptr< Instruction > | disassemble_instruction (std::uint32_t opcode, std::vector< uint8_t > &bytecode, std::size_t index) |
| Get an instruction object from the op.
|
|
std::vector< std::int64_t > | determine_next (Instruction *instruction, std::uint64_t curr_idx) |
| Determine given the last instruction the next instruction to run, the bytecode is retrieved from a :class:EncodedMethod. The offsets are calculated in number of bytes from the start of the method. Note, the offsets inside the bytecode are denoted in 16 bits units but method returns actual byte offsets.
|
|
std::vector< std::int64_t > | determine_next (std::uint64_t curr_idx) |
| Same as the other determine_next but the instruction we give is the instruction last_instr that Disassembler stores.
|
|
std::int16_t | get_conditional_jump_target (Instruction *instr) |
| Given an instruction check if it is a conditional jump and retrieve in that case the target of the jump.
|
|
std::int32_t | get_unconditional_jump_target (Instruction *instr) |
| Given an instruction check if it is an unconditional jump and retrieve in that case the target of the jump.
|
|
std::vector< exceptions_data > | determine_exception (EncodedMethod *method) |
| Retrieve information from possible exception code inside of a method.
|
|
◆ determine_exception()
Retrieve information from possible exception code inside of a method.
- Parameters
-
method | method to extract exception data |
- Returns
- exception data in a vector
◆ determine_next() [1/2]
std::vector< std::int64_t > KUNAI::DEX::Disassembler::determine_next |
( |
Instruction * |
instruction, |
|
|
std::uint64_t |
curr_idx |
|
) |
| |
Determine given the last instruction the next instruction to run, the bytecode is retrieved from a :class:EncodedMethod. The offsets are calculated in number of bytes from the start of the method. Note, the offsets inside the bytecode are denoted in 16 bits units but method returns actual byte offsets.
- Parameters
-
instruction | instruction to obtain the next instructions |
curr_idx | Current idx to calculate the newer one |
- Returns
- list of different offsets where code can go after the current instruction. Instructions like
if
or switch
have more than one target, but throw
, return
and goto
have just one. If entered opcode is not a branch instruction, next instruction is returned.
◆ determine_next() [2/2]
std::vector< std::int64_t > KUNAI::DEX::Disassembler::determine_next |
( |
std::uint64_t |
curr_idx | ) |
|
Same as the other determine_next
but the instruction we give is the instruction last_instr
that Disassembler stores.
- Parameters
-
curr_idx | Current idx to calculate the newer one |
- Returns
- list of different offsets where code can go after the current instruction. Instructions like
if
or switch
have more than one target, but throw
, return
and goto
have just one. If entered opcode is not a branch instruction, next instruction is returned.
◆ disassemble_instruction()
std::unique_ptr< Instruction > KUNAI::DEX::Disassembler::disassemble_instruction |
( |
std::uint32_t |
opcode, |
|
|
std::vector< uint8_t > & |
bytecode, |
|
|
std::size_t |
index |
|
) |
| |
Get an instruction object from the op.
- Parameters
-
opcode | op code of the instruction to return |
bytecode | reference to the bytecode for disassembly |
index | index of the current instruction to analyze |
- Returns
- unique pointer to the disassembled Instruction
◆ get_conditional_jump_target()
std::int16_t KUNAI::DEX::Disassembler::get_conditional_jump_target |
( |
Instruction * |
instr | ) |
|
Given an instruction check if it is a conditional jump and retrieve in that case the target of the jump.
- Parameters
-
instr | instruction to retrieve the target of the jump |
- Returns
- target of a conditional jump
◆ get_unconditional_jump_target()
std::int32_t KUNAI::DEX::Disassembler::get_unconditional_jump_target |
( |
Instruction * |
instr | ) |
|
Given an instruction check if it is an unconditional jump and retrieve in that case the target of the jump.
- Parameters
-
instr | instruction to retrieve the target of the jump |
- Returns
- target of an unconditional jump
◆ set_parser()
void KUNAI::DEX::Disassembler::set_parser |
( |
Parser * |
parser | ) |
|
|
inline |
Set the parser for the disassembler.
- Parameters
-
parser | parser to use in the disassembler |
The documentation for this class was generated from the following file: