IDA SDK
Public Attributes | Public Member Functions | Protected Member Functions | List of all members
outctx_base_t Struct Reference

Inherited by outctx_t.

Public Attributes

ea_t insn_ea
 
qstring outbuf
 
ssize_t regname_idx
 
int suspop
 
flags_t F
 
uval_toutvalues
 
int outvalue_getn_flags
 
void * user_data
 
void * kern_data
 
qstrvec_tlnar
 
int lnar_maxsize
 
int default_lnnum
 
qstring line_prefix
 
ssize_t prefix_len
 
int ctxflags
 
int ind0
 
ea_t cmt_ea
 
qstring cmtbuf
 
const char * cmtptr
 
color_t cmtcolor
 

Public Member Functions

bool only_main_line () const
 
bool multiline () const
 
bool force_code () const
 
bool stack_view () const
 
bool display_voids () 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
 
void clr_gen_label (void)
 
void set_gen_label (void)
 
void set_gen_demangled_label (void)
 
void set_comment_addr (ea_t ea)
 
bool print_label_now () const
 
int forbid_annotations ()
 
void restore_ctxflags (int saved_flags)
 
 outctx_base_t (ea_t ea, flags_t flags, int _suspop=0)
 
void out_printf (const char *format,...)
 ------------------------------------------------------------------------- Functions to append text to the current output buffer (outbuf) More...
 
 GCC_DIAG_OFF (format-nonliteral)
 
void nowarn_out_printf (const char *format,...)
 
 GCC_DIAG_ON (format-nonliteral)
 
virtual void idaapi out_vprintf (const char *format, va_list va)
 
virtual flags_t idaapi out_value (const op_t &x, int outf=0)
 Output immediate value. More...
 
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.
 
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. More...
 
virtual void idaapi out_char (char c)
 Output one character. More...
 
virtual void idaapi out_btoa (uval_t Word, char radix=0)
 Output a number with the specified base (binary, octal, decimal, hex) The number is output without color codes. More...
 
virtual void idaapi out_long (sval_t v, char radix)
 Output a number with appropriate color. More...
 
virtual bool idaapi out_name_expr (const op_t &x, ea_t ea, adiff_t off=BADADDR)
 Output a name expression. More...
 
void close_comment (void)
 
virtual bool idaapi flush_outbuf (int indent=-1)
 ------------------------------------------------------------------------- Functions to populate the output line array (lnar) More...
 
virtual bool idaapi flush_buf (const char *buf, int indent=-1)
 Append contents of 'buf' to the line array. More...
 
virtual int idaapi term_outctx (const char *prefix=NULL)
 Finalize the output context. More...
 
virtual bool idaapi gen_vprintf (int indent, const char *format, va_list va)
 See gen_printf()
 
bool gen_printf (int indent, const char *format,...)
 printf-like function to add lines to the line array. More...
 
virtual bool idaapi gen_empty_line (void)
 Generate empty line. More...
 
virtual bool idaapi gen_border_line (bool solid=false)
 Generate thin border line. More...
 
virtual bool idaapi gen_colored_cmt_line_v (color_t color, const char *format, va_list va)
 See gen_cmt_line()
 
bool gen_cmt_line_v (const char *format, va_list va)
 See gen_cmt_line()
 
bool gen_cmt_line (const char *format,...)
 Generate one non-indented comment line, colored with COLOR_AUTOCMT. More...
 
bool gen_collapsed_line (const char *format,...)
 Generate one non-indented comment line, colored with COLOR_COLLAPSED. More...
 
virtual bool idaapi gen_block_cmt (const char *cmt, color_t color)
 Generate big non-indented comment lines. More...
 
virtual void idaapi setup_outctx (const char *prefix, int makeline_flags)
 Initialization; normally used only by the kernel.
 
virtual ssize_t idaapi retrieve_cmt (void)
 
virtual ssize_t idaapi retrieve_name (qstring *, color_t *)
 
virtual bool idaapi gen_xref_lines (void)
 
virtual void idaapi init_lines_array (qstrvec_t *answers, int maxsize)
 
virtual member_t *idaapi get_stkvar (const op_t &, uval_t, sval_t *, int *)
 
void gen_empty_line_without_annotations (void)
 

Protected Member Functions

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)
 

Member Function Documentation

void outctx_base_t::out_printf ( const char *  format,
  ... 
)
inline

------------------------------------------------------------------------- Functions to append text to the current output buffer (outbuf)

Append a formatted string to the output string.

Returns
the number of characters appended
virtual flags_t idaapi outctx_base_t::out_value ( const op_t x,
int  outf = 0 
)
virtual

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 ::uFlag. It outputs a colored text.

  • -1 is output with COLOR_ERROR
  • 0 is output as a number or character or segment
    Parameters
    xvalue to output
    outflagsOutput value flags
    Returns
    flags of the output value
virtual void idaapi outctx_base_t::out_colored_register_line ( const char *  str)
virtual

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)

virtual void idaapi outctx_base_t::out_char ( char  c)
inlinevirtual

Output one character.

The character is output without color codes. see also out_symbol()

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

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

see also out_long()

void outctx_base_t::out_long ( sval_t  v,
char  radix 
)
virtual

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 ...cpp (before calling processor_t::d_out())
    Parameters
    vvalue to output
    radixbase (2,8,10,16)
    suspop::suspop
    • suspop==0: operand is ok
    • suspop==1: operand is suspicious and should be output with COLOR_VOIDOP
    • suspop==2: operand can't be output as requested and should be output with COLOR_ERROR
virtual bool idaapi outctx_base_t::out_name_expr ( const op_t x,
ea_t  ea,
adiff_t  off = BADADDR 
)
virtual

Output a name expression.

Parameters
xinstruction operand referencing the name expression
eaaddress to convert to name expression
offthe 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.
Returns
true if the name expression has been produced
virtual bool idaapi outctx_base_t::flush_outbuf ( int  indent = -1)
virtual

------------------------------------------------------------------------- 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.

virtual bool idaapi outctx_base_t::flush_buf ( const char *  buf,
int  indent = -1 
)
virtual

Append contents of 'buf' to the line array.

Behaves like flush_outbuf but accepts an arbitrary buffer

virtual int idaapi outctx_base_t::term_outctx ( const char *  prefix = NULL)
virtual

Finalize the output context.

Returns
the number of generated lines.
bool outctx_base_t::gen_printf ( int  indent,
const char *  format,
  ... 
)
inline

printf-like function to add lines to the line array.

Parameters
indentindention 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 idainfo::indent instead of -1. The kernel will know that your line is not the most important one.
formatprintf style colored line to generate
Returns
overflow, lnar_maxsize has been reached
virtual bool idaapi outctx_base_t::gen_empty_line ( void  )
virtual

Generate empty line.

This function does nothing if generation of empty lines is disabled.

Returns
overflow, lnar_maxsize has been reached
virtual bool idaapi outctx_base_t::gen_border_line ( bool  solid = false)
virtual

Generate thin border line.

This function does nothing if generation of border lines is disabled.

Parameters
solidgenerate solid border line (with =), otherwise with -
Returns
overflow, lnar_maxsize has been reached
bool outctx_base_t::gen_cmt_line ( const char *  format,
  ... 
)
inline

Generate one non-indented comment line, colored with COLOR_AUTOCMT.

Parameters
formatprintf() style format line. The resulting comment line should not include comment character (;)
Returns
overflow, lnar_maxsize has been reached
bool outctx_base_t::gen_collapsed_line ( const char *  format,
  ... 
)
inline

Generate one non-indented comment line, colored with COLOR_COLLAPSED.

Parameters
formatprintf() style format line. The resulting comment line should not include comment character (;)
Returns
overflow, lnar_maxsize has been reached
virtual bool idaapi outctx_base_t::gen_block_cmt ( const char *  cmt,
color_t  color 
)
virtual

Generate big non-indented comment lines.

Parameters
cmtcomment text. may contain \n characters to denote new lines. should not contain comment character (;)
colorcolor of comment text (one of Color tags)
Returns
overflow, lnar_maxsize has been reached

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