Module index

Module ida_lines

IDA Plugin SDK API wrapper: lines

Global variables

var COLOR_ADDR
COLOR_ADDR = 40
var COLOR_ADDR_SIZE
Size of a tagged address (see 'COLOR_ADDR' )
var COLOR_ALTOP
COLOR_ALTOP = 22
var COLOR_ASMDIR
COLOR_ASMDIR = 27
var COLOR_AUTOCMT
COLOR_AUTOCMT = 4
var COLOR_BG_MAX
Max color number.
var COLOR_BINPREF
COLOR_BINPREF = 20
var COLOR_CHAR
COLOR_CHAR = 10
var COLOR_CNAME
COLOR_CNAME = 37
var COLOR_CODE
Single instruction.
var COLOR_CODNAME
COLOR_CODNAME = 26
var COLOR_COLLAPSED
COLOR_COLLAPSED = 39
var COLOR_CREF
COLOR_CREF = 14
var COLOR_CREFTAIL
COLOR_CREFTAIL = 16
var COLOR_CURITEM
Current item.
var COLOR_CURLINE
Current line.
var COLOR_DATA
Data bytes.
var COLOR_DATNAME
COLOR_DATNAME = 6
var COLOR_DCHAR
COLOR_DCHAR = 30
var COLOR_DEFAULT
Default.
var COLOR_DEMNAME
COLOR_DEMNAME = 8
var COLOR_DNAME
COLOR_DNAME = 7
var COLOR_DNUM
COLOR_DNUM = 31
var COLOR_DREF
COLOR_DREF = 15
var COLOR_DREFTAIL
COLOR_DREFTAIL = 17
var COLOR_DSTR
COLOR_DSTR = 29
var COLOR_ERROR
COLOR_ERROR = 18
var COLOR_ESC
Escape character (Quote next character). This is needed to output '\1' and '\2' characters.
var COLOR_EXTERN
External name definition segment.
var COLOR_EXTRA
COLOR_EXTRA = 21
var COLOR_FG_MAX
COLOR_FG_MAX = 40
var COLOR_HIDLINE
Hidden line.
var COLOR_HIDNAME
COLOR_HIDNAME = 23
var COLOR_IMPNAME
COLOR_IMPNAME = 34
var COLOR_INSN
COLOR_INSN = 5
var COLOR_INV
Escape character (Inverse foreground and background colors). This escape character has no corresponding 'COLOR_OFF' . Its action continues until the next 'COLOR_INV' or end of line.
var COLOR_KEYWORD
COLOR_KEYWORD = 32
var COLOR_LIBFUNC
Library function.
var COLOR_LIBNAME
COLOR_LIBNAME = 24
var COLOR_LOCNAME
COLOR_LOCNAME = 25
var COLOR_LUMFUNC
Lumina function.
var COLOR_LUMINA
COLOR_LUMINA = 52
var COLOR_MACRO
COLOR_MACRO = 28
var COLOR_NUMBER
COLOR_NUMBER = 12
var COLOR_OFF
Escape character (OFF). Followed by a color code ( 'color_t' ).
var COLOR_ON
Escape character (ON). Followed by a color code ( 'color_t' ).
var COLOR_OPND1
COLOR_OPND1 = 41
var COLOR_OPND2
COLOR_OPND2 = 42
var COLOR_OPND3
COLOR_OPND3 = 43
var COLOR_OPND4
COLOR_OPND4 = 44
var COLOR_OPND5
COLOR_OPND5 = 45
var COLOR_OPND6
COLOR_OPND6 = 46
var COLOR_OPND7
COLOR_OPND7 = 47
var COLOR_OPND8
COLOR_OPND8 = 48
var COLOR_PREFIX
COLOR_PREFIX = 19
var COLOR_REG
COLOR_REG = 33
var COLOR_REGCMT
COLOR_REGCMT = 2
var COLOR_REGFUNC
Regular function.
var COLOR_RESERVED1
COLOR_RESERVED1 = 51
var COLOR_RPTCMT
COLOR_RPTCMT = 3
var COLOR_SEGNAME
COLOR_SEGNAME = 35
var COLOR_SELECTED
Selected.
var COLOR_STRING
COLOR_STRING = 11
var COLOR_SYMBOL
COLOR_SYMBOL = 9
var COLOR_UNAME
COLOR_UNAME = 38
var COLOR_UNKNAME
COLOR_UNKNAME = 36
var COLOR_UNKNOWN
Unexplored byte.
var COLOR_VOIDOP
COLOR_VOIDOP = 13
var E_NEXT
E_NEXT = 2000
var E_PREV
E_PREV = 1000
var GENDSM_FORCE_CODE
GENDSM_FORCE_CODE = 1
var GENDSM_MULTI_LINE
GENDSM_MULTI_LINE = 2
var GENDSM_REMOVE_TAGS
GENDSM_REMOVE_TAGS = 4
var PALETTE_SIZE
PALETTE_SIZE = 53
var SCOLOR_ADDR
Hidden address mark.
var SCOLOR_ALTOP
Alternative operand.
var SCOLOR_ASMDIR
Assembler directive.
var SCOLOR_AUTOCMT
Automatic comment.
var SCOLOR_BINPREF
Binary line prefix bytes.
var SCOLOR_CHAR
Char constant in instruction.
var SCOLOR_CNAME
Regular code name.
var SCOLOR_CODNAME
Dummy code name.
var SCOLOR_COLLAPSED
Collapsed line.
var SCOLOR_CREF
Code reference.
var SCOLOR_CREFTAIL
Code reference to tail byte.
var SCOLOR_DATNAME
Dummy Data Name.
var SCOLOR_DCHAR
Char constant in data directive.
var SCOLOR_DEFAULT
Default.
var SCOLOR_DEMNAME
Demangled Name.
var SCOLOR_DNAME
Regular Data Name.
var SCOLOR_DNUM
Numeric constant in data directive.
var SCOLOR_DREF
Data reference.
var SCOLOR_DREFTAIL
Data reference to tail byte.
var SCOLOR_DSTR
String constant in data directive.
var SCOLOR_ERROR
Error or problem.
var SCOLOR_ESC
Escape character (Quote next character)
var SCOLOR_EXTRA
Extra line.
var SCOLOR_FG_MAX
SCOLOR_FG_MAX = '('
var SCOLOR_HIDNAME
Hidden name.
var SCOLOR_IMPNAME
Imported name.
var SCOLOR_INSN
Instruction.
var SCOLOR_INV
Escape character (Inverse colors)
var SCOLOR_KEYWORD
Keywords.
var SCOLOR_LIBNAME
Library function name.
var SCOLOR_LOCNAME
Local variable name.
var SCOLOR_MACRO
Macro.
var SCOLOR_NUMBER
Numeric constant in instruction.
var SCOLOR_OFF
Escape character (OFF)
var SCOLOR_ON
Escape character (ON)
var SCOLOR_OPND1
SCOLOR_OPND1 = ')'
var SCOLOR_OPND2
SCOLOR_OPND2 = '*'
var SCOLOR_OPND3
SCOLOR_OPND3 = '+'
var SCOLOR_OPND4
SCOLOR_OPND4 = ','
var SCOLOR_OPND5
SCOLOR_OPND5 = '-'
var SCOLOR_OPND6
SCOLOR_OPND6 = '.'
var SCOLOR_PREFIX
Line prefix.
var SCOLOR_REG
Register name.
var SCOLOR_REGCMT
Regular comment.
var SCOLOR_RPTCMT
Repeatable comment (defined not here)
var SCOLOR_SEGNAME
Segment name.
var SCOLOR_STRING
String constant in instruction.
var SCOLOR_SYMBOL
Punctuation.
var SCOLOR_UNAME
Regular unknown name.
var SCOLOR_UNKNAME
Dummy unknown name.
var SCOLOR_UTF8
SCOLOR_UTF8 = '2'
var SCOLOR_VOIDOP
Void operand.
var VEL_CMT
VEL_CMT = 2
var VEL_POST
VEL_POST = 1

Functions

def COLSTR(str, tag)
Utility function to create a colored line
str: The string
tag: Color tag constant. One of SCOLOR_XXXX
def add_extra_cmt(*args) ‑> bool
Add anterior/posterior comment line(s).
add_extra_cmt(ea, isprev, format) -> bool
ea: linear address (C++: ea_t)
isprev: do we add anterior lines? (0-no, posterior) (C++: bool)
format: printf() style format string. may contain \n to denote
new lines. The resulting string should not contain comment characters (;), the kernel will add them automatically. (C++: const char *)
return: true if success
def add_extra_line(*args) ‑> bool
Add anterior/posterior non-comment line(s).
add_extra_line(ea, isprev, format) -> bool
ea: linear address (C++: ea_t)
isprev: do we add anterior lines? (0-no, posterior) (C++: bool)
format: printf() style format string. may contain \n to denote
new lines. (C++: const char *)
return: true if success
def add_pgm_cmt(*args) ‑> bool
Add anterior comment line(s) at the start of program.
add_pgm_cmt(format) -> bool
format: printf() style format string. may contain \n to denote
new lines. The resulting string should not contain comment characters (;), the kernel will add them automatically. (C++: const char *)
return: true if success
def add_sourcefile(*args) ‑> bool
Mark a range of address as belonging to a source file. An address range may belong only to one source file. A source file may be represented by several address ranges.
add_sourcefile(ea1, ea2, filename) -> bool
ea1: linear address of start of the address range (C++: ea_t)
ea2: linear address of end of the address range (excluded)
(C++: ea_t)
filename: name of source file. (C++: const char *)
return: success
def calc_bg_color(*args) ‑> bgcolor_t
Get background color for line at 'ea'
calc_bg_color(ea) -> bgcolor_t
ea (C++: ea_t)
return: RGB color
def calc_prefix_color(*args) ‑> color_t
Get prefix color for line at 'ea'
calc_prefix_color(ea) -> color_t
ea (C++: ea_t)
return: Line prefix colors
def create_encoding_helper(*args) ‑> encoder_t *
create_encoding_helper(encidx=-1, nr=nr_once) -> encoder_t *
encidx: int nr: enum encoder_t::notify_recerr_t
def del_extra_cmt(*args) ‑> void
del_extra_cmt(ea, what)
ea: ea_t what: int
def del_sourcefile(*args) ‑> bool
Delete information about the source file.
del_sourcefile(ea) -> bool
ea: linear address (C++: ea_t)
return: success
def delete_extra_cmts(*args) ‑> void
delete_extra_cmts(ea, what)
ea: ea_t what: int
def generate_disasm_line(*args) ‑> qstring *
generate_disasm_line(ea, flags=0) -> str
ea: ea_t flags: int
def generate_disassembly(*args) ‑> PyObject *
generate_disassembly(ea, max_lines, as_stack, notags) -> PyObject *
Generate disassembly lines (many lines) and put them into a buffer
ea: address to generate disassembly for
max_lines: how many lines max to generate
as_stack: Display undefined items as 2/4/8 bytes
return:
  • None on failure
  • tuple(most_important_line_number, tuple(lines)) : Returns a tuple containing
    the most important line number and a tuple of generated lines
def get_extra_cmt(*args) ‑> int
get_extra_cmt(ea, what) -> ssize_t
ea: ea_t what: int
def get_first_free_extra_cmtidx(*args) ‑> int
get_first_free_extra_cmtidx(ea, start) -> int
ea: ea_t start: int
def get_sourcefile(*args) ‑> char const *
Get name of source file occupying the given address.
get_sourcefile(ea, bounds=None) -> char const *
ea: linear address (C++: ea_t)
bounds: pointer to the output buffer with the address range for
the current file. May be NULL. (C++: range_t *)
return: NULL if source file information is not found, otherwise
returns pointer to file name
def install_user_defined_prefix(*args) ‑> bool
User-defined line-prefixes are displayed just after the autogenerated line prefixes in the disassembly listing. There is no need to call this function explicitly. Use the 'user_defined_prefix_t' class.
install_user_defined_prefix(prefix_len, udp, owner) -> bool
prefix_len: prefixed length. if 0, then uninstall UDP (C++:
size_t)
udp: object to generate user-defined prefix (C++: struct
user_defined_prefix_t *)
owner: pointer to the plugin_t that owns UDP if non-NULL,
then the object will be uninstalled and destroyed when the plugin gets unloaded (C++: const void *)
def requires_color_esc(c)
Checks if the given character requires escaping
c: character (string of one char)
return: Boolean
def set_user_defined_prefix(*args) ‑> PyObject *
set_user_defined_prefix(width, pycb) -> PyObject *
Deprecated. Please use install_user_defined_prefix() instead
def tag_addr(*args) ‑> PyObject *
Insert an address mark into a string.
tag_addr(ea) -> PyObject *
ea: address to include (C++: ea_t)
def tag_advance(*args) ‑> int
Move pointer to a 'line' to 'cnt' positions right. Take into account escape sequences.
tag_advance(line, cnt) -> int
line: pointer to string (C++: const char *)
cnt: number of positions to move right (C++: int)
return: moved pointer
def tag_remove(*args) ‑> PyObject *
Remove color escape sequences from a string.
tag_remove(nonnul_instr) -> PyObject *
nonnul_instr: char const *
return: length of resulting string, -1 if error
def tag_skipcode(*args) ‑> int
Skip one color code. This function should be used if you are interested in color codes and want to analyze all of them. Otherwise 'tag_skipcodes()' function is better since it will skip all colors at once. This function will skip the current color code if there is one. If the current symbol is not a color code, it will return the input.
tag_skipcode(line) -> int
line (C++: const char *)
return: moved pointer
def tag_skipcodes(*args) ‑> int
Move the pointer past all color codes.
tag_skipcodes(line) -> int
line: can't be NULL (C++: const char *)
return: moved pointer, can't be NULL
def tag_strlen(*args) ‑> ssize_t
Calculate length of a colored string This function computes the length in unicode codepoints of a line
tag_strlen(line) -> ssize_t
line (C++: const char *)
return: the number of codepoints in the line, or -1 on error
def update_extra_cmt(*args) ‑> void
update_extra_cmt(ea, what, str)
ea: ea_t what: int str: char const *

Classes

class user_defined_prefix_t (*args)
Proxy of C++ user_defined_prefix_t class.
__init__(self, prefix_len, owner) -> user_defined_prefix_t
prefix_len: size_t owner: void const *

Methods

def get_user_defined_prefix(self, *args) ‑> void
This callback must be overridden by the derived class.
get_user_defined_prefix(self, ea, insn, lnnum, indent, line)
ea: the current address (C++: ea_t)
insn: the current instruction. if the current item is not an
instruction, then insn.itype is zero. - an ida_ua.insn_t, or an address (C++: const insn_t &)
lnnum (C++: int)
indent: see explanations for gen_printf() (C++: int)
line: the line to be generated. the line usually contains color
tags. this argument can be examined to decide whether to generate the prefix. (C++: const char *)