Module ida_lines

lines.

This file also contains definitions for the syntax highlighting.

Finally there are functions that deal with anterior/posterior user-defined lines.

Global Variables

COLOR_ADDR

COLOR_ADDR = 40

COLOR_ADDR_SIZE

COLOR_ADDR_SIZE = 16

COLOR_ALTOP

COLOR_ALTOP = 22

COLOR_ASMDIR

COLOR_ASMDIR = 27

COLOR_AUTOCMT

COLOR_AUTOCMT = 4

COLOR_BG_MAX

COLOR_BG_MAX = 13

COLOR_BINPREF

COLOR_BINPREF = 20

COLOR_CHAR

COLOR_CHAR = 10

COLOR_CNAME

COLOR_CNAME = 37

COLOR_CODE

COLOR_CODE = 5

COLOR_CODNAME

COLOR_CODNAME = 26

COLOR_COLLAPSED

COLOR_COLLAPSED = 39

COLOR_CREF

COLOR_CREF = 14

COLOR_CREFTAIL

COLOR_CREFTAIL = 16

COLOR_CURITEM

COLOR_CURITEM = 9

COLOR_CURLINE

COLOR_CURLINE = 10

COLOR_DATA

COLOR_DATA = 6

COLOR_DATNAME

COLOR_DATNAME = 6

COLOR_DCHAR

COLOR_DCHAR = 30

COLOR_DEFAULT

COLOR_DEFAULT = 1

COLOR_DEMNAME

COLOR_DEMNAME = 8

COLOR_DNAME

COLOR_DNAME = 7

COLOR_DNUM

COLOR_DNUM = 31

COLOR_DREF

COLOR_DREF = 15

COLOR_DREFTAIL

COLOR_DREFTAIL = 17

COLOR_DSTR

COLOR_DSTR = 29

COLOR_ERROR

COLOR_ERROR = 18

COLOR_ESC

COLOR_ESC = '\x03'

COLOR_EXTERN

COLOR_EXTERN = 8

COLOR_EXTRA

COLOR_EXTRA = 21

COLOR_FG_MAX

COLOR_FG_MAX = 40

COLOR_HIDLINE

COLOR_HIDLINE = 11

COLOR_HIDNAME

COLOR_HIDNAME = 23

COLOR_IMPNAME

COLOR_IMPNAME = 34

COLOR_INSN

COLOR_INSN = 5

COLOR_INV

COLOR_INV = '\x04'

COLOR_KEYWORD

COLOR_KEYWORD = 32

COLOR_LIBFUNC

COLOR_LIBFUNC = 3

COLOR_LIBNAME

COLOR_LIBNAME = 24

COLOR_LOCNAME

COLOR_LOCNAME = 25

COLOR_LUMFUNC

COLOR_LUMFUNC = 12

COLOR_LUMINA

COLOR_LUMINA = 52

COLOR_MACRO

COLOR_MACRO = 28

COLOR_NUMBER

COLOR_NUMBER = 12

COLOR_OFF

COLOR_OFF = '\x02'

COLOR_ON

COLOR_ON = '\x01'

COLOR_OPND1

COLOR_OPND1 = 41

COLOR_OPND2

COLOR_OPND2 = 42

COLOR_OPND3

COLOR_OPND3 = 43

COLOR_OPND4

COLOR_OPND4 = 44

COLOR_OPND5

COLOR_OPND5 = 45

COLOR_OPND6

COLOR_OPND6 = 46

COLOR_OPND7

COLOR_OPND7 = 47

COLOR_OPND8

COLOR_OPND8 = 48

COLOR_PREFIX

COLOR_PREFIX = 19

COLOR_REG

COLOR_REG = 33

COLOR_REGCMT

COLOR_REGCMT = 2

COLOR_REGFUNC

COLOR_REGFUNC = 4

COLOR_RESERVED1

COLOR_RESERVED1 = 51

COLOR_RPTCMT

COLOR_RPTCMT = 3

COLOR_SEGNAME

COLOR_SEGNAME = 35

COLOR_SELECTED

COLOR_SELECTED = 2

COLOR_STRING

COLOR_STRING = 11

COLOR_SYMBOL

COLOR_SYMBOL = 9

COLOR_UNAME

COLOR_UNAME = 38

COLOR_UNKNAME

COLOR_UNKNAME = 36

COLOR_UNKNOWN

COLOR_UNKNOWN = 7

COLOR_VOIDOP

COLOR_VOIDOP = 13

E_NEXT

E_NEXT = 2000

E_PREV

E_PREV = 1000

GDISMF_ADDR_TAG

GDISMF_ADDR_TAG = 2

GDISMF_AS_STACK

GDISMF_AS_STACK = 1

GENDSM_FORCE_CODE

GENDSM_FORCE_CODE = 1

GENDSM_MULTI_LINE

GENDSM_MULTI_LINE = 2

GENDSM_REMOVE_TAGS

GENDSM_REMOVE_TAGS = 4

PALETTE_SIZE

PALETTE_SIZE = 53

SCOLOR_ADDR

SCOLOR_ADDR = '('

SCOLOR_ALTOP

SCOLOR_ALTOP = '\x16'

SCOLOR_ASMDIR

SCOLOR_ASMDIR = '\x1b'

SCOLOR_AUTOCMT

SCOLOR_AUTOCMT = '\x04'

SCOLOR_BINPREF

SCOLOR_BINPREF = '\x14'

SCOLOR_CHAR

SCOLOR_CHAR = '\n'

SCOLOR_CNAME

SCOLOR_CNAME = '%'

SCOLOR_CODNAME

SCOLOR_CODNAME = '\x1a'

SCOLOR_COLLAPSED

SCOLOR_COLLAPSED = "'"

SCOLOR_CREF

SCOLOR_CREF = '\x0e'

SCOLOR_CREFTAIL

SCOLOR_CREFTAIL = '\x10'

SCOLOR_DATNAME

SCOLOR_DATNAME = '\x06'

SCOLOR_DCHAR

SCOLOR_DCHAR = '\x1e'

SCOLOR_DEFAULT

SCOLOR_DEFAULT = '\x01'

SCOLOR_DEMNAME

SCOLOR_DEMNAME = '\x08'

SCOLOR_DNAME

SCOLOR_DNAME = '\x07'

SCOLOR_DNUM

SCOLOR_DNUM = '\x1f'

SCOLOR_DREF

SCOLOR_DREF = '\x0f'

SCOLOR_DREFTAIL

SCOLOR_DREFTAIL = '\x11'

SCOLOR_DSTR

SCOLOR_DSTR = '\x1d'

SCOLOR_ERROR

SCOLOR_ERROR = '\x12'

SCOLOR_ESC

SCOLOR_ESC = '\x03'

SCOLOR_EXTRA

SCOLOR_EXTRA = '\x15'

SCOLOR_FG_MAX

SCOLOR_FG_MAX = '('

SCOLOR_HIDNAME

SCOLOR_HIDNAME = '\x17'

SCOLOR_IMPNAME

SCOLOR_IMPNAME = '"'

SCOLOR_INSN

SCOLOR_INSN = '\x05'

SCOLOR_INV

SCOLOR_INV = '\x04'

SCOLOR_KEYWORD

SCOLOR_KEYWORD = ' '

SCOLOR_LIBNAME

SCOLOR_LIBNAME = '\x18'

SCOLOR_LOCNAME

SCOLOR_LOCNAME = '\x19'

SCOLOR_MACRO

SCOLOR_MACRO = '\x1c'

SCOLOR_NUMBER

SCOLOR_NUMBER = '\x0c'

SCOLOR_OFF

SCOLOR_OFF = '\x02'

SCOLOR_ON

SCOLOR_ON = '\x01'

SCOLOR_OPND1

SCOLOR_OPND1 = ')'

SCOLOR_OPND2

SCOLOR_OPND2 = '*'

SCOLOR_OPND3

SCOLOR_OPND3 = '+'

SCOLOR_OPND4

SCOLOR_OPND4 = ','

SCOLOR_OPND5

SCOLOR_OPND5 = '-'

SCOLOR_OPND6

SCOLOR_OPND6 = '.'

SCOLOR_PREFIX

SCOLOR_PREFIX = '\x13'

SCOLOR_REG

SCOLOR_REG = '!'

SCOLOR_REGCMT

SCOLOR_REGCMT = '\x02'

SCOLOR_RPTCMT

SCOLOR_RPTCMT = '\x03'

SCOLOR_SEGNAME

SCOLOR_SEGNAME = '#'

SCOLOR_STRING

SCOLOR_STRING = '\x0b'

SCOLOR_SYMBOL

SCOLOR_SYMBOL = '\t'

SCOLOR_UNAME

SCOLOR_UNAME = '&'

SCOLOR_UNKNAME

SCOLOR_UNKNAME = '$'

SCOLOR_UTF8

SCOLOR_UTF8 = '2'

SCOLOR_VOIDOP

SCOLOR_VOIDOP = '\r'

VEL_CMT

VEL_CMT = 2

VEL_POST

VEL_POST = 1

Functions

COLSTR(str, tag)

Utility function to create a colored line str: The string tag: Color tag constant. One of SCOLOR_XXXX

add_extra_cmt(*args) ‑> bool

add_extra_cmt(ea, isprev, format) -> bool Add anterior/posterior comment line(s).

ea: (C++: ea_t) linear address
isprev: (C++: bool) do we add anterior lines? (0-no, posterior)
format: (C++: const char *) 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.
return: true if success

add_extra_line(*args) ‑> bool

add_extra_line(ea, isprev, format) -> bool Add anterior/posterior non-comment line(s).

ea: (C++: ea_t) linear address
isprev: (C++: bool) do we add anterior lines? (0-no, posterior)
format: (C++: const char *) printf() style format string. may contain \n to denote new lines.
return: true if success

add_pgm_cmt(*args) ‑> bool

add_pgm_cmt(format) -> bool Add anterior comment line(s) at the start of program.

format: (C++: const char *) 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.
return: true if success

add_sourcefile(ea1: ea_t, ea2: ea_t, filename: char const *) ‑> bool

add_sourcefile(ea1, ea2, filename) -> 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.

ea1: (C++: ea_t) linear address of start of the address range
ea2: (C++: ea_t) linear address of end of the address range (excluded)
filename: (C++: const char *) name of source file.
return: success

calc_bg_color(ea: ea_t) ‑> bgcolor_t

calc_bg_color(ea) -> bgcolor_t Get background color for line at 'ea'

ea: (C++: ea_t)
return: RGB color

calc_prefix_color(ea: ea_t) ‑> color_t

calc_prefix_color(ea) -> color_t Get prefix color for line at 'ea'

ea: (C++: ea_t)
return: Line prefix colors

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

del_extra_cmt(ea: ea_t, what: int) ‑> bool

del_extra_cmt(ea, what) -> bool

ea: ea_t
what: int

del_sourcefile(ea: ea_t) ‑> bool

del_sourcefile(ea) -> bool Delete information about the source file.

ea: (C++: ea_t) linear address
return: success

delete_extra_cmts(ea: ea_t, what: int) ‑> void

delete_extra_cmts(ea, what)

ea: ea_t
what: int

generate_disasm_line(ea: ea_t, flags: int = 0) ‑> qstring *

generate_disasm_line(ea, flags=0) -> bool

ea: ea_t
flags: int

generate_disassembly(ea: ea_t, max_lines: int, as_stack: bool, notags: bool) ‑> PyObject *

generate_disassembly(ea, max_lines, as_stack, notags) -> (int, [str, ...]) 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
notags: bool
return:     - None on failure
   - tuple(most_important_line_number, list(lines)) : Returns a tuple containing
     the most important line number and a list of generated lines

get_extra_cmt(ea: ea_t, what: int) ‑> int

get_extra_cmt(ea, what) -> ssize_t

ea: ea_t
what: int

get_first_free_extra_cmtidx(ea: ea_t, start: int) ‑> int

get_first_free_extra_cmtidx(ea, start) -> int

ea: ea_t
start: int

get_sourcefile(ea: ea_t, bounds: range_t = None) ‑> char const *

get_sourcefile(ea, bounds=None) -> char const Get name of source file occupying the given address.

ea: (C++: ea_t) linear address
bounds: (C++: range_t *) pointer to the output buffer with the address range for the
              current file. May be nullptr.
return: nullptr if source file information is not found, otherwise returns
        pointer to file name

install_user_defined_prefix(*args) ‑> bool

install_user_defined_prefix(prefix_len, udp, owner) -> 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.

prefix_len: (C++: size_t) prefixed length. if 0, then uninstall UDP
udp: (C++: struct user_defined_prefix_t *) object to generate user-defined prefix
owner: (C++: const void *) pointer to the plugin_t that owns UDP if non-nullptr, then the
             object will be uninstalled and destroyed when the plugin gets
             unloaded

requires_color_esc(c)

Checks if the given character requires escaping Is the given char a color escape character?

tag_addr(ea: ea_t) ‑> PyObject *

tag_addr(ea) -> PyObject * Insert an address mark into a string.

ea: (C++: ea_t) address to include

tag_advance(line: char const *, cnt: int) ‑> int

tag_advance(line, cnt) -> int Move pointer to a 'line' to 'cnt' positions right. Take into account escape sequences.

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

tag_remove(nonnul_instr: char const *) ‑> PyObject *

tag_remove(nonnul_instr) -> str

nonnul_instr: char const *

tag_skipcode(line: char const *) ‑> int

tag_skipcode(line) -> 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.

line: (C++: const char *) char const *
return: moved pointer

tag_skipcodes(line: char const *) ‑> int

tag_skipcodes(line) -> int Move the pointer past all color codes.

line: (C++: const char *) can't be nullptr
return: moved pointer, can't be nullptr

tag_strlen(line: char const *) ‑> ssize_t

tag_strlen(line) -> ssize_t Calculate length of a colored string This function computes the length in unicode codepoints of a line

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

update_extra_cmt(ea: ea_t, what: int, str: char const *) ‑> bool

update_extra_cmt(ea, what, str) -> bool

ea: ea_t
what: int
str: char const *

Classes

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

  • get_user_defined_prefix(self, ea: ea_t, insn: insn_t const &, lnnum: int, indent: int, line: char const *) ‑> void get_user_defined_prefix(self, ea, insn, lnnum, indent, line) This callback must be overridden by the derived class.

    ea: (C++: ea_t) the current address insn: (C++: const class insn_t &) the current instruction. if the current item is not an instruction, then insn.itype is zero. lnnum: (C++: int) number of the current line (each address may have several listing lines for it). 0 means the very first line for the current address. indent: (C++: int) see explanations for gen_printf() line: (C++: const char *) the line to be generated. the line usually contains color tags. this argument can be examined to decide whether to generate the prefix.


Last updated