Module ida_ua

There are 2 kinds of functions:

  • functions that are called from the kernel to disassemble an instruction. These functions call IDP module for it.

  • functions that are called from IDP module to disassemble an instruction. We will call them 'helper functions'.

Disassembly of an instruction is made in three steps:

  1. analysis: ana.cpp

  2. emulation: emu.cpp

  3. conversion to text: out.cpp

The kernel calls the IDP module to perform these steps. At first, the kernel always calls the analysis. The analyzer must decode the instruction and fill the insn_t instance that it receives through its callback. It must not change anything in the database.

The second step, the emulation, is called for each instruction. This step must make necessary changes to the database, plan analysis of subsequent instructions, track register values, memory contents, etc. Please keep in mind that the kernel may call the emulation step for any address in the program - there is no ordering of addresses. Usually, the emulation is called for consecutive addresses but this is not guaranteed.

The last step, conversion to text, is called each time an instruction is displayed on the screen. The kernel will always call the analysis step before calling the text conversion step. The emulation and the text conversion steps should use the information stored in the insn_t instance they receive. They should not access the bytes of the instruction and decode it again - this should only be done in the analysis step.

Global Variables

BINOPSTATE_DONE

BINOPSTATE_DONE = 524288

BINOPSTATE_GO

BINOPSTATE_GO = 262144

BINOPSTATE_NONE

BINOPSTATE_NONE = 0

COMMSTATE_DONE

COMMSTATE_DONE = 512

COMMSTATE_GO

COMMSTATE_GO = 256

COMMSTATE_NONE

COMMSTATE_NONE = 0

CTXF_BINOP_STATE

CTXF_BINOP_STATE = 786432

CTXF_BIT_PREFIX

CTXF_BIT_PREFIX = 2097152

CTXF_CMT_STATE

CTXF_CMT_STATE = 768

CTXF_CODE

CTXF_CODE = 4

CTXF_DBLIND_OPND

CTXF_DBLIND_OPND = 131072

CTXF_DEMANGLED_LABEL

CTXF_DEMANGLED_LABEL = 4096

CTXF_DEMANGLED_OK

CTXF_DEMANGLED_OK = 16384

CTXF_GEN_CMT

CTXF_GEN_CMT = 128

CTXF_GEN_XREFS

CTXF_GEN_XREFS = 16

CTXF_HIDDEN_ADDR

CTXF_HIDDEN_ADDR = 1048576

CTXF_LABEL_OK

CTXF_LABEL_OK = 8192

CTXF_MAIN

CTXF_MAIN = 1

CTXF_MULTI

CTXF_MULTI = 2

CTXF_NORMAL_LABEL

CTXF_NORMAL_LABEL = 2048

CTXF_OUTCTX_T

CTXF_OUTCTX_T = 65536

CTXF_OVSTORE_PRNT

CTXF_OVSTORE_PRNT = 32768

CTXF_STACK

CTXF_STACK = 8

CTXF_VOIDS

CTXF_VOIDS = 1024

CTXF_XREF_STATE

CTXF_XREF_STATE = 96

DEFAULT_INDENT

DEFAULT_INDENT = 65535

FCBF_CONT

FCBF_CONT = 1

FCBF_DELIM

FCBF_DELIM = 8

FCBF_ERR_REPL

FCBF_ERR_REPL = 2

FCBF_FF_LIT

FCBF_FF_LIT = 4

GH_BYTESEX_HAS_HIGHBYTE

GH_BYTESEX_HAS_HIGHBYTE = 16

GH_PRINT_ALL

GH_PRINT_ALL = 15

GH_PRINT_ALL_BUT_BYTESEX

GH_PRINT_ALL_BUT_BYTESEX = 11

GH_PRINT_ASM

GH_PRINT_ASM = 2

GH_PRINT_BYTESEX

GH_PRINT_BYTESEX = 4

GH_PRINT_HEADER

GH_PRINT_HEADER = 8

GH_PRINT_PROC

GH_PRINT_PROC = 1

GH_PRINT_PROC_AND_ASM

GH_PRINT_PROC_AND_ASM = 3

GH_PRINT_PROC_ASM_AND_BYTESEX

GH_PRINT_PROC_ASM_AND_BYTESEX = 7

INSN_64BIT

INSN_64BIT = 4

INSN_MACRO

INSN_MACRO = 1

INSN_MODMAC

INSN_MODMAC = 2

MAKELINE_BINPREF

MAKELINE_BINPREF = 1

MAKELINE_NONE

MAKELINE_NONE = 0

MAKELINE_STACK

MAKELINE_STACK = 4

MAKELINE_VOID

MAKELINE_VOID = 2

OF_NO_BASE_DISP

OF_NO_BASE_DISP = 128

OF_NUMBER

OF_NUMBER = 16

OF_OUTER_DISP

OF_OUTER_DISP = 64

OF_SHOW

OF_SHOW = 8

OOFS_IFSIGN

OOFS_IFSIGN = 0

OOFS_NEEDSIGN

OOFS_NEEDSIGN = 2

OOFS_NOSIGN

OOFS_NOSIGN = 1

OOFW_16

OOFW_16 = 32

OOFW_24

OOFW_24 = 48

OOFW_32

OOFW_32 = 64

OOFW_64

OOFW_64 = 80

OOFW_8

OOFW_8 = 16

OOFW_IMM

OOFW_IMM = 0

OOF_ADDR

OOF_ADDR = 128

OOF_ANYSERIAL

OOF_ANYSERIAL = 4096

OOF_LZEROES

OOF_LZEROES = 8192

OOF_NOBNOT

OOF_NOBNOT = 1024

OOF_NO_LZEROES

OOF_NO_LZEROES = 16384

OOF_NUMBER

OOF_NUMBER = 8

OOF_OUTER

OOF_OUTER = 256

OOF_SIGNED

OOF_SIGNED = 4

OOF_SIGNMASK

OOF_SIGNMASK = 3

OOF_SPACES

OOF_SPACES = 2048

OOF_WIDTHMASK

OOF_WIDTHMASK = 112

OOF_ZSTROFF

OOF_ZSTROFF = 512

PACK_FORM_DEF

PACK_FORM_DEF = 32

STKVAR_VALID_SIZE

STKVAR_VALID_SIZE = 1

XREFSTATE_DONE

XREFSTATE_DONE = 64

XREFSTATE_GO

XREFSTATE_GO = 32

XREFSTATE_NONE

XREFSTATE_NONE = 0

dt_bitfild

dt_bitfild = 12

dt_byte

dt_byte = 0

dt_byte16

dt_byte16 = 8

dt_byte32

dt_byte32 = 16

dt_byte64

dt_byte64 = 17

dt_code

dt_code = 9

dt_double

dt_double = 4

dt_dword

dt_dword = 2

dt_float

dt_float = 3

dt_fword

dt_fword = 11

dt_half

dt_half = 18

dt_ldbl

dt_ldbl = 15

dt_packreal

dt_packreal = 6

dt_qword

dt_qword = 7

dt_string

dt_string = 13

dt_tbyte

dt_tbyte = 5

dt_unicode

dt_unicode = 14

dt_void

dt_void = 10

dt_word

dt_word = 1

o_displ

o_displ = 4

o_far

o_far = 6

o_idpspec0

o_idpspec0 = 8

o_idpspec1

o_idpspec1 = 9

o_idpspec2

o_idpspec2 = 10

o_idpspec3

o_idpspec3 = 11

o_idpspec4

o_idpspec4 = 12

o_idpspec5

o_idpspec5 = 13

o_imm

o_imm = 5

o_mem

o_mem = 2

o_near

o_near = 7

o_phrase

o_phrase = 3

o_reg

o_reg = 1

o_void

o_void = 0

Functions

calc_dataseg(insn: insn_t, n: int = -1, rgnum: int = -1) ‑> ea_t

calc_dataseg(insn, n=-1, rgnum=-1) -> ea_t Get data segment for the instruction operand. 'opnum' and 'rgnum' are meaningful only if the processor has segment registers.

insn: (C++: const insn_t &) an ida_ua.insn_t, or an address (C++: const insn_t &)
n: (C++: int)
rgnum: (C++: int)

can_decode(ea: ea_t) ‑> bool

can_decode(ea) -> bool Can the bytes at address 'ea' be decoded as instruction?

ea: (C++: ea_t) linear address
return: whether or not the contents at that address could be a valid
        instruction

construct_macro(*args) ‑> bool

construct_macro(_this, insn, enable) -> bool See ua.hpp's construct_macro().

_this: macro_constructor_t *
insn: insn_t *
enable: bool

construct_macro(insn, enable, build_macro) -> bool

insn: insn_t &
enable: bool
build_macro: PyObject *

create_insn(ea: ea_t, out: insn_t = None) ‑> int

create_insn(ea, out=None) -> int Create an instruction at the specified address. This function checks if an instruction is present at the specified address and will try to create one if there is none. It will fail if there is a data item or other items hindering the creation of the new instruction. This function will also fill the 'out' structure.

ea: (C++: ea_t) linear address
out: (C++: insn_t *) the resulting instruction
return: the length of the instruction or 0

create_outctx(ea: ea_t, F: flags64_t = 0, suspop: int = 0) ‑> outctx_base_t *

create_outctx(ea, F=0, suspop=0) -> outctx_base_t Create a new output context. To delete it, just use "delete pctx"

ea: (C++: ea_t)
F: (C++: flags64_t)
suspop: (C++: int)

decode_insn(out: insn_t, ea: ea_t) ‑> int

decode_insn(out, ea) -> int Analyze the specified address and fill 'out'. This function does not modify the database. It just tries to interpret the specified address as an instruction and fills the 'out' structure.

out: (C++: insn_t *) the resulting instruction
ea: (C++: ea_t) linear address
return: the length of the (possible) instruction or 0

decode_preceding_insn(out: insn_t, ea: ea_t) ‑> PyObject *

decode_preceding_insn(out, ea) -> (int, int) Decodes the preceding instruction. Please check ua.hpp / decode_preceding_insn()

out: instruction storage
ea: current ea
return: tuple(preceeding_ea or BADADDR, farref = Boolean)

decode_prev_insn(out: insn_t, ea: ea_t) ‑> ea_t

decode_prev_insn(out, ea) -> ea_t Decode previous instruction if it exists, fill 'out'.

out: (C++: insn_t *) the resulting instruction
ea: (C++: ea_t) the address to decode the previous instruction from
return: the previous instruction address (BADADDR-no such insn)

get_dtype_by_size(size: asize_t) ‑> int

get_dtype_by_size(size) -> int Get op_t::dtype from size.

size: (C++: asize_t)

get_dtype_flag(dtype: op_dtype_t) ‑> flags64_t

get_dtype_flag(dtype) -> flags64_t Get flags for op_t::dtype field.

dtype: (C++: op_dtype_t)

get_dtype_size(dtype: op_dtype_t) ‑> size_t

get_dtype_size(dtype) -> size_t Get size of opt_::dtype field.

dtype: (C++: op_dtype_t)

get_immvals(ea: ea_t, n: int, F: flags64_t = 0) ‑> PyObject *

get_immvals(ea, n, F=0) -> PyObject Get immediate values at the specified address. This function decodes instruction at the specified address or inspects the data item. It finds immediate values and copies them to 'out'. This function will store the original value of the operands in 'out', unless the last bits of 'F' are "...0 11111111", in which case the transformed values (as needed for printing) will be stored instead.

ea: (C++: ea_t) address to analyze
n: (C++: int) 0..UA_MAXOP-1 operand number, OPND_ALL all the operands
F: (C++: flags64_t) flags for the specified address
return: number of immediate values (0..2*UA_MAXOP)

get_lookback() ‑> int

get_lookback() -> int Number of instructions to look back. This variable is not used by the kernel. Its value may be specified in ida.cfg: LOOKBACK = . IDP may use it as you like it. (TMS module uses it)

get_printable_immvals(ea: ea_t, n: int, F: flags64_t = 0) ‑> PyObject *

get_printable_immvals(ea, n, F=0) -> PyObject Get immediate ready-to-print values at the specified address

ea: (C++: ea_t) address to analyze
n: (C++: int) 0..UA_MAXOP-1 operand number, OPND_ALL all the operands
F: (C++: flags64_t) flags for the specified address
return: number of immediate values (0..2*UA_MAXOP)

insn_add_cref(insn: insn_t, to: ea_t, opoff: int, type: cref_t) ‑> void

insn_add_cref(insn, to, opoff, type)

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
to: ea_t
opoff: int
type: enum cref_t

insn_add_dref(insn: insn_t, to: ea_t, opoff: int, type: dref_t) ‑> void

insn_add_dref(insn, to, opoff, type)

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
to: ea_t
opoff: int
type: enum dref_t

insn_add_off_drefs(insn: insn_t, x: op_t, type: dref_t, outf: int) ‑> ea_t

insn_add_off_drefs(insn, x, type, outf) -> ea_t

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
x: op_t const &
type: enum dref_t
outf: int

insn_create_stkvar(insn: insn_t, x: op_t, v: adiff_t, flags: int) ‑> bool

insn_create_stkvar(insn, x, v, flags) -> bool

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
x: op_t const &
v: adiff_t
flags: int

insn_t__from_ptrval__(ptrval: size_t) ‑> insn_t *

insn_t__from_ptrval__(ptrval) -> insn_t

ptrval: size_t

is_floating_dtype(dtype: op_dtype_t) ‑> bool

is_floating_dtype(dtype) -> bool Is a floating type operand?

dtype: (C++: op_dtype_t)

map_code_ea(*args) ‑> ea_t

map_code_ea(insn, addr, opnum) -> ea_t

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
addr: ea_t
opnum: int

map_code_ea(insn, op) -> ea_t

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
op: op_t const &

map_data_ea(*args) ‑> ea_t

map_data_ea(insn, addr, opnum=-1) -> ea_t

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
addr: ea_t
opnum: int

map_data_ea(insn, op) -> ea_t

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
op: op_t const &

map_ea(*args) ‑> ea_t

map_ea(insn, op, iscode) -> ea_t

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
op: op_t const &
iscode: bool

map_ea(insn, addr, opnum, iscode) -> ea_t

insn: an ida_ua.insn_t, or an address (C++: const insn_t &)
addr: ea_t
opnum: int
iscode: bool

op_t__from_ptrval__(ptrval: size_t) ‑> op_t *

op_t__from_ptrval__(ptrval) -> op_t

ptrval: size_t

outctx_base_t__from_ptrval__(ptrval: size_t) ‑> outctx_base_t *

outctx_base_t__from_ptrval__(ptrval) -> outctx_base_t

ptrval: size_t

outctx_t__from_ptrval__(ptrval: size_t) ‑> outctx_t *

outctx_t__from_ptrval__(ptrval) -> outctx_t

ptrval: size_t

print_insn_mnem(ea) -> str Print instruction mnemonics.

ea: (C++: ea_t) linear address of the instruction
return: success

print_operand(ea, n, getn_flags=0, newtype=None) -> bool Generate text representation for operand #n. This function will generate the text representation of the specified operand (includes color codes.)

ea: (C++: ea_t) the item address (instruction or data)
n: (C++: int) 0..UA_MAXOP-1 operand number, meaningful only for instructions
getn_flags: (C++: int) Name expression flags Currently only GETN_NODUMMY is
                  accepted.
newtype: (C++: struct printop_t *) if specified, print the operand using the specified type
return: success

ua_mnem(ea: ea_t) ‑> qstring *

print_insn_mnem(ea) -> str Print instruction mnemonics.

ea: (C++: ea_t) linear address of the instruction
return: success

Classes

insn_t()

: Proxy of C++ insn_t class.

__init__(self) -> insn_t

Instance variables

  • Op1


  • Op2


  • Op3


  • Op4


  • Op5


  • Op6


  • Op7


  • Op8


  • auxpref: uint32 __get_auxpref__(self) -> uint32


  • auxpref_u16: uint16 [2] auxpref_u16


  • auxpref_u8: uint8 [4] auxpref_u8


  • cs: ea_t cs


  • ea: ea_t ea


  • flags: int16 flags


  • insnpref: char insnpref


  • ip: ea_t ip


  • itype: uint16 itype


  • ops: wrapped_array_t< op_t,8 > __get_ops__(self) -> operands_array


  • segpref: char segpref


  • size: uint16 size


Methods

  • add_cref(self, to: ea_t, opoff: int, type: cref_t) ‑> void add_cref(self, to, opoff, type) Add a code cross-reference from the instruction.

    to: (C++: ea_t) target linear address opoff: (C++: int) offset of the operand from the start of instruction. if the offset is unknown, then 0. type: (C++: cref_t) type of xref


  • add_dref(self, to: ea_t, opoff: int, type: dref_t) ‑> void add_dref(self, to, opoff, type) Add a data cross-reference from the instruction. See add_off_drefs() - usually it can be used in most cases.

    to: (C++: ea_t) target linear address opoff: (C++: int) offset of the operand from the start of instruction if the offset is unknown, then 0 type: (C++: dref_t) type of xref


  • add_off_drefs(self, x: op_t, type: dref_t, outf: int) ‑> ea_t add_off_drefs(self, x, type, outf) -> ea_t Add xrefs for an operand of the instruction. This function creates all cross references for 'enum', 'offset' and 'structure offset' operands. Use add_off_drefs() in the presence of negative offsets.

    x: (C++: const op_t &) reference to operand type: (C++: dref_t) type of xref outf: (C++: int) out_value() flags. These flags should match the flags used to output the operand return: if is_off(): the reference target address (the same as calc_reference_data). if is_stroff(): BADADDR because for stroffs the target address is unknown else: BADADDR because enums do not represent addresses


  • assign(self, other: insn_t) ‑> void assign(self, other)

    other: an ida_ua.insn_t, or an address (C++: const insn_t &)


  • create_op_data(self, *args) ‑> bool create_op_data(self, ea_, opoff, dtype) -> bool Convenient alias.

    ea_: (C++: ea_t) opoff: int dtype: op_dtype_t

    create_op_data(self, ea_, op) -> bool

    ea_: ea_t op: op_t const &


  • create_stkvar(self, x: op_t, v: adiff_t, flags_: int) ‑> bool create_stkvar(self, x, v, flags_) -> bool Create or modify a stack variable in the function frame. The emulator could use this function to create stack variables in the function frame before converting the operand to a stack variable. Please check with may_create_stkvars() before calling this function.

    x: (C++: const op_t &) operand (used to determine the addressing type) v: (C++: adiff_t) a displacement in the operand flags_: (C++: int) Stack variable flags retval 1: ok, a stack variable exists now retval 0: no, couldn't create stack variable


  • get_canon_feature(self, *args) ‑> uint32 get_canon_feature(self, ph) -> uint32 see instruc_t::feature

    ph: (C++: const processor_t &) processor_t const &

    get_canon_feature(self) -> uint32


  • get_canon_mnem(self, *args) ‑> char const * get_canon_mnem(self, ph) -> char const see instruc_t::name

    ph: (C++: const processor_t &) processor_t const &

    get_canon_mnem(self) -> char const *


  • get_next_byte(self) ‑> uint8 get_next_byte(self) -> uint8


  • get_next_dword(self) ‑> uint32 get_next_dword(self) -> uint32


  • get_next_qword(self) ‑> uint64 get_next_qword(self) -> uint64


  • get_next_word(self) ‑> uint16 get_next_word(self) -> uint16


  • is_64bit(self) ‑> bool is_64bit(self) -> bool Belongs to a 64bit segment?


  • is_canon_insn(self, *args) ‑> bool is_canon_insn(self, ph) -> bool see processor_t::is_canon_insn()

    ph: (C++: const processor_t &) processor_t const &

    is_canon_insn(self) -> bool


  • is_macro(self) ‑> bool is_macro(self) -> bool Is a macro instruction?


macro_constructor_t()

: Proxy of C++ macro_constructor_t class.

__init__(self) -> macro_constructor_t

 self: PyObject *

Instance variables

  • reserved: size_t reserved


Methods

  • build_macro(self, insn: insn_t, may_go_forward: bool) ‑> bool build_macro(self, insn, may_go_forward) -> bool Try to extend the instruction.

    insn: (C++: insn_t *) Instruction to modify, usually the first instruction of the macro may_go_forward: (C++: bool) Is it ok to consider the next instruction for the macro? This argument may be false, for example, if there is a cross reference to the end of INSN. In this case creating a macro is not desired. However, it may still be useful to perform minor tweaks to the instruction using the information about the surrounding instructions. return: true if created an macro instruction. This function may modify 'insn' and return false; these changes will be accepted by the kernel but the instruction will not be considered as a macro.


  • construct_macro(self, insn: insn_t, enable: bool) ‑> bool construct_macro(self, insn, enable) -> bool Construct a macro instruction. This function may be called from ana() to generate a macro instruction.

    The real work is done by the 'build_macro()' virtual function. It must be defined by the processor module.

    construct_macro() modifies the database using the info provided by build_macro(). It verifies if the instruction can really be created (for example, that other items do not hinder), may plan to reanalyze the macro, etc. If the macro instructions are disabled by the user, construct_macro() will destroy the macro instruction. Note: if INSN_MODMAC is not set in insn.flags, the database will not be modified.

    insn: (C++: insn_t *) the instruction to modify into a macro enable: (C++: bool) enable macro generation retval true: the macro instruction is generated in 'insn' retval false: did not create a macro


op_t()

: Proxy of C++ op_t class.

__init__(self) -> op_t

Instance variables

  • addr: ea_t __get_addr__(self) -> ea_t


  • dtype: op_dtype_t dtype


  • flags: uchar flags


  • n: uchar n


  • offb: char offb


  • offo: char offo


  • phrase: uint16 __get_reg_phrase__(self) -> uint16


  • reg: uint16 __get_reg_phrase__(self) -> uint16


  • specflag1: char specflag1


  • specflag2: char specflag2


  • specflag3: char specflag3


  • specflag4: char specflag4


  • specval: ea_t __get_specval__(self) -> ea_t


  • type: optype_t type


  • value: ea_t __get_value__(self) -> ea_t


  • value64: uint64 __get_value64__(self) -> uint64


Methods

  • assign(self, other: op_t) ‑> void assign(self, other)

    other: op_t const &


  • clr_shown(self) ‑> void clr_shown(self) Set operand to hidden.


  • has_reg(self, r) Checks if the operand accesses the given processor register


  • is_imm(self, v: uval_t) ‑> bool is_imm(self, v) -> bool Is immediate operand?

    v: (C++: uval_t)


  • is_reg(self, r: int) ‑> bool is_reg(self, r) -> bool Is register operand?

    r: (C++: int)


  • set_shown(self) ‑> void set_shown(self) Set operand to be shown.


  • shown(self) ‑> bool shown(self) -> bool Is operand set to be shown?


operands_array(data: op_t (&)[8])

: Proxy of C++ wrapped_array_t< op_t,8 > class.

__init__(self, data) -> operands_array

 data: op_t (&)[8]

Instance variables

  • bytes: bytevec_t _get_bytes(self) -> bytevec_t


  • data: op_t (&)[8] data


outctx_base_t(*args, **kwargs)

: Proxy of C++ outctx_base_t class.

Descendants

* ida_ua.outctx_t

Instance variables

  • F32: flags_t F32


  • default_lnnum: int default_lnnum


  • insn_ea: ea_t insn_ea


  • outbuf: qstring outbuf


Methods

  • close_comment(self) ‑> void close_comment(self)


  • clr_gen_label(self) ‑> void clr_gen_label(self)


  • display_voids(self) ‑> bool display_voids(self) -> bool


  • flush_buf(self, buf: char const *, indent: int = -1) ‑> bool flush_buf(self, buf, indent=-1) -> bool Append contents of 'buf' to the line array. Behaves like flush_outbuf but accepts an arbitrary buffer

    buf: (C++: const char *) char const * indent: (C++: int)


  • flush_outbuf(self, indent: int = -1) ‑> bool flush_outbuf(self, indent=-1) -> bool Functions to populate the output line array (lnar) Move the contents of the output buffer to the line array (outbuf->lnar) The kernel augments the outbuf contents with additional text like the line prefix, user-defined comments, xrefs, etc at this call.

    indent: (C++: int)


  • forbid_annotations(self) ‑> int forbid_annotations(self) -> int


  • force_code(self) ‑> bool force_code(self) -> bool


  • gen_block_cmt(self, cmt: char const *, color: color_t) ‑> bool gen_block_cmt(self, cmt, color) -> bool Generate big non-indented comment lines.

    cmt: (C++: const char *) comment text. may contain \n characters to denote new lines. should not contain comment character (;) color: (C++: color_t) color of comment text (one of Color tags) return: overflow, lnar_maxsize has been reached


  • gen_border_line(self, solid: bool = False) ‑> bool gen_border_line(self, solid=False) -> bool Generate thin border line. This function does nothing if generation of border lines is disabled.

    solid: (C++: bool) generate solid border line (with =), otherwise with - return: overflow, lnar_maxsize has been reached


  • gen_cmt_line(self, format: char const *) ‑> bool gen_cmt_line(self, format) -> bool Generate one non-indented comment line, colored with COLOR_AUTOCMT.

    format: (C++: const char *) printf() style format line. The resulting comment line should not include comment character (;) return: overflow, lnar_maxsize has been reached


  • gen_collapsed_line(self, format: char const *) ‑> bool gen_collapsed_line(self, format) -> bool Generate one non-indented comment line, colored with COLOR_COLLAPSED.

    format: (C++: const char *) printf() style format line. The resulting comment line should not include comment character (;) return: overflow, lnar_maxsize has been reached


  • gen_empty_line(self) ‑> bool gen_empty_line(self) -> bool Generate empty line. This function does nothing if generation of empty lines is disabled.

    return: overflow, lnar_maxsize has been reached


  • gen_empty_line_without_annotations(self) ‑> void gen_empty_line_without_annotations(self)


  • gen_printf(self, indent: int, format: char const *) ‑> bool gen_printf(self, indent, format) -> bool printf-like function to add lines to the line array.

    indent: (C++: int) indention of the line. if indent == -1, the kernel will indent the line at idainfo::indent. if indent < 0, -indent will be used for indention. The first line printed with indent < 0 is considered as the most important line at the current address. Usually it is the line with the instruction itself. This line will be displayed in the cross-reference lists and other places. If you need to output an additional line before the main line then pass DEFAULT_INDENT instead of -1. The kernel will know that your line is not the most important one. format: (C++: const char *) printf style colored line to generate return: overflow, lnar_maxsize has been reached


  • gen_xref_lines(self) ‑> bool gen_xref_lines(self) -> bool


  • getF(self) ‑> flags64_t getF(self) -> flags64_t


  • get_stkvar(self, x: op_t, v: uval_t, vv: sval_t *, is_sp_based: int *, _frame: tinfo_t) ‑> ssize_t get_stkvar(self, x, v, vv, is_sp_based, _frame) -> ssize_t

    x: op_t const & v: uval_t vv: sval_t * is_sp_based: int * _frame: tinfo_t *


  • init_lines_array(self, answers: qstrvec_t *, maxsize: int) ‑> void init_lines_array(self, answers, maxsize)

    answers: qstrvec_t * maxsize: int


  • multiline(self) ‑> bool multiline(self) -> bool


  • only_main_line(self) ‑> bool only_main_line(self) -> bool


  • out_addr_tag(self, ea: ea_t) ‑> void out_addr_tag(self, ea) Output "address" escape sequence.

    ea: (C++: ea_t)


  • out_btoa(self, Word: uval_t, radix: char = 0) ‑> void out_btoa(self, Word, radix=0) Output a number with the specified base (binary, octal, decimal, hex) The number is output without color codes. see also out_long()

    Word: (C++: uval_t) radix: (C++: char)


  • out_char(self, c: char) ‑> void out_char(self, c) Output one character. The character is output without color codes. see also out_symbol()

    c: (C++: char)


  • out_chars(self, c: char, n: int) ‑> void out_chars(self, c, n) Append a character multiple times.

    c: (C++: char) n: (C++: int)


  • out_colored_register_line(self, str: char const *) ‑> void out_colored_register_line(self, str) Output a colored line with register names in it. The register names will be substituted by user-defined names (regvar_t) Please note that out_tagoff tries to make substitutions too (when called with COLOR_REG)

    str: (C++: const char *) char const *


  • out_keyword(self, str: char const *) ‑> void out_keyword(self, str) Output a string with COLOR_KEYWORD color.

    str: (C++: const char *) char const *


  • out_line(self, str: char const *, color: color_t = 0) ‑> void out_line(self, str, color=0) Output a string with the specified color.

    str: (C++: const char *) char const * color: (C++: color_t)


  • out_long(self, v: sval_t, radix: char) ‑> void out_long(self, v, radix) Output a number with appropriate color. Low level function. Use out_value() if you can. if 'suspop' is set then this function uses COLOR_VOIDOP instead of COLOR_NUMBER. 'suspop' is initialized:

    • in out_one_operand()

    • in ..\ida\gl.cpp (before calling processor_t::d_out())

    v: (C++: sval_t) value to output radix: (C++: char) base (2,8,10,16)


  • out_name_expr(self, *args) ‑> bool out_name_expr(self, x, ea, off=BADADDR) -> bool Output a name expression.

    x: (C++: const op_t &) instruction operand referencing the name expression ea: (C++: ea_t) address to convert to name expression off: (C++: adiff_t) the value of name expression. this parameter is used only to check that the name expression will have the wanted value. You may pass BADADDR for this parameter but I discourage it because it prohibits checks. return: true if the name expression has been produced


  • out_printf(self, format: char const *) ‑> size_t out_printf(self, format) -> size_t Functions to append text to the current output buffer (outbuf) Append a formatted string to the output string.

    format: (C++: const char *) char const * return: the number of characters appended


  • out_register(self, str: char const *) ‑> void out_register(self, str) Output a character with COLOR_REG color.

    str: (C++: const char *) char const *


  • out_spaces(self, len: ssize_t) ‑> void out_spaces(self, len) Appends spaces to outbuf until its tag_strlen becomes 'len'.

    len: (C++: ssize_t)


  • out_symbol(self, c: char) ‑> void out_symbol(self, c) Output a character with COLOR_SYMBOL color.

    c: (C++: char)


  • out_tagoff(self, tag: color_t) ‑> void out_tagoff(self, tag) Output "turn color off" escape sequence.

    tag: (C++: color_t)


  • out_tagon(self, tag: color_t) ‑> void out_tagon(self, tag) Output "turn color on" escape sequence.

    tag: (C++: color_t)


  • out_value(self, x: op_t, outf: int = 0) ‑> flags64_t out_value(self, x, outf=0) -> flags64_t Output immediate value. Try to use this function to output all constants of instruction operands. This function outputs a number from x.addr or x.value in the form determined by F. It outputs colored text.

    x: (C++: const op_t &) value to output outf: (C++: int) Output value flags return: flags of the output value, otherwise: -1 if printed a number with COLOR_ERROR 0 if printed a nice number or character or segment or enum


  • print_label_now(self) ‑> bool print_label_now(self) -> bool


  • restore_ctxflags(self, saved_flags: int) ‑> void restore_ctxflags(self, saved_flags)

    saved_flags: int


  • retrieve_cmt(self) ‑> ssize_t retrieve_cmt(self) -> ssize_t


  • retrieve_name(self, arg2: qstring *, arg3: color_t *) ‑> ssize_t retrieve_name(self, arg2, arg3) -> ssize_t

    arg2: qstring * arg3: color_t *


  • set_comment_addr(self, ea: ea_t) ‑> void set_comment_addr(self, ea)

    ea: ea_t


  • set_dlbind_opnd(self) ‑> void set_dlbind_opnd(self)


  • set_gen_cmt(self, on: bool = True) ‑> void set_gen_cmt(self, on=True)

    on: bool


  • set_gen_demangled_label(self) ‑> void set_gen_demangled_label(self)


  • set_gen_label(self) ‑> void set_gen_label(self)


  • set_gen_xrefs(self, on: bool = True) ‑> void set_gen_xrefs(self, on=True)

    on: bool


  • setup_outctx(self, prefix: char const *, makeline_flags: int) ‑> void setup_outctx(self, prefix, makeline_flags) Initialization; normally used only by the kernel.

    prefix: (C++: const char *) char const * makeline_flags: (C++: int)


  • stack_view(self) ‑> bool stack_view(self) -> bool


  • term_outctx(self, prefix: char const * = None) ‑> int term_outctx(self, prefix=None) -> int Finalize the output context.

    prefix: (C++: const char *) char const * return: the number of generated lines.


outctx_t(*args, **kwargs)

: Proxy of C++ outctx_t class.

Ancestors (in MRO)

* ida_ua.outctx_base_t

Instance variables

  • ash: asm_t & ash


  • bin_ea: ea_t bin_ea


  • bin_state: char bin_state


  • bin_width: int bin_width


  • curlabel: qstring curlabel


  • gl_bpsize: int gl_bpsize


  • insn: insn_t insn


  • next_line_ea: ea_t next_line_ea


  • ph: processor_t & ph


  • prefix_ea: ea_t prefix_ea


  • procmod: procmod_t * procmod


  • saved_immvals: uval_t [8] saved_immvals


  • wif: printop_t const * wif


Methods

  • gen_func_footer(self, pfn: func_t const *) ‑> void gen_func_footer(self, pfn)

    pfn: func_t const *


  • gen_func_header(self, pfn: func_t *) ‑> void gen_func_header(self, pfn)

    pfn: func_t *


  • gen_header(self, *args) ‑> void gen_header(self, flags=((1 << 0)|(1 << 1)), proc_name=None, proc_flavour=None)

    flags: int proc_name: char const * proc_flavour: char const *


  • gen_header_extra(self) ‑> void gen_header_extra(self)


  • out_custom_mnem(self, mnem: char const *, width: int = 8, postfix: char const * = None) ‑> void out_custom_mnem(self, mnem, width=8, postfix=None) Output custom mnemonic for 'insn'. E.g. if it should differ from the one in 'ph.instruc'. This function outputs colored text. See out_mnem

    mnem: (C++: const char *) custom mnemonic width: (C++: int) width of field with mnemonic. if < 0, then 'postfix' will be output before the mnemonic, i.e. as a prefix postfix: (C++: const char *) optional postfix added to 'mnem'


  • out_data(self, analyze_only: bool) ‑> void out_data(self, analyze_only)

    analyze_only: bool


  • out_fcref_names(self) ‑> void out_fcref_names(self) Print addresses referenced from the specified address as commented symbolic names. This function is used to show, for example, multiple callees of an indirect call. This function outputs colored text.


  • out_immchar_cmts(self) ‑> void out_immchar_cmts(self) Print all operand values as commented character constants. This function is used to comment void operands with their representation in the form of character constants. This function outputs colored text.


  • out_mnem(self, width: int = 8, postfix: char const * = None) ‑> void out_mnem(self, width=8, postfix=None) Output instruction mnemonic for 'insn' using information in 'ph.instruc' array. This function outputs colored text. It should be called from processor_t::ev_out_insn() or processor_t::ev_out_mnem() handler. It will output at least one space after the instruction. mnemonic even if the specified 'width' is not enough.

    width: (C++: int) width of field with mnemonic. if < 0, then 'postfix' will be output before the mnemonic, i.e. as a prefix postfix: (C++: const char *) optional postfix added to the instruction mnemonic


  • out_mnemonic(self) ‑> void out_mnemonic(self) Output instruction mnemonic using information in 'insn'. It should be called from processor_t::ev_out_insn() and it will call processor_t::ev_out_mnem() or out_mnem. This function outputs colored text.


  • out_one_operand(self, n: int) ‑> bool out_one_operand(self, n) -> bool Use this function to output an operand of an instruction. This function checks for the existence of a manually defined operand and will output it if it exists. It should be called from processor_t::ev_out_insn() and it will call processor_t::ev_out_operand(). This function outputs colored text.

    n: (C++: int) 0..UA_MAXOP-1 operand number retval 1: operand is displayed retval 0: operand is hidden


  • out_specea(self, segtype: uchar) ‑> bool out_specea(self, segtype) -> bool

    segtype: uchar


  • set_bin_state(self, value: int) ‑> void set_bin_state(self, value)

    value: int


  • setup_outctx(self, prefix: char const *, flags: int) ‑> void setup_outctx(self, prefix, flags) Initialization; normally used only by the kernel.

    prefix: (C++: const char *) char const * flags: int


Last updated