sig
exception Wrong_dex of string
exception Wrong_match of string
exception NOT_YET of string
type dex = {
header : Dex.dex_header;
d_string_ids : Dex.link DynArray.t;
d_type_ids : Dex.link DynArray.t;
d_proto_ids : Dex.proto_id_item DynArray.t;
d_field_ids : Dex.field_id_item DynArray.t;
d_method_ids : Dex.method_id_item DynArray.t;
d_class_defs : Dex.class_def_item DynArray.t;
mutable d_data : Dex.data_item Instr.IM.t;
}
and link = Idx of int | Off of Instr.offset
and dex_header = {
magic : string;
checksum : int64;
signature : char list;
mutable file_size : int;
header_size : int;
endian_tag : Dex.endian;
link : Dex.section;
map_off : Dex.link;
h_string_ids : Dex.section;
h_type_ids : Dex.section;
h_proto_ids : Dex.section;
h_field_ids : Dex.section;
h_method_ids : Dex.section;
h_class_defs : Dex.section;
h_data : Dex.section;
}
and endian = LITTLE | BIG
and section = { size : int; offset : Dex.link; }
and proto_id_item = {
shorty : Dex.link;
mutable return_type : Dex.link;
parameter_off : Dex.link;
}
and field_id_item = {
f_class_id : Dex.link;
mutable f_type_id : Dex.link;
f_name_id : Dex.link;
}
and method_id_item = {
m_class_id : Dex.link;
m_proto_id : Dex.link;
m_name_id : Dex.link;
}
and class_def_item = {
c_class_id : Dex.link;
mutable c_access_flag : int;
mutable superclass : Dex.link;
mutable interfaces : Dex.link;
source_file : Dex.link;
annotations : Dex.link;
mutable class_data : Dex.link;
static_values : Dex.link;
}
and data_item =
MAP_LIST of Dex.map_item list
| TYPE_LIST of Dex.link list
| ANNO_SET_REF of Dex.link list
| ANNO_SET of Dex.link list
| CLASS_DATA of Dex.class_data_item
| CODE_ITEM of Dex.code_item
| STRING_DATA of UTF8.t
| DEBUG_INFO of Dex.debug_info_item
| ANNOTATION of Dex.annotation_item
| STATIC_VALUE of Dex.encoded_value list
| ANNO_DIR of Dex.anno_dir_item
| INSTRUCTION of Instr.instr
| FILL_ARRAY of Dex.fill_array_data
| SWITCH of Dex.switch
and map_item = {
type_of_item : Dex.type_code;
mi_size : int;
mi_offset : Dex.link;
}
and type_code =
TYPE_HEADER_ITEM
| TYPE_STRING_ITEM
| TYPE_TYPE_ID_ITEM
| TYPE_PROTO_ID_ITEM
| TYPE_FIELD_ID_ITEM
| TYPE_METHOD_ID_ITEM
| TYPE_CLASS_DEF_ITEM
| TYPE_MAP_LIST
| TYPE_TYPE_LIST
| TYPE_ANNOTATION_SET_REF_LIST
| TYPE_ANNOTATION_SET_ITEM
| TYPE_CLASS_DATA_ITEM
| TYPE_CODE_ITEM
| TYPE_STRING_DATA_ITEM
| TYPE_DEBUG_INFO_ITEM
| TYPE_ANNOTATION_ITEM
| TYPE_ENCODED_ARRAY_ITEM
| TYPE_ANNOTATION_DIRECTORY_ITEM
and class_data_item = {
mutable static_fields : Dex.encoded_field list;
mutable instance_fields : Dex.encoded_field list;
mutable direct_methods : Dex.encoded_method list;
mutable virtual_methods : Dex.encoded_method list;
}
and encoded_field = { field_idx : Dex.link; f_access_flag : int; }
and encoded_method = {
method_idx : Dex.link;
mutable m_access_flag : int;
code_off : Dex.link;
}
and code_item = {
mutable registers_size : int;
mutable ins_size : int;
mutable outs_size : int;
mutable tries_size : int;
mutable debug_info_off : Dex.link;
mutable insns_size : int;
insns : Dex.link DynArray.t;
mutable tries : Dex.try_item list;
mutable c_handlers : Dex.encoded_catch_handler list;
}
and switch = {
sw_base : Dex.link;
sw_size : int;
sw_keys : int list;
sw_targets : Dex.link list;
}
and fill_array_data = {
ad_width : int;
ad_size : int;
ad_data : Instr.operand list;
}
and try_item = {
start_addr : Dex.link;
end_addr : Dex.link;
handler_off : Dex.link;
}
and encoded_catch_handler = {
e_handlers : Dex.type_addr_pair list;
catch_all_addr : Dex.link;
}
and type_addr_pair = { mutable ch_type_idx : Dex.link; addr : Dex.link; }
and debug_info_item = {
line_start : int;
parameter_name : Dex.link list;
mutable state_machine :
(Dex.state_machine_instr * Instr.operand list) list;
}
and state_machine_instr =
DBG_END_SEQUENCE
| DBG_ADVANCE_PC
| DBG_ADVANCE_LINE
| DBG_START_LOCAL
| DBG_START_LOCAL_EXTENDED
| DBG_END_LOCAL
| DBG_RESTART_LOCAL
| DBG_SET_PROLOGUE_END
| DBG_SET_EPILOGUE_BEGIN
| DBG_SET_FILE
| DBG_SPECIAL
and anno_dir_item = {
class_anno_off : Dex.link;
fields : Dex.anno_off list;
methods : Dex.anno_off list;
parameters : Dex.anno_off list;
}
and anno_off = { target : Dex.link; annotation_off : Dex.link; }
and annotation_item = {
visible : Dex.visibility;
annotation : Dex.encoded_annotation;
}
and visibility = VISIBILITY_BUILD | VISIBILITY_RUNTIME | VISIBILITY_SYSTEM
and encoded_annotation = {
mutable an_type_idx : Dex.link;
elements : Dex.annotation_element list;
}
and annotation_element = {
name_idx : Dex.link;
mutable value : Dex.encoded_value;
}
and encoded_value =
VALUE_BYTE of int64
| VALUE_SHORT of int64
| VALUE_CHAR of int64
| VALUE_INT of int64
| VALUE_LONG of int64
| VALUE_FLOAT of int64
| VALUE_DOUBLE of int64
| VALUE_STRING of int
| VALUE_TYPE of int
| VALUE_FIELD of int
| VALUE_METHOD of int
| VALUE_ENUM of int
| VALUE_ARRAY of Dex.encoded_value list
| VALUE_ANNOTATION of Dex.encoded_annotation
| VALUE_NULL
| VALUE_BOOLEAN of bool
val to_idx : int -> Dex.link
val to_off : int -> Dex.link
val of_idx : Dex.link -> int
val of_off : Dex.link -> int
val opr2idx : Instr.operand -> Dex.link
val opr2off : Instr.operand -> Dex.link
val idx2opr : Dex.link -> Instr.operand
val off2opr : Dex.link -> Instr.operand
val get_off : Dex.link -> Instr.offset
val str_to_endian : string -> Dex.endian
val endian_to_str : Dex.endian -> string
val to_type_code : int -> Dex.type_code
val of_type_code : Dex.type_code -> int
val type_code_to_str : Dex.type_code -> string
val machine_instr_to_str : Dex.state_machine_instr -> string
type access_flag =
ACC_PUBLIC
| ACC_PRIVATE
| ACC_PROTECTED
| ACC_STATIC
| ACC_FINAL
| ACC_SYNCHRONIZED
| ACC_VOLATILE
| ACC_BRIDGE
| ACC_TRANSIENT
| ACC_VARARGS
| ACC_NATIVE
| ACC_INTERFACE
| ACC_ABSTRACT
| ACC_STRICT
| ACC_SYNTHETIC
| ACC_ANNOTATION
| ACC_ENUM
| ACC_CONSTRUCTOR
| ACC_DECLARED_SYNCHRONIZED
type acc_kind = ACC_FOR_CLASSES | ACC_FOR_FIELDS | ACC_FOR_METHODS
val to_acc_flag : Dex.acc_kind -> Dex.access_flag list -> int
val is_interface : int -> bool
val pub : Dex.access_flag list
val spub : Dex.access_flag list
val no_index : int
val no_offset : int
val no_idx : Dex.link
val no_off : Dex.link
val get_data_item : Dex.dex -> Dex.link -> Dex.data_item
val get_ins : Dex.dex -> Dex.link -> Instr.instr
val is_ins : Dex.dex -> Dex.link -> bool
val get_str : Dex.dex -> Dex.link -> string
val find_str : Dex.dex -> string -> Dex.link
val get_ty_str : Dex.dex -> Dex.link -> string
val find_ty_str : Dex.dex -> string -> Dex.link
val ty_comp : Dex.dex -> Dex.link -> Dex.link -> int
val get_ty_lst : Dex.dex -> Dex.link -> Dex.link list
val get_fit : Dex.dex -> Dex.link -> Dex.field_id_item
val get_mit : Dex.dex -> Dex.link -> Dex.method_id_item
val get_pit : Dex.dex -> Dex.method_id_item -> Dex.proto_id_item
val get_argv : Dex.dex -> Dex.method_id_item -> Dex.link list
val get_rety : Dex.dex -> Dex.method_id_item -> Dex.link
val fld_comp : Dex.dex -> Dex.field_id_item -> Dex.field_id_item -> int
val ty_lst_comp : Dex.dex -> Dex.link list -> Dex.link list -> int
val ty_lst_comp_relaxed : Dex.dex -> Dex.link list -> Dex.link list -> int
val mtd_comp : Dex.dex -> Dex.method_id_item -> Dex.method_id_item -> int
val mtd_comp_relaxed :
Dex.dex -> Dex.method_id_item -> Dex.method_id_item -> int
val get_cid_from_fid : Dex.dex -> Dex.link -> Dex.link
val get_cid_from_mid : Dex.dex -> Dex.link -> Dex.link
val get_fld_name : Dex.dex -> Dex.link -> string
val get_mtd_name : Dex.dex -> Dex.link -> string
val get_cid : Dex.dex -> string -> Dex.link
val get_cdef : Dex.dex -> Dex.link -> Dex.class_def_item
val get_superclass : Dex.dex -> Dex.link -> Dex.link
val get_superclasses : Dex.dex -> Dex.link -> Dex.link list
val get_interfaces : Dex.dex -> Dex.link -> Dex.link list
val in_hierarchy : Dex.dex -> (Dex.link -> bool) -> Dex.link -> bool
val is_superclass : Dex.dex -> Dex.link -> Dex.link -> bool
val get_flds : Dex.dex -> Dex.link -> (Dex.link * Dex.field_id_item) list
val get_fldS : Dex.dex -> Dex.link -> (Dex.link * Dex.field_id_item) list
val get_the_fld :
Dex.dex -> Dex.link -> string -> Dex.link * Dex.field_id_item
val own_the_fld : Dex.dex -> Dex.link -> Dex.link -> bool
val get_mtds : Dex.dex -> Dex.link -> (Dex.link * Dex.method_id_item) list
val get_mtdS : Dex.dex -> Dex.link -> (Dex.link * Dex.method_id_item) list
val get_supermethod : Dex.dex -> Dex.link -> Dex.link -> Dex.link
val get_the_mtd :
Dex.dex -> Dex.link -> string -> Dex.link * Dex.method_id_item
val get_the_mtd_shorty :
Dex.dex -> Dex.link -> string -> string -> Dex.link * Dex.method_id_item
val own_the_mtd : Dex.dex -> Dex.link -> Dex.link -> bool
val get_cdata : Dex.dex -> Dex.link -> Dex.link * Dex.class_data_item
val get_emtd : Dex.dex -> Dex.link -> Dex.link -> Dex.encoded_method
val get_citm : Dex.dex -> Dex.link -> Dex.link -> Dex.link * Dex.code_item
val calc_this : Dex.code_item -> int
val empty_section : unit -> Dex.section
val empty_dex : unit -> Dex.dex
val empty_citm : unit -> Dex.code_item
val insrt_data : Dex.dex -> Dex.link -> Dex.data_item -> unit
val rm_data : Dex.dex -> Dex.link -> unit
val insrt_ins : Dex.dex -> Dex.link -> Instr.instr -> unit
val insrt_str : Dex.dex -> Dex.link -> string -> unit
val insrt_ty_lst : Dex.dex -> Dex.link -> Dex.link list -> unit
val insrt_stt : Dex.dex -> Dex.link -> Dex.encoded_value list -> unit
val insrt_citm : Dex.dex -> Dex.link -> Dex.code_item -> unit
end
Web Accessibility