KUNAI Static Analyzer
Kunai is a library for doing static binary analysis of Dalvik.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
KUNAI::DEX::Instruction31t Class Reference

Fill given array with indicated data. Reference must be an array of primitives. Also used for specifying switch tables Example: fill-array-data vAA, +BBBBBBBB. More...

#include <dalvik_instructions.hpp>

Inheritance diagram for KUNAI::DEX::Instruction31t:
Inheritance graph
[legend]
Collaboration diagram for KUNAI::DEX::Instruction31t:
Collaboration graph
[legend]

Public Types

enum  type_of_switch_t { PACKED_SWITCH = 0 , SPARSE_SWITCH , NONE_SWITCH }
 Enum specifying the type of switch for the data table.
 

Public Member Functions

 Instruction31t (std::vector< uint8_t > &bytecode, std::size_t index, Parser *parser)
 
std::uint8_t get_ref_register () const
 get the register used as reference for switch/array
 
TYPES::Operand get_ref_register_type () const
 Get the type of the reference register.
 
std::int32_t get_offset () const
 Return the offset to the table with packed data.
 
TYPES::Operand get_offset_type () const
 Return the type of the offset.
 
type_of_switch_t get_type_of_switch () const
 Get the type of switch in case the instruction is a switch.
 
PackedSwitchget_packed_switch ()
 Get the pointer to a packed switch in case it exists.
 
SparseSwitchget_sparse_switch ()
 Get the pointer to sparse switch in case it exists.
 
void set_packed_switch (PackedSwitch *packed_switch)
 Set the pointer to the PackedSwitch.
 
void set_sparse_switch (SparseSwitch *sparse_switch)
 Set the pointer to the SparseSwitch.
 
virtual std::string print_instruction ()
 Return a string with the representation of the instruction.
 
virtual void print_instruction (std::ostream &os)
 Print the instruction on a given stream.
 
- Public Member Functions inherited from KUNAI::DEX::Instruction
 Instruction (std::vector< uint8_t > &bytecode, std::size_t index, dexinsttype_t instruction_type)
 Constructor of the Instruction, here is applied the parsing of the opcodes.
 
 Instruction (std::vector< uint8_t > &bytecode, std::size_t index, dexinsttype_t instruction_type, std::uint32_t length)
 
virtual ~Instruction ()=default
 Destructor of the instruction.
 
virtual TYPES::Kind get_kind () const
 Get the kind of instruction, use a DalvikOpcodes function.
 
virtual dexinsttype_t get_instruction_type () const
 Get the instruction type from the enum.
 
virtual std::uint32_t get_instruction_length () const
 Get the length of the instruction.
 
virtual std::uint32_t get_instruction_opcode () const
 Get the opcode of the instruction.
 
virtual void set_address (std::uint64_t address)
 Set the address of the instruction.
 
virtual std::uint64_t get_address () const
 Get the address of the instruction.
 
virtual const std::span< std::uint8_t > & get_opcodes ()
 Return the op codes in raw from the instruction.
 
virtual bool is_terminator ()
 Check if the instruction is a terminator (branch, ret, multibranch)
 
virtual bool has_side_effects () const
 Instruction has or can have some side effect.
 
virtual bool may_throw () const
 May throw an exception.
 

Additional Inherited Members

- Protected Attributes inherited from KUNAI::DEX::Instruction
std::span< std::uint8_t > op_codes
 Opcodes of the instruction.
 
std::uint32_t length
 Length of the instruction.
 
std::uint32_t op
 op code from the instruction
 
std::uint64_t address
 address of the instruction
 

Detailed Description

Fill given array with indicated data. Reference must be an array of primitives. Also used for specifying switch tables Example: fill-array-data vAA, +BBBBBBBB.

Member Function Documentation

◆ get_offset()

std::int32_t KUNAI::DEX::Instruction31t::get_offset ( ) const
inline

Return the offset to the table with packed data.

Returns
offset to packed data

◆ get_offset_type()

TYPES::Operand KUNAI::DEX::Instruction31t::get_offset_type ( ) const
inline

Return the type of the offset.

Returns
return OFFSET type

◆ get_packed_switch()

PackedSwitch * KUNAI::DEX::Instruction31t::get_packed_switch ( )
inline

Get the pointer to a packed switch in case it exists.

Returns
pointer to PackedSwitch

◆ get_ref_register()

std::uint8_t KUNAI::DEX::Instruction31t::get_ref_register ( ) const
inline

get the register used as reference for switch/array

Returns
index of register for reference

◆ get_ref_register_type()

TYPES::Operand KUNAI::DEX::Instruction31t::get_ref_register_type ( ) const
inline

Get the type of the reference register.

Returns
return REGISTER type

◆ get_sparse_switch()

SparseSwitch * KUNAI::DEX::Instruction31t::get_sparse_switch ( )
inline

Get the pointer to sparse switch in case it exists.

Returns
pointer to SparseSwitch

◆ get_type_of_switch()

type_of_switch_t KUNAI::DEX::Instruction31t::get_type_of_switch ( ) const
inline

Get the type of switch in case the instruction is a switch.

Returns
type of switch value

◆ print_instruction() [1/2]

virtual std::string KUNAI::DEX::Instruction31t::print_instruction ( )
inlinevirtual

Return a string with the representation of the instruction.

Returns
string with instruction

Reimplemented from KUNAI::DEX::Instruction.

◆ print_instruction() [2/2]

virtual void KUNAI::DEX::Instruction31t::print_instruction ( std::ostream &  os)
inlinevirtual

Print the instruction on a given stream.

Parameters
osstream where to print the instruction

Reimplemented from KUNAI::DEX::Instruction.

◆ set_packed_switch()

void KUNAI::DEX::Instruction31t::set_packed_switch ( PackedSwitch packed_switch)
inline

Set the pointer to the PackedSwitch.

Parameters
packed_switchpossible instruction pointed

◆ set_sparse_switch()

void KUNAI::DEX::Instruction31t::set_sparse_switch ( SparseSwitch sparse_switch)
inline

Set the pointer to the SparseSwitch.

Parameters
sparse_switchpossible instruction pointed

The documentation for this class was generated from the following file: