IDA C++ SDK 9.2
Loading...
Searching...
No Matches
outctx_t Struct Reference

#include <ua.hpp>

Inheritance diagram for outctx_t:
outctx_base_t

Public Member Functions

 outctx_t (procmod_t *p, processor_t &ph, asm_t &ash, ea_t ea, flags64_t flags=0, int _suspop=0, const printop_t *_wif=nullptr)
 ~outctx_t (void)
virtual void idaapi setup_outctx (const char *prefix, int flags) override
 Initialization; normally used only by the kernel.
virtual int idaapi term_outctx (const char *prefix=nullptr) override
 Finalize the output context.
virtual ssize_t idaapi retrieve_cmt (void) override
virtual ssize_t idaapi retrieve_name (qstring *, color_t *) override
virtual bool idaapi gen_xref_lines (void) override
virtual void idaapi out_btoa (uval_t Word, char radix=0) override
 Output a number with the specified base (binary, octal, decimal, hex) The number is output without color codes.
void set_bin_state (int value)
virtual void idaapi out_mnem (int width=8, const char *postfix=nullptr) new api
 Output instruction mnemonic for 'insn' using information in 'ph.instruc' array.
virtual void idaapi out_custom_mnem (const char *mnem, int width=8, const char *postfix=nullptr) new api
 Output custom mnemonic for 'insn'.
virtual void idaapi out_mnemonic (void) new api
 Output instruction mnemonic using information in 'insn'.
virtual bool idaapi out_one_operand (int n) new api
 Use this function to output an operand of an instruction.
virtual size_t idaapi get_immvals (uval_t *out, int i) new api
 Get the immediate values used at the specified address.
virtual void idaapi out_immchar_cmts (void) new api
 Print all operand values as commented character constants.
virtual void idaapi gen_func_header (func_t *pfn) new api
virtual void idaapi gen_func_footer (const func_t *pfn) new api
virtual void idaapi out_data (bool analyze_only) new api
virtual bool idaapi out_specea (uchar segtype) new api
virtual void idaapi gen_header_extra () new api
virtual void idaapi gen_header (int flags=GH_PRINT_PROC_AND_ASM, const char *proc_name=nullptr, const char *proc_flavour=nullptr) new api
virtual void idaapi out_fcref_names () new api
 Print addresses referenced from the specified address as commented symbolic names.
Public Member Functions inherited from outctx_base_t
bool only_main_line () const
bool multiline () const
bool force_code () const
bool stack_view () const
bool display_voids () const
bool display_hidden () const
void set_gen_xrefs (bool on=true)
int get_xrefgen_state () const
void set_gen_cmt (bool on=true)
int get_cmtgen_state () const
int get_binop_state () const
void clr_gen_label (void)
void set_gen_label (void)
void set_gen_demangled_label (void)
void set_comment_addr (ea_t ea)
void set_dlbind_opnd (void)
bool print_label_now () const
int forbid_annotations ()
void restore_ctxflags (int saved_flags)
 outctx_base_t (ea_t ea, flags64_t flags, int _suspop=0)
outctx_base_toperator= (const outctx_base_t &)=delete
virtual ~outctx_base_t (void)
 AS_PRINTF (2, 3) size_t out_printf(const char *format
 Append a formatted string to the output string.
 va_start (va, format)
 va_end (va)
 GCC_DIAG_OFF (format-nonliteral)
size_t nowarn_out_printf (const char *format,...)
 GCC_DIAG_ON (format-nonliteral)
virtual AS_PRINTF (2, 0) size_t idaapi out_vprintf(const char *format
virtual flags64_t idaapi out_value (const op_t &x, int outf=0)
 Output immediate value.
virtual void idaapi out_symbol (char c)
 Output a character with COLOR_SYMBOL color.
virtual void idaapi out_chars (char c, int n)
 Append a character multiple times.
void out_spaces (ssize_t len)
 Appends spaces to outbuf until its tag_strlen becomes 'len'.
virtual void idaapi add_spaces (qstring *buf, ssize_t len)
virtual void idaapi out_line (const char *str, color_t color=0)
 Output a string with the specified color.
void out_keyword (const char *str)
 Output a string with COLOR_KEYWORD color.
void out_register (const char *str)
 Output a character with COLOR_REG color.
void out_lvar (const char *name, int width=-1)
 Output local variable name with COLOR_LOCNAME color.
virtual void idaapi out_tagon (color_t tag)
 Output "turn color on" escape sequence.
virtual void idaapi out_tagoff (color_t tag)
 Output "turn color off" escape sequence.
virtual void idaapi out_addr_tag (ea_t ea)
 Output "address" escape sequence.
virtual void idaapi out_colored_register_line (const char *str)
 Output a colored line with register names in it.
virtual void idaapi out_char (char c)
 Output one character.
virtual void idaapi out_long (sval_t v, char radix)
 Output a number with appropriate color.
virtual bool idaapi out_name_expr (const op_t &x, ea_t ea, adiff_t off=BADADDR)
 Output a name expression.
void close_comment (void)
virtual bool idaapi flush_outbuf (int indent=-1)
 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.
virtual bool idaapi flush_buf (const char *buf, int indent=-1)
 Append contents of 'buf' to the line array.
virtual AS_PRINTF (3, 0) bool idaapi gen_vprintf(int indent
 See gen_printf()
 AS_PRINTF (3, 4) inline bool gen_printf(int indent
 printf-like function to add lines to the line array.
const char va_start (va, format)
 va_end (va)
virtual bool idaapi gen_empty_line (void)
 Generate empty line.
virtual bool idaapi gen_border_line (bool solid=false)
 Generate thin border line.
virtual AS_PRINTF (3, 0) bool idaapi gen_colored_cmt_line_v(color_t color
 See gen_cmt_line()
 AS_PRINTF (2, 0) inline bool gen_cmt_line_v(const char *format
 See gen_cmt_line()
 AS_PRINTF (2, 3) inline bool gen_cmt_line(const char *format
 Generate one non-indented comment line, colored with COLOR_AUTOCMT.
 va_start (va, format)
 va_end (va)
 AS_PRINTF (2, 3) inline bool gen_collapsed_line(const char *format
 Generate one non-indented comment line, colored with COLOR_COLLAPSED.
 va_start (va, format)
 va_end (va)
virtual bool idaapi gen_block_cmt (const char *cmt, color_t color)
 Generate big non-indented comment lines.
virtual void idaapi init_lines_array (qstrvec_t *answers, int maxsize)
virtual ssize_t idaapi get_stkvar (const op_t &x, uval_t v, sval_t *vv, int *is_sp_based, tinfo_t *_frame)
void gen_empty_line_without_annotations (void)
flags64_t getF () const

Public Attributes

ea_t bin_ea
char bin_state
int gl_bpsize = 0
int bin_width = 0
insn_t insn
qstring curlabel
const printop_twif
procmod_tprocmod
processor_tph
asm_tash
uval_t saved_immvals [UA_MAXOP] = { 0 }
ea_t prefix_ea = BADADDR
ea_t next_line_ea = BADADDR
flags64_t F = 0
Public Attributes inherited from outctx_base_t
ea_helper_t_eah
ea_t insn_ea
qstring outbuf
 buffer for the current output line once ready, it is moved to lnar
ssize_t regname_idx = -1
 to rename registers
int suspop
 controls color for out_long()
flags_t F32
 please use outctx_t::F instead
uval_toutvalues = nullptr
 at least 2*UA_MAXOP elements
int outvalue_getn_flags = 0
 additional flags for print_operand()
voiduser_data = nullptr
 pointer to be used by the processor module for any purpose
voidkern_data = nullptr
 internal info used by the kernel
qstrvec_tlnar = nullptr
 vector of output lines
int lnar_maxsize = 0
 max permitted size of lnar
int default_lnnum = -1
 index of the most important line in lnar
qstring line_prefix
 usually segname:offset
ssize_t prefix_len = 0
 visible length of line_prefix
int ctxflags = 0
 various bits
int ind0 = 0
ea_t cmt_ea = BADADDR
 indirectly referenced address (used to generate cmt)
qstring cmtbuf
 indented comment
const char * cmtptr = nullptr
 rest of indented comment
color_t cmtcolor = 0xFF
 comment color
size_t len = out_vprintf(format, va)
return len
virtual va_list va
virtual const char * format
virtual const char va_list va
const char * format
bool code = gen_vprintf(indent, format, va)
return code
va_list va
bool answer = gen_colored_cmt_line_v(COLOR_COLLAPSED, format, va)
return answer

Additional Inherited Members

Protected Member Functions inherited from outctx_base_t
virtual bool idaapi flush_and_reinit (void)
virtual void idaapi append_user_prefix (const char *, int)
virtual void idaapi add_aux_prefix (const char *, int)
virtual void idaapi out_label_addr_tag (void)
virtual void idaapi out_aux_cmts (void)

Constructor & Destructor Documentation

◆ outctx_t()

outctx_t::outctx_t ( procmod_t * p,
processor_t & ph,
asm_t & ash,
ea_t ea,
flags64_t flags = 0,
int _suspop = 0,
const printop_t * _wif = nullptr )

◆ ~outctx_t()

outctx_t::~outctx_t ( void )
inline

Member Function Documentation

◆ setup_outctx()

virtual void idaapi outctx_t::setup_outctx ( const char * prefix,
int makeline_flags )
overridevirtual

Initialization; normally used only by the kernel.

Reimplemented from outctx_base_t.

◆ term_outctx()

virtual int idaapi outctx_t::term_outctx ( const char * prefix = nullptr)
overridevirtual

Finalize the output context.

Returns
the number of generated lines.

Reimplemented from outctx_base_t.

◆ retrieve_cmt()

virtual ssize_t idaapi outctx_t::retrieve_cmt ( void )
overridevirtual

Reimplemented from outctx_base_t.

◆ retrieve_name()

virtual ssize_t idaapi outctx_t::retrieve_name ( qstring * ,
color_t *  )
overridevirtual

Reimplemented from outctx_base_t.

◆ gen_xref_lines()

virtual bool idaapi outctx_t::gen_xref_lines ( void )
overridevirtual

Reimplemented from outctx_base_t.

◆ out_btoa()

virtual void idaapi outctx_t::out_btoa ( uval_t Word,
char radix = 0 )
overridevirtual

Output a number with the specified base (binary, octal, decimal, hex) The number is output without color codes.

see also out_long()

Reimplemented from outctx_base_t.

◆ set_bin_state()

void outctx_t::set_bin_state ( int value)
inline

◆ out_mnem()

virtual void idaapi outctx_t::out_mnem ( int width = 8,
const char * postfix = nullptr )
newvirtual

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.

Parameters
widthwidth of field with mnemonic. if < 0, then 'postfix' will be output before the mnemonic, i.e. as a prefix
postfixoptional postfix added to the instruction mnemonic

◆ out_custom_mnem()

virtual void idaapi outctx_t::out_custom_mnem ( const char * mnem,
int width = 8,
const char * postfix = nullptr )
newvirtual

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

Parameters
mnemcustom mnemonic
widthwidth of field with mnemonic. if < 0, then 'postfix' will be output before the mnemonic, i.e. as a prefix
postfixoptional postfix added to 'mnem'

◆ out_mnemonic()

virtual void idaapi outctx_t::out_mnemonic ( void )
newvirtual

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()

virtual bool idaapi outctx_t::out_one_operand ( int n)
newvirtual

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.

Parameters
n0..#UA_MAXOP-1 operand number
Return values
1operand is displayed
0operand is hidden

◆ get_immvals()

virtual size_t idaapi outctx_t::get_immvals ( uval_t * out,
int i )
newvirtual

Get the immediate values used at the specified address.

This function can handle instructions and data items.

Parameters
outarray of values, size at least 2*UA_MAXOP
ioperand number
Returns
number of immediate values

◆ out_immchar_cmts()

virtual void idaapi outctx_t::out_immchar_cmts ( void )
newvirtual

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.

◆ gen_func_header()

virtual void idaapi outctx_t::gen_func_header ( func_t * pfn)
newvirtual

◆ gen_func_footer()

virtual void idaapi outctx_t::gen_func_footer ( const func_t * pfn)
newvirtual

◆ out_data()

virtual void idaapi outctx_t::out_data ( bool analyze_only)
newvirtual

◆ out_specea()

virtual bool idaapi outctx_t::out_specea ( uchar segtype)
newvirtual

◆ gen_header_extra()

virtual void idaapi outctx_t::gen_header_extra ( )
newvirtual

◆ gen_header()

virtual void idaapi outctx_t::gen_header ( int flags = GH_PRINT_PROC_AND_ASM,
const char * proc_name = nullptr,
const char * proc_flavour = nullptr )
newvirtual

◆ out_fcref_names()

virtual void idaapi outctx_t::out_fcref_names ( )
newvirtual

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.

Member Data Documentation

◆ bin_ea

ea_t outctx_t::bin_ea

◆ bin_state

char outctx_t::bin_state

◆ gl_bpsize

int outctx_t::gl_bpsize = 0

◆ bin_width

int outctx_t::bin_width = 0

◆ insn

insn_t outctx_t::insn

◆ curlabel

qstring outctx_t::curlabel

◆ wif

const printop_t* outctx_t::wif

◆ procmod

procmod_t* outctx_t::procmod

◆ ph

processor_t& outctx_t::ph

◆ ash

asm_t& outctx_t::ash

◆ saved_immvals

uval_t outctx_t::saved_immvals[UA_MAXOP] = { 0 }

◆ prefix_ea

ea_t outctx_t::prefix_ea = BADADDR

◆ next_line_ea

ea_t outctx_t::next_line_ea = BADADDR

◆ F

flags64_t outctx_t::F = 0

The documentation for this struct was generated from the following file: