Module ida_lines
[frames] | no frames]

Module ida_lines

IDA Plugin SDK API wrapper: lines

Classes
  bgcolors_t
Proxy of C++ bgcolors_t class.
Functions
 
COLSTR(str, tag)
Utility function to create a colored line
bool
add_extra_cmt(ea, isprev, format)
Add anterior/posterior comment line(s).
bool
add_extra_line(ea, isprev, format)
Add anterior/posterior non-comment line(s).
bool
add_pgm_cmt(format)
Add anterior comment line(s) at the start of program.
bool
add_sourcefile(ea1, ea2, filename)
Mark a range of address as belonging to a source file.
bgcolor_t
calc_bg_color(ea)
Get background color for line at 'ea'
color_t
calc_prefix_color(ea)
Get prefix color for line at 'ea'
encoder_t *
create_encoding_helper(encidx=-1, nr=nr_once)
 
del_extra_cmt(ea, what)
bool
del_sourcefile(ea)
Delete information about the source file.
 
delete_extra_cmts(ea, what)
str
generate_disasm_line(ea, flags=0)
PyObject *
generate_disassembly(ea, max_lines, as_stack, notags)
Generate disassembly lines (many lines) and put them into a buffer
ssize_t
get_extra_cmt(ea, what)
int
get_first_free_extra_cmtidx(ea, start)
char const *
get_sourcefile(ea, bounds=None)
Get name of source file occupying the given address.
 
requires_color_esc(c)
Checks if the given character requires escaping
PyObject *
set_user_defined_prefix(width, pycb)
User-defined line-prefixes are displayed just after the autogenerated line prefixes.
PyObject *
tag_addr(ea)
Insert an address mark into a string.
int
tag_advance(line, cnt)
Move pointer to a 'line' to 'cnt' positions right.
PyObject *
tag_remove(nonnul_instr)
Remove color escape sequences from a string
int
tag_skipcode(line)
Skip one color code.
int
tag_skipcodes(line)
Move the pointer past all color codes.
ssize_t
tag_strlen(line)
Calculate length of a colored string This function computes the length in unicode codepoints of a line
 
update_extra_cmt(ea, what, str)
Variables
  COLOR_ADDR = 40
  COLOR_ADDR_SIZE = 8
  COLOR_ALTOP = 22
  COLOR_ASMDIR = 27
  COLOR_AUTOCMT = 4
  COLOR_BG_MAX = 13
  COLOR_BINPREF = 20
  COLOR_CHAR = 10
  COLOR_CNAME = 37
  COLOR_CODE = 5
  COLOR_CODNAME = 26
  COLOR_COLLAPSED = 39
  COLOR_CREF = 14
  COLOR_CREFTAIL = 16
  COLOR_CURITEM = 9
  COLOR_CURLINE = 10
  COLOR_DATA = 6
  COLOR_DATNAME = 6
  COLOR_DCHAR = 30
  COLOR_DEFAULT = 1
  COLOR_DEMNAME = 8
  COLOR_DNAME = 7
  COLOR_DNUM = 31
  COLOR_DREF = 15
  COLOR_DREFTAIL = 17
  COLOR_DSTR = 29
  COLOR_ERROR = 18
  COLOR_ESC = '\x03'
  COLOR_EXTERN = 8
  COLOR_EXTRA = 21
  COLOR_FG_MAX = 40
  COLOR_HIDLINE = 11
  COLOR_HIDNAME = 23
  COLOR_IMPNAME = 34
  COLOR_INSN = 5
  COLOR_INV = '\x04'
  COLOR_KEYWORD = 32
  COLOR_LIBFUNC = 3
  COLOR_LIBNAME = 24
  COLOR_LOCNAME = 25
  COLOR_LUMFUNC = 12
  COLOR_LUMINA = 52
  COLOR_MACRO = 28
  COLOR_NUMBER = 12
  COLOR_OFF = '\x02'
  COLOR_ON = '\x01'
  COLOR_OPND1 = 41
  COLOR_OPND2 = 42
  COLOR_OPND3 = 43
  COLOR_OPND4 = 44
  COLOR_OPND5 = 45
  COLOR_OPND6 = 46
  COLOR_OPND7 = 47
  COLOR_OPND8 = 48
  COLOR_PREFIX = 19
  COLOR_REG = 33
  COLOR_REGCMT = 2
  COLOR_REGFUNC = 4
  COLOR_RESERVED1 = 51
  COLOR_RPTCMT = 3
  COLOR_SEGNAME = 35
  COLOR_SELECTED = 2
  COLOR_STRING = 11
  COLOR_SYMBOL = 9
  COLOR_UNAME = 38
  COLOR_UNKNAME = 36
  COLOR_UNKNOWN = 7
  COLOR_VOIDOP = 13
  E_NEXT = 2000
  E_PREV = 1000
  GENDSM_FORCE_CODE = 1
  GENDSM_MULTI_LINE = 2
  GENDSM_REMOVE_TAGS = 4
  PALETTE_SIZE = 53
  SCOLOR_ADDR = '('
  SCOLOR_ALTOP = '\x16'
  SCOLOR_ASMDIR = '\x1b'
  SCOLOR_AUTOCMT = '\x04'
  SCOLOR_BINPREF = '\x14'
  SCOLOR_CHAR = '\n'
  SCOLOR_CNAME = '%'
  SCOLOR_CODNAME = '\x1a'
  SCOLOR_COLLAPSED = '\''
  SCOLOR_CREF = '\x0e'
  SCOLOR_CREFTAIL = '\x10'
  SCOLOR_DATNAME = '\x06'
  SCOLOR_DCHAR = '\x1e'
  SCOLOR_DEFAULT = '\x01'
  SCOLOR_DEMNAME = '\x08'
  SCOLOR_DNAME = '\x07'
  SCOLOR_DNUM = '\x1f'
  SCOLOR_DREF = '\x0f'
  SCOLOR_DREFTAIL = '\x11'
  SCOLOR_DSTR = '\x1d'
  SCOLOR_ERROR = '\x12'
  SCOLOR_ESC = '\x03'
  SCOLOR_EXTRA = '\x15'
  SCOLOR_FG_MAX = '('
  SCOLOR_HIDNAME = '\x17'
  SCOLOR_IMPNAME = '"'
  SCOLOR_INSN = '\x05'
  SCOLOR_INV = '\x04'
  SCOLOR_KEYWORD = ' '
  SCOLOR_LIBNAME = '\x18'
  SCOLOR_LOCNAME = '\x19'
  SCOLOR_MACRO = '\x1c'
  SCOLOR_NUMBER = '\x0c'
  SCOLOR_OFF = '\x02'
  SCOLOR_ON = '\x01'
  SCOLOR_OPND1 = ')'
  SCOLOR_OPND2 = '*'
  SCOLOR_OPND3 = '+'
  SCOLOR_OPND4 = ','
  SCOLOR_OPND5 = '-'
  SCOLOR_OPND6 = '.'
  SCOLOR_PREFIX = '\x13'
  SCOLOR_REG = '!'
  SCOLOR_REGCMT = '\x02'
  SCOLOR_RPTCMT = '\x03'
  SCOLOR_SEGNAME = '#'
  SCOLOR_STRING = '\x0b'
  SCOLOR_SYMBOL = '\t'
  SCOLOR_UNAME = '&'
  SCOLOR_UNKNAME = '$'
  SCOLOR_UTF8 = '2'
  SCOLOR_VOIDOP = '\r'
  SWIG_PYTHON_LEGACY_BOOL = 1
  VEL_CMT = 2
  VEL_POST = 1
  __package__ = None
  cvar = ??
Function Details

COLSTR(str, tag)

 

Utility function to create a colored line

Parameters:
  • str - The string
  • tag - Color tag constant. One of SCOLOR_XXXX

add_extra_cmt(ea, isprev, format)

 

Add anterior/posterior comment line(s).

Parameters:
  • 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 *)
Returns: bool
true if success

add_extra_line(ea, isprev, format)

 

Add anterior/posterior non-comment line(s).

Parameters:
  • 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 *)
Returns: bool
true if success

add_pgm_cmt(format)

 

Add anterior comment line(s) at the start of program.

Parameters:
  • 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 *)
Returns: bool
true if success

add_sourcefile(ea1, ea2, filename)

 

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.

Parameters:
  • 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 *)
Returns: bool
success

calc_bg_color(ea)

 

Get background color for line at 'ea'

Parameters:
  • ea, (C++ - ea_t)
Returns: bgcolor_t
RGB color

calc_prefix_color(ea)

 

Get prefix color for line at 'ea'

Parameters:
  • ea, (C++ - ea_t)
Returns: color_t
Line prefix colors

del_sourcefile(ea)

 

Delete information about the source file.

Parameters:
  • ea - linear address (C++: ea_t)
Returns: bool
success

generate_disassembly(ea, max_lines, as_stack, notags)

 

Generate disassembly lines (many lines) and put them into a buffer

Parameters:
  • ea - address to generate disassembly for
  • max_lines - how many lines max to generate
  • as_stack - Display undefined items as 2/4/8 bytes
Returns: PyObject *
  • 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

get_sourcefile(ea, bounds=None)

 

Get name of source file occupying the given address.

Parameters:
  • 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 *)
Returns: char const *
NULL if source file information is not found, otherwise returns pointer to file name

requires_color_esc(c)

 

Checks if the given character requires escaping

Parameters:
  • c - character (string of one char)
Returns:
Boolean

Is the given char a color escape character?

set_user_defined_prefix(width, pycb)

 
User-defined line-prefixes are displayed just after the autogenerated
line prefixes. In order to use them, the plugin should call the
following function to specify its width and contents.
@param width: the width of the user-defined prefix
@param callback: a get_user_defined_prefix callback to get the contents of the prefix.
    Its arguments:
      ea     - linear address
      lnnum  - line number
      indent - indent of the line contents (-1 means the default instruction)
               indent and is used for instruction itself. see explanations for printf_line()
      line   - the line to be generated. the line usually contains color tags this argument
               can be examined to decide whether to generated the prefix
    It returns a buffer of size < bufsize

In order to remove the callback before unloading the plugin, specify the width = 0 or the callback = None

Returns: PyObject *

tag_addr(ea)

 

Insert an address mark into a string.

Parameters:
  • ea - address to include (C++: ea_t)
Returns: PyObject *

tag_advance(line, cnt)

 

Move pointer to a 'line' to 'cnt' positions right. Take into account escape sequences.

Parameters:
  • line - pointer to string (C++: const char *)
  • cnt - number of positions to move right (C++: int)
Returns: int
moved pointer

tag_remove(nonnul_instr)

 

Remove color escape sequences from a string

Parameters:
  • colstr - the colored string with embedded tags
Returns: PyObject *
a new string w/o the tags

tag_skipcode(line)

 

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.

Parameters:
  • line, (C++ - const char *)
Returns: int
moved pointer

tag_skipcodes(line)

 

Move the pointer past all color codes.

Parameters:
  • line - can't be NULL (C++: const char *)
Returns: int
moved pointer, can't be NULL

tag_strlen(line)

 

Calculate length of a colored string This function computes the length in unicode codepoints of a line

Parameters:
  • line, (C++ - const char *)
Returns: ssize_t
the number of codepoints in the line, or -1 on error