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

Move a reference to a register from a string, type, etc example instruction: const-string vAA, string@BBBB. More...

#include <dalvik_instructions.hpp>

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

Public Member Functions

 Instruction21c (std::vector< uint8_t > &bytecode, std::size_t index, Parser *parser)
 
std::uint8_t get_destination () const
 Get the index of the register for destination.
 
TYPES::Operand get_destination_type () const
 Get the type of the destination.
 
std::uint16_t get_source () const
 Get the index used as source operand, this is an index to a string, type, etc...
 
TYPES::Operand get_source_type () const
 Get the type of the source, this time is a KIND the KIND can be various things.
 
const std::string & pretty_print_source () const
 Print a string version of the source.
 
bool is_source_string () const
 Check if source is a string.
 
std::string & get_source_str ()
 get reference of the string this should be called only if is_str == true
 
DVMTypeget_source_dvmtype () const
 Check if source is a DVMType and return a pointer.
 
DVMFundamentalget_source_dvmfundamental () const
 Check if source is a DVMFundamental and return a pointer.
 
DVMClassget_source_dvmclass () const
 check if source is a DVMClass and return a pointer
 
DVMArrayget_source_dvmarray () const
 check if source is a DVMArray and return a pointer
 
FieldIDget_source_field () const
 check if source is a FieldID and return a pointer
 
ProtoIDget_source_proto () const
 Check if source is a ProtoID and return a pointer.
 
MethodIDget_source_method () const
 check if source is a MethodID and return a pointer
 
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

Move a reference to a register from a string, type, etc example instruction: const-string vAA, string@BBBB.

Member Function Documentation

◆ get_destination()

std::uint8_t KUNAI::DEX::Instruction21c::get_destination ( ) const
inline

Get the index of the register for destination.

Returns
index of register

◆ get_destination_type()

TYPES::Operand KUNAI::DEX::Instruction21c::get_destination_type ( ) const
inline

Get the type of the destination.

Returns
return register operand type

◆ get_source()

std::uint16_t KUNAI::DEX::Instruction21c::get_source ( ) const
inline

Get the index used as source operand, this is an index to a string, type, etc...

Returns
value of index

◆ get_source_dvmarray()

DVMArray * KUNAI::DEX::Instruction21c::get_source_dvmarray ( ) const
inline

check if source is a DVMArray and return a pointer

Returns
pointer to DVMArray or nullptr

◆ get_source_dvmclass()

DVMClass * KUNAI::DEX::Instruction21c::get_source_dvmclass ( ) const
inline

check if source is a DVMClass and return a pointer

Returns
pointer to DVMClass or nullptr

◆ get_source_dvmfundamental()

DVMFundamental * KUNAI::DEX::Instruction21c::get_source_dvmfundamental ( ) const
inline

Check if source is a DVMFundamental and return a pointer.

Returns
pointer to DVMFundamental or nullptr

◆ get_source_dvmtype()

DVMType * KUNAI::DEX::Instruction21c::get_source_dvmtype ( ) const
inline

Check if source is a DVMType and return a pointer.

Returns
pointer to DVMType or nullptr

◆ get_source_field()

FieldID * KUNAI::DEX::Instruction21c::get_source_field ( ) const
inline

check if source is a FieldID and return a pointer

Returns
pointer to FieldID or nullptr

◆ get_source_method()

MethodID * KUNAI::DEX::Instruction21c::get_source_method ( ) const
inline

check if source is a MethodID and return a pointer

Returns
pointer to MethodID or nullptr

◆ get_source_proto()

ProtoID * KUNAI::DEX::Instruction21c::get_source_proto ( ) const
inline

Check if source is a ProtoID and return a pointer.

Returns
pointer to ProtoID or nullptr

◆ get_source_str()

std::string & KUNAI::DEX::Instruction21c::get_source_str ( )
inline

get reference of the string this should be called only if is_str == true

Returns
string reference

◆ get_source_type()

TYPES::Operand KUNAI::DEX::Instruction21c::get_source_type ( ) const
inline

Get the type of the source, this time is a KIND the KIND can be various things.

Returns
return KIND type

◆ is_source_string()

bool KUNAI::DEX::Instruction21c::is_source_string ( ) const
inline

Check if source is a string.

Returns
true in case source is a string

◆ pretty_print_source()

const std::string & KUNAI::DEX::Instruction21c::pretty_print_source ( ) const
inline

Print a string version of the source.

Returns
constant reference to string of source

◆ print_instruction() [1/2]

virtual std::string KUNAI::DEX::Instruction21c::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::Instruction21c::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.


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