Module index

Module ida_xref

IDA Plugin SDK API wrapper: xref

Global variables

var XREF_ALL
return all references
var XREF_BASE
Reference to the base part of an offset.
var XREF_DATA
return data references only
var XREF_FAR
don't return ordinary flow xrefs
var XREF_MASK
Mask to get xref type.
var XREF_PASTEND
Reference is past item. This bit may be passed to 'add_dref()' functions but it won't be saved in the database. It will prevent the destruction of eventual alignment directives.
var XREF_TAIL
Reference to tail byte in extrn symbols.
var XREF_USER
User specified xref. This xref will not be deleted by IDA. This bit should be combined with the existing xref types ( 'cref_t' & 'dref_t' ) Cannot be used for fl_F xrefs
var dr_I
dr_I = 5
var dr_O
dr_O = 1
var dr_R
dr_R = 3
var dr_S
dr_S = 6
var dr_T
dr_T = 4
var dr_U
dr_U = 0
var dr_W
dr_W = 2
var fl_CF
fl_CF = 16
var fl_CN
fl_CN = 17
var fl_F
fl_F = 21
var fl_JF
fl_JF = 18
var fl_JN
fl_JN = 19
var fl_U
fl_U = 0
var fl_USobsolete
fl_USobsolete = 20

Functions

def add_cref(*args) ‑> bool
Create a code cross-reference.
add_cref(frm, to, type) -> bool
frm: linear address of referencing instruction (C++: ea_t)
to: linear address of referenced instruction (C++: ea_t)
type: cross-reference type (C++: cref_t)
return: success
def add_dref(*args) ‑> bool
Create a data cross-reference.
add_dref(frm, to, type) -> bool
frm: linear address of referencing instruction or data (C++:
ea_t)
to: linear address of referenced data (C++: ea_t)
type: cross-reference type (C++: dref_t)
return: success (may fail if user-defined xref exists from->to)
def calc_switch_cases(*args) ‑> cases_and_targets_t *
calc_switch_cases(ea, si) -> cases_and_targets_t
Get information about a switch's cases.
The returned information can be used as follows:
for idx in range(len(results.cases)):
cur_case = results.cases[idx] for cidx in range(len(cur_case)):
print("case: %d" % cur_case[cidx])
print(" goto 0x%x" % results.targets[idx])
ea: address of the 'indirect jump' instruction
si: switch information
return: a structure with 2 members: 'cases', and 'targets'.
def create_switch_table(*args) ‑> bool
create_switch_table(ea, si) -> bool
Create switch table from the switch information
ea: address of the 'indirect jump' instruction
si: switch information
return: Boolean
def create_switch_xrefs(*args) ‑> bool
create_switch_xrefs(ea, si) -> bool
This function creates xrefs from the indirect jump.
Usually there is no need to call this function directly because the kernel will call it for switch tables
Note: Custom switch information are not supported yet.
ea: address of the 'indirect jump' instruction
si: switch information
return: Boolean
def del_cref(*args) ‑> bool
Delete a code cross-reference.
del_cref(frm, to, expand) -> bool
frm: linear address of referencing instruction (C++: ea_t)
to: linear address of referenced instruction (C++: ea_t)
expand: policy to delete the referenced instruction 1: plan
to delete the referenced instruction if it has no more references. 0: don't delete the referenced instruction even if no more cross-references point to it (C++: bool)
retval: true - if the referenced instruction will be deleted
def del_dref(*args) ‑> void
Delete a data cross-reference.
del_dref(frm, to)
frm: linear address of referencing instruction or data (C++:
ea_t)
to: linear address of referenced data (C++: ea_t)
def delete_switch_table(*args) ‑> void
delete_switch_table(jump_ea, si)
jump_ea: ea_t si: switch_info_t const &
def get_first_cref_from(*args) ‑> ea_t
Get first instruction referenced from the specified instruction. If the specified instruction passes execution to the next instruction then the next instruction is returned. Otherwise the lowest referenced address is returned (remember that xrefs are kept sorted!).
get_first_cref_from(frm) -> ea_t
frm: linear address of referencing instruction (C++: ea_t)
return: first referenced address. If the specified instruction
doesn't reference to other instructions then returns BADADDR .
def get_first_cref_to(*args) ‑> ea_t
Get first instruction referencing to the specified instruction. If the specified instruction may be executed immediately after its previous instruction then the previous instruction is returned. Otherwise the lowest referencing address is returned. (remember that xrefs are kept sorted!).
get_first_cref_to(to) -> ea_t
to: linear address of referenced instruction (C++: ea_t)
return: linear address of the first referencing instruction or
BADADDR .
def get_first_dref_from(*args) ‑> ea_t
Get first data referenced from the specified address.
get_first_dref_from(frm) -> ea_t
frm: linear address of referencing instruction or data (C++:
ea_t)
return: linear address of first (lowest) data referenced from the
specified address. Return BADADDR if the specified instruction/data doesn't reference to anything.
def get_first_dref_to(*args) ‑> ea_t
Get address of instruction/data referencing to the specified data.
get_first_dref_to(to) -> ea_t
to: linear address of referencing instruction or data (C++:
ea_t)
return: BADADDR if nobody refers to the specified data.
def get_first_fcref_from(*args) ‑> ea_t
get_first_fcref_from(frm) -> ea_t
frm (C++: ea_t)
def get_first_fcref_to(*args) ‑> ea_t
get_first_fcref_to(to) -> ea_t
to (C++: ea_t)
def get_next_cref_from(*args) ‑> ea_t
Get next instruction referenced from the specified instruction.
get_next_cref_from(frm, current) -> ea_t
frm: linear address of referencing instruction (C++: ea_t)
current: linear address of current referenced instruction This
value is returned by get_first_cref_from() or previous call to get_next_cref_from() functions. (C++: ea_t)
return: next referenced address or BADADDR .
def get_next_cref_to(*args) ‑> ea_t
Get next instruction referencing to the specified instruction.
get_next_cref_to(to, current) -> ea_t
to: linear address of referenced instruction (C++: ea_t)
current: linear address of current referenced instruction This
value is returned by get_first_cref_to() or previous call to get_next_cref_to() functions. (C++: ea_t)
return: linear address of the next referencing instruction or
BADADDR .
def get_next_dref_from(*args) ‑> ea_t
Get next data referenced from the specified address.
get_next_dref_from(frm, current) -> ea_t
frm: linear address of referencing instruction or data (C++:
ea_t)
current: linear address of current referenced data. This value
is returned by get_first_dref_from() or previous call to get_next_dref_from() functions. (C++: ea_t)
return: linear address of next data or BADADDR .
def get_next_dref_to(*args) ‑> ea_t
Get address of instruction/data referencing to the specified data
get_next_dref_to(to, current) -> ea_t
to: linear address of referencing instruction or data (C++:
ea_t)
current: current linear address. This value is returned by
get_first_dref_to() or previous call to get_next_dref_to() functions. (C++: ea_t)
return: BADADDR if nobody refers to the specified data.
def get_next_fcref_from(*args) ‑> ea_t
get_next_fcref_from(frm, current) -> ea_t
frm (C++: ea_t)
current (C++: ea_t)
def get_next_fcref_to(*args) ‑> ea_t
get_next_fcref_to(to, current) -> ea_t
to (C++: ea_t)
current (C++: ea_t)
def has_external_refs(*args) ‑> bool
Has a location external to the function references?
has_external_refs(pfn, ea) -> bool
pfn (C++: func_t *)
ea (C++: ea_t)
def xrefchar(*args) ‑> char
Get character describing the xref type.
xrefchar(xrtype) -> char
xrtype: combination of Cross-Reference type flags and a
cref_t of dref_t value (C++: char)

Classes

class cases_and_targets_t (*args)
Proxy of C++ cases_and_targets_t class.
__init__(self) -> cases_and_targets_t

Instance variables

var cases
cases_and_targets_t_cases_get(self) -> casevec_t
var targets
cases_and_targets_t_targets_get(self) -> eavec_t *
class casevec_t (*args)
Proxy of C++ qvector< qvector< sval_t > > class.
__init__(self) -> casevec_t
x: qvector< qvector< int > > const &

Methods

def add_unique(self, *args) ‑> bool
add_unique(self, x) -> bool
x: qvector< int > const &
def append(self, *args) ‑> qvector< int > &
push_back(self, x)
x: qvector< int > const &
def at(self, *args) ‑> qvector< int > const &
__getitem__(self, i) -> qvector< int > const &
i: size_t
def back(self)
def begin(self, *args) ‑> qvector< qvector< int > >::const_iterator
begin(self) -> qvector< qvector< int > >::iterator
begin(self) -> qvector< qvector< int > >::const_iterator
def capacity(self, *args) ‑> size_t
capacity(self) -> size_t
def clear(self, *args) ‑> void
clear(self)
def empty(self, *args) ‑> bool
empty(self) -> bool
def end(self, *args) ‑> qvector< qvector< int > >::const_iterator
end(self) -> qvector< qvector< int > >::iterator
end(self) -> qvector< qvector< int > >::const_iterator
def erase(self, *args) ‑> qvector< qvector< int > >::iterator
erase(self, it) -> qvector< qvector< int > >::iterator
it: qvector< qvector< int > >::iterator
erase(self, first, last) -> qvector< qvector< int > >::iterator
first: qvector< qvector< int > >::iterator last: qvector< qvector< int > >::iterator
def extract(self, *args) ‑> qvector< int > *
extract(self) -> qvector< int > *
def find(self, *args) ‑> qvector< qvector< int > >::const_iterator
find(self, x) -> qvector< qvector< int > >::iterator
x: qvector< int > const &
find(self, x) -> qvector< qvector< int > >::const_iterator
x: qvector< int > const &
def front(self)
def grow(self, *args) ‑> void
grow(self, x=qvector< int >())
x: qvector< int > const &
def has(self, *args) ‑> bool
has(self, x) -> bool
x: qvector< int > const &
def inject(self, *args) ‑> void
inject(self, s, len)
s: qvector< int > * len: size_t
def insert(self, *args) ‑> qvector< qvector< int > >::iterator
insert(self, it, x) -> qvector< qvector< int > >::iterator
it: qvector< qvector< int > >::iterator x: qvector< int > const &
def pop_back(self, *args) ‑> void
pop_back(self)
def push_back(self, *args) ‑> qvector< int > &
push_back(self, x)
x: qvector< int > const &
def qclear(self, *args) ‑> void
qclear(self)
def reserve(self, *args) ‑> void
reserve(self, cnt)
cnt: size_t
def resize(self, *args) ‑> void
resize(self, _newsize, x)
_newsize: size_t x: qvector< int > const &
resize(self, _newsize)
_newsize: size_t
def size(self, *args) ‑> size_t
size(self) -> size_t
def swap(self, *args) ‑> void
swap(self, r)
r: qvector< qvector< int > > &
def truncate(self, *args) ‑> void
truncate(self)
class xrefblk_t (*args)
Proxy of C++ xrefblk_t class.
__init__(self) -> xrefblk_t

Instance variables

var frm
xrefblk_t_frm_get(self) -> ea_t
var iscode
xrefblk_t_iscode_get(self) -> uchar
var to
xrefblk_t_to_get(self) -> ea_t
var type
xrefblk_t_type_get(self) -> uchar
var user
xrefblk_t_user_get(self) -> uchar

Methods

def first_from(self, *args) ‑> bool
first_from(self, _from, flags) -> bool
_from: ea_t flags: int
def first_to(self, *args) ‑> bool
first_to(self, _to, flags) -> bool
_to: ea_t flags: int
def next_from(self, *args) ‑> bool
next_from(self) -> bool
_from: ea_t _to: ea_t flags: int
def next_to(self, *args) ‑> bool
next_to(self) -> bool
_from: ea_t _to: ea_t flags: int