Module ida_name
[frames] | no frames]

Module ida_name

IDA Plugin SDK API wrapper: name

Classes
  NearestName
Utility class to help find the nearest name in a given ea/name dictionary
  ea_name_t
Proxy of C++ ea_name_t class.
  ea_name_vec_t
Proxy of C++ qvector< ea_name_t > class.
Functions
str
append_struct_fields(disp, n, path, flags, delta, appzero)
Append names of struct fields to a name if the name is a struct name.
 
calc_gtn_flags(fromaddr, ea)
Calculate flags for get_ea_name() function
str
cleanup_name(ea, name, flags=0)
 
del_debug_names(ea1, ea2)
bool
del_global_name(ea)
bool
del_local_name(ea)
str
demangle_name(name, disable_mask, demreq=DQT_FULL)
Demangle a name.
str
extract_name(line, x)
Extract a name or address from the specified string.
bool
force_name(ea, name, flags=0)
qstring
get_colored_demangled_name(ea, inhibitor, demform, gtn_flags=0)
qstring
get_colored_long_name(ea, gtn_flags=0)
qstring
get_colored_name(ea)
qstring
get_colored_short_name(ea, gtn_flags=0)
bool
get_cp_validity(kind, cp, endcp=wchar32_t(-1))
Is the given codepoint (or range) acceptable in the given context? If 'endcp' is not BADCP, it is considered to be the end of the range: [cp, endcp), and is not included in the range
str
get_debug_name(ea_ptr, how)
ea_t
get_debug_name_ea(name)
 
get_debug_names(names, ea1, ea2)
get_debug_names(ea1, ea2, return_list=False) -> PyObject *
qstring
get_demangled_name(ea, inhibitor, demform, gtn_flags=0)
qstring
get_ea_name(ea, gtn_flags=0)
Get name at the specified address.
qstring
get_long_name(ea, gtn_flags=0)
qstring
get_name(ea)
ea_t
get_name_base_ea(_from, to)
Get address of the name used in the expression for the address
color_t
get_name_color(_from, ea)
Calculate flags for 'get_ea_name()' function.
ea_t
get_name_ea(_from, name)
Get address of the name.
str
get_name_expr(_from, n, ea, off, flags=0x0001)
Convert address to name expression (name with a displacement).
int
get_name_value(_from, name)
Get value of the name.
str
get_nice_colored_name(ea, flags=0)
Get a nice colored name at the specified address.
ea_t
get_nlist_ea(idx)
Get address from the list at 'idx'.
size_t
get_nlist_idx(ea)
Get index of the name in the listreturns the closest match.
char const *
get_nlist_name(idx)
Get name using idx.
size_t
get_nlist_size()
Get number of names in the list.
qstring
get_short_name(ea, gtn_flags=0)
qstring
get_visible_name(ea, gtn_flags=0)
 
hide_name(ea)
Remove name from the list of names
bool
is_ident(name)
Is a valid name? (including ::MangleChars)
bool
is_ident_cp(cp)
Can a character appear in a name? (present in ::NameChars or ::MangleChars)
bool
is_in_nlist(ea)
Is name included into names list?
bool
is_name_defined_locally(pfn, name, ignore_name_def, ea1=BADADDR, ea2=BADADDR)
Is the name defined locally in the specified function?
bool
is_public_name(ea)
bool
is_strlit_cp(cp, specific_ranges=None)
Can a character appear in a string literal (present in ::StrlitChars) If 'specific_ranges' are specified, those will be used instead of the ones corresponding to the current culture (only if ::StrlitChars is configured to use the current culture)
bool
is_uname(name)
Is valid user-specified name? (valid name & !dummy prefix).
bool
is_valid_cp(cp, kind, data=None)
Is the given codepoint acceptable in the given context?
bool
is_valid_typename(name)
Is valid type name?
bool
is_visible_cp(cp)
Can a character be displayed in a name? (present in ::NameChars)
bool
is_weak_name(ea)
bool
make_name_auto(ea)
 
make_name_non_public(ea)
 
make_name_non_weak(ea)
 
make_name_public(ea)
bool
make_name_user(ea)
 
make_name_weak(ea)
 
rebuild_nlist()
Rebuild names list.
 
reorder_dummy_names()
Renumber dummy names.
 
set_cp_validity(kind, cp, endcp=wchar32_t(-1), valid=True)
Mark the given codepoint (or range) as acceptable or unacceptable in the given context If 'endcp' is not BADCP, it is considered to be the end of the range: [cp, endcp), and is not included in the range
bool
set_debug_name(ea, name)
bool
set_dummy_name(_from, ea)
Give an autogenerated (dummy) name.
bool
set_name(ea, name, flags=0)
Set or delete name of an item at the specified address.
 
show_name(ea)
Insert name to the list of names.
PyObject *
validate_name(name, type, flags=0)
Validate a name.
Variables
  CN_KEEP_TRAILING__DIGITS = 1
  DEBNAME_EXACT = 0
  DEBNAME_LOWER = 1
  DEBNAME_NICE = 3
  DEBNAME_UPPER = 2
  DQT_COMPILER = 0
  DQT_FULL = 2
  DQT_NAME_TYPE = 1
  DQT_NPURGED_2 = -2
  DQT_NPURGED_4 = -4
  DQT_NPURGED_8 = -8
  FUNC_IMPORT_PREFIX = '__imp_'
  GETN_APPZERO = 1
  GETN_NODUMMY = 4
  GETN_NOFIXUP = 2
  GNCN_NOCOLOR = 2
  GNCN_NODBGNM = 256
  GNCN_NOFUNC = 8
  GNCN_NOLABEL = 4
  GNCN_NOSEG = 1
  GNCN_PREFDBG = 512
  GNCN_REQFUNC = 64
  GNCN_REQNAME = 128
  GNCN_SEGNUM = 32
  GNCN_SEG_FUNC = 16
  GN_COLORED = 2
  GN_DEMANGLED = 4
  GN_ISRET = 128
  GN_LOCAL = 64
  GN_LONG = 32
  GN_NOT_DUMMY = 512
  GN_NOT_ISRET = 256
  GN_SHORT = 16
  GN_STRICT = 8
  GN_VISIBLE = 1
  MAXNAMELEN = 512
  NT_ABS = 5
  NT_BMASK = 8
  NT_BYTE = 1
  NT_ENUM = 4
  NT_LOCAL = 2
  NT_NONE = 0
  NT_REGVAR = 9
  NT_SEG = 6
  NT_STKVAR = 3
  NT_STROFF = 7
  SN_AUTO = 32
  SN_CHECK = 0
  SN_DELTAIL = 8192
  SN_FORCE = 2048
  SN_IDBENC = 1024
  SN_LOCAL = 512
  SN_NOCHECK = 1
  SN_NODUMMY = 4096
  SN_NOLIST = 128
  SN_NON_AUTO = 64
  SN_NON_PUBLIC = 4
  SN_NON_WEAK = 16
  SN_NOWARN = 256
  SN_PUBLIC = 2
  SN_WEAK = 8
  SWIG_PYTHON_LEGACY_BOOL = 1
  URK_MangleChars = 2
  URK_NameChars = 1
  URK_StrlitChars = 4
  URK_TypeNameChars = 8
  VNT_IDENT = 3
  VNT_STRLIT = 4
  VNT_TYPE = 8
  VNT_UDTMEM = 1
  VNT_VISIBLE = 1
  __package__ = None
  cvar = ??
  ignore_glabel = 4
  ignore_llabel = 2
  ignore_none = 0
  ignore_regvar = 1
  ignore_stkvar = 3
Function Details

append_struct_fields(disp, n, path, flags, delta, appzero)

 

Append names of struct fields to a name if the name is a struct name.

Parameters:
  • disp - displacement from the name (C++: adiff_t *)
  • n - number of operand n which the name appears (C++: int)
  • path - path in the struct. path is an array of id's. maximal length of array is MAXSTRUCPATH . the first element of the array is the structure id. consecutive elements are id's of used union members (if any). (C++: const tid_t *)
  • flags - the input flags. they will be returned if the struct cannot be found. (C++: flags_t)
  • delta - delta to add to displacement (C++: adiff_t)
  • appzero - should append a struct field name if the displacement is zero? (C++: bool)
Returns: str
flags of the innermost struct member or the input flags

calc_gtn_flags(fromaddr, ea)

 

Calculate flags for get_ea_name() function

Parameters:
  • fromaddr - the referring address. May be BADADDR.
  • ea - linear address
Returns:
flags

demangle_name(name, disable_mask, demreq=DQT_FULL)

 

Demangle a name.

Parameters:
  • name - name to demangle (C++: const char *)
  • disable_mask - bits to inhibit parts of demangled name (see MNG_). by the M_COMPILER bits a specific compiler can be selected (see MT_). (C++: uint32)
  • demreq, (C++ - demreq_type_t)
Returns: str
ME_... or MT__ bitmasks from demangle.hpp

extract_name(line, x)

 

Extract a name or address from the specified string.

Parameters:
  • line - input string (C++: const char *)
  • x - x coordinate of cursor (C++: int)
Returns: str
-1 if cannot extract. otherwise length of the name

get_cp_validity(kind, cp, endcp=wchar32_t(-1))

 

Is the given codepoint (or range) acceptable in the given context? If 'endcp' is not BADCP, it is considered to be the end of the range: [cp, endcp), and is not included in the range

Parameters:
  • kind, (C++ - ucdr_kind_t)
  • cp, (C++ - wchar32_t)
  • endcp, (C++ - wchar32_t)
Returns: bool

get_ea_name(ea, gtn_flags=0)

 

Get name at the specified address.

Parameters:
  • ea - linear address (C++: ea_t)
  • gtn_flags - how exactly the name should be retrieved. combination of bits for get_ea_name() function. There is a convenience bits (C++: int)
Returns: qstring
success

get_name_base_ea(_from, to)

 

Get address of the name used in the expression for the address

Parameters:
  • _from - address of the operand which references to the address (C++: ea_t)
  • to - the referenced address (C++: ea_t)
Returns: ea_t
address of the name used to represent the operand

get_name_color(_from, ea)

 

Calculate flags for 'get_ea_name()' function.

Get name color.

Parameters:
  • _from - linear address where the name is used. if not applicable, then should be BADADDR . The kernel returns a local name color if the reference is within a function, i.e. 'from' and 'ea' belong to the same function. (C++: ea_t)
  • ea - linear address (C++: ea_t)
Returns: color_t

get_name_ea(_from, name)

 

Get address of the name. Dummy names (like byte_xxxx where xxxx are hex digits) are parsed by this function to obtain the address. The database is not consulted for them. This function works only with regular names.

Parameters:
  • _from - linear address where the name is used. if not applicable, then should be BADADDR . (C++: ea_t)
  • name - any name in the program or NULL (C++: const char *)
Returns: ea_t
address of the name or BADADDR

get_name_expr(_from, n, ea, off, flags=0x0001)

 

Convert address to name expression (name with a displacement). This function takes into account fixup information and returns a colored name expression (in the form <name> +/- <offset>). It also knows about structure members and arrays. If the specified address doesn't have a name, a dummy name is generated.

Parameters:
  • _from - linear address of instruction operand or data referring to the name. This address will be used to get fixup information, so it should point to exact position of the operand in the instruction. (C++: ea_t)
  • n - number of referencing operand. for data items specify 0 (C++: int)
  • ea - address to convert to name expression (C++: ea_t)
  • off - the value of name expression. this parameter is used only to check that the name expression will have the wanted value. 'off' may be equal to BADADDR but this is discouraged because it prohibits checks. (C++: uval_t)
  • flags - Name expression flags (C++: int)
Returns: str
< 0 if address is not valid, no segment or other failure. otherwise the length of the name expression in characters.

get_name_value(_from, name)

 

Get value of the name. This function knows about: regular names, enums, special segments, etc.

Parameters:
  • _from - linear address where the name is used if not applicable, then should be BADADDR (C++: ea_t)
  • name - any name in the program or NULL (C++: const char *)
Returns: int
Name value result codes

get_nice_colored_name(ea, flags=0)

 

Get a nice colored name at the specified address. Ex:segment:sub+offse tsegment:sub:local_labelsegment:labelsegment:addresssegment:address+of fset

Parameters:
  • ea, (C++ - ea_t)
  • flags, (C++ - int)
Returns: str
the length of the generated name in bytes.

get_nlist_ea(idx)

 

Get address from the list at 'idx'.

Parameters:
  • idx, (C++ - size_t)
Returns: ea_t

get_nlist_idx(ea)

 

Get index of the name in the listreturns the closest match. may return idx >= size.

Parameters:
  • ea, (C++ - ea_t)
Returns: size_t

get_nlist_name(idx)

 

Get name using idx.

Parameters:
  • idx, (C++ - size_t)
Returns: char const *

hide_name(ea)

 

Remove name from the list of names

Parameters:
  • ea - address of the name (C++: ea_t)

is_ident(name)

 

Is a valid name? (including ::MangleChars)

Parameters:
  • name, (C++ - const char *)
Returns: bool

is_ident_cp(cp)

 

Can a character appear in a name? (present in ::NameChars or ::MangleChars)

Parameters:
  • cp, (C++ - wchar32_t)
Returns: bool

is_in_nlist(ea)

 

Is name included into names list?

Parameters:
  • ea, (C++ - ea_t)
Returns: bool

is_name_defined_locally(pfn, name, ignore_name_def, ea1=BADADDR, ea2=BADADDR)

 

Is the name defined locally in the specified function?

Parameters:
  • pfn - pointer to function (C++: func_t *)
  • name - name to check (C++: const char *)
  • ignore_name_def - which names to ignore when checking (C++: ignore_name_def_t)
  • ea1 - the starting address of the range inside the function (optional) (C++: ea_t)
  • ea2 - the ending address of the range inside the function (optional) (C++: ea_t)
Returns: bool
true if the name has been defined

is_strlit_cp(cp, specific_ranges=None)

 

Can a character appear in a string literal (present in ::StrlitChars) If 'specific_ranges' are specified, those will be used instead of the ones corresponding to the current culture (only if ::StrlitChars is configured to use the current culture)

Parameters:
  • cp, (C++ - wchar32_t)
  • specific_ranges, (C++ - const rangeset_crefvec_t *)
Returns: bool

is_uname(name)

 

Is valid user-specified name? (valid name & !dummy prefix).

Parameters:
  • name - name to test. may be NULL. (C++: const char *)
Returns: bool

is_valid_cp(cp, kind, data=None)

 

Is the given codepoint acceptable in the given context?

Parameters:
  • cp, (C++ - wchar32_t)
  • kind, (C++ - nametype_t)
  • data, (C++ - void *)
Returns: bool

is_valid_typename(name)

 

Is valid type name?

Parameters:
  • name - name to test. may be NULL. (C++: const char *)
Returns: bool

is_visible_cp(cp)

 

Can a character be displayed in a name? (present in ::NameChars)

Parameters:
  • cp, (C++ - wchar32_t)
Returns: bool

set_cp_validity(kind, cp, endcp=wchar32_t(-1), valid=True)

 

Mark the given codepoint (or range) as acceptable or unacceptable in the given context If 'endcp' is not BADCP, it is considered to be the end of the range: [cp, endcp), and is not included in the range

Parameters:
  • kind, (C++ - ucdr_kind_t)
  • cp, (C++ - wchar32_t)
  • endcp, (C++ - wchar32_t)
  • valid, (C++ - bool)

set_dummy_name(_from, ea)

 

Give an autogenerated (dummy) name. Autogenerated names have special prefixes (loc_...).

Parameters:
  • _from - linear address of the operand which references to the address (C++: ea_t)
  • ea - linear address (C++: ea_t)
Returns: bool

set_name(ea, name, flags=0)

 

Set or delete name of an item at the specified address. An item can be anything: instruction, function, data byte, word, string, structure, etc... Include name into the list of names.

Parameters:
  • ea - linear address. do nothing if ea is not valid (return 0). tail bytes can't have names. (C++: ea_t)
  • name - new name. NULL: do nothing (return 0). "" : delete name. otherwise this is a new name. (C++: const char *)
  • flags - Set name flags . If a bit is not specified, then the corresponding action is not performed and the name will retain the same bits as before calling this function. For new names, default is: non-public, non-weak, non- auto. (C++: int)
Returns: bool

show_name(ea)

 

Insert name to the list of names.

Parameters:
  • ea, (C++ - ea_t)

validate_name(name, type, flags=0)

 

Validate a name. This function replaces all invalid characters in the name with SUBSTCHAR. However, it will return false if name is valid but not allowed to be an identifier (is a register name).

Parameters:
  • name - ptr to name. the name will be modified (C++: qstring *)
  • type - the type of name we want to validate (C++: nametype_t)
  • flags - see SN_* . Only SN_IDBENC is currently considered (C++: int)
Returns: PyObject *
success