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

#include <ua.hpp>

Inheritance diagram for outctx_base_t:
outctx_t

Public Member Functions

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_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.
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 int idaapi term_outctx (const char *prefix=nullptr)
 Finalize the output context.
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 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 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_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

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)

Constructor & Destructor Documentation

◆ outctx_base_t()

outctx_base_t::outctx_base_t ( ea_t ea,
flags64_t flags,
int _suspop = 0 )

◆ ~outctx_base_t()

virtual outctx_base_t::~outctx_base_t ( void )
virtual

Member Function Documentation

◆ only_main_line()

bool outctx_base_t::only_main_line ( ) const
inline

◆ multiline()

bool outctx_base_t::multiline ( ) const
inline

◆ force_code()

bool outctx_base_t::force_code ( ) const
inline

◆ stack_view()

bool outctx_base_t::stack_view ( ) const
inline

◆ display_voids()

bool outctx_base_t::display_voids ( ) const
inline

◆ display_hidden()

bool outctx_base_t::display_hidden ( ) const
inline

◆ set_gen_xrefs()

void outctx_base_t::set_gen_xrefs ( bool on = true)
inline

◆ get_xrefgen_state()

int outctx_base_t::get_xrefgen_state ( ) const
inline

◆ set_gen_cmt()

void outctx_base_t::set_gen_cmt ( bool on = true)
inline

◆ get_cmtgen_state()

int outctx_base_t::get_cmtgen_state ( ) const
inline

◆ get_binop_state()

int outctx_base_t::get_binop_state ( ) const
inline

◆ clr_gen_label()

void outctx_base_t::clr_gen_label ( void )
inline

◆ set_gen_label()

void outctx_base_t::set_gen_label ( void )
inline

◆ set_gen_demangled_label()

void outctx_base_t::set_gen_demangled_label ( void )
inline

◆ set_comment_addr()

void outctx_base_t::set_comment_addr ( ea_t ea)
inline

◆ set_dlbind_opnd()

void outctx_base_t::set_dlbind_opnd ( void )
inline

◆ print_label_now()

bool outctx_base_t::print_label_now ( ) const
inline

◆ forbid_annotations()

int outctx_base_t::forbid_annotations ( )
inline

◆ restore_ctxflags()

void outctx_base_t::restore_ctxflags ( int saved_flags)
inline

◆ operator=()

outctx_base_t & outctx_base_t::operator= ( const outctx_base_t & )
delete

◆ AS_PRINTF() [1/8]

outctx_base_t::AS_PRINTF ( 2 ,
3  ) const

Append a formatted string to the output string.


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

Returns
the number of characters appended

◆ va_start() [1/4]

outctx_base_t::va_start ( va ,
format  )

◆ va_end() [1/4]

outctx_base_t::va_end ( va )

◆ GCC_DIAG_OFF()

outctx_base_t::GCC_DIAG_OFF ( format- nonliteral)

◆ nowarn_out_printf()

size_t outctx_base_t::nowarn_out_printf ( const char * format,
... )
inline

◆ GCC_DIAG_ON()

outctx_base_t::GCC_DIAG_ON ( format- nonliteral)

◆ AS_PRINTF() [2/8]

virtual outctx_base_t::AS_PRINTF ( 2 ,
0  ) const
virtual

◆ out_value()

virtual flags64_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 F. It outputs colored text.

Parameters
xvalue to output
outfOutput value flags
Returns
flags of the output value, otherwise:
Return values
-1if printed a number with COLOR_ERROR
0if printed a nice number or character or segment or enum

◆ out_symbol()

virtual void idaapi outctx_base_t::out_symbol ( char c)
virtual

Output a character with COLOR_SYMBOL color.

◆ out_chars()

virtual void idaapi outctx_base_t::out_chars ( char c,
int n )
virtual

Append a character multiple times.

◆ out_spaces()

void outctx_base_t::out_spaces ( ssize_t len)
inline

Appends spaces to outbuf until its tag_strlen becomes 'len'.

◆ add_spaces()

virtual void idaapi outctx_base_t::add_spaces ( qstring * buf,
ssize_t len )
virtual

◆ out_line()

virtual void idaapi outctx_base_t::out_line ( const char * str,
color_t color = 0 )
virtual

Output a string with the specified color.

◆ out_keyword()

void outctx_base_t::out_keyword ( const char * str)
inline

Output a string with COLOR_KEYWORD color.

◆ out_register()

void outctx_base_t::out_register ( const char * str)
inline

Output a character with COLOR_REG color.

◆ out_lvar()

void outctx_base_t::out_lvar ( const char * name,
int width = -1 )
inline

Output local variable name with COLOR_LOCNAME color.

◆ out_tagon()

virtual void idaapi outctx_base_t::out_tagon ( color_t tag)
virtual

Output "turn color on" escape sequence.

◆ out_tagoff()

virtual void idaapi outctx_base_t::out_tagoff ( color_t tag)
virtual

Output "turn color off" escape sequence.

◆ out_addr_tag()

virtual void idaapi outctx_base_t::out_addr_tag ( ea_t ea)
virtual

Output "address" escape sequence.

◆ out_colored_register_line()

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)

◆ out_char()

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

◆ out_btoa()

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

Reimplemented in outctx_t.

◆ out_long()

virtual void idaapi 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 ..\ida\gl.cpp (before calling processor_t::d_out())
Parameters
vvalue to output
radixbase (2,8,10,16)
suspopsuspop
  • 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

◆ out_name_expr()

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

◆ close_comment()

void outctx_base_t::close_comment ( void )
inline

◆ flush_outbuf()

virtual bool idaapi outctx_base_t::flush_outbuf ( int indent = -1)
virtual

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.


Functions to populate the output line array (lnar)

◆ flush_buf()

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

◆ term_outctx()

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

Finalize the output context.

Returns
the number of generated lines.

Reimplemented in outctx_t.

◆ AS_PRINTF() [3/8]

virtual outctx_base_t::AS_PRINTF ( 3 ,
0  )
virtual

See gen_printf()

◆ AS_PRINTF() [4/8]

outctx_base_t::AS_PRINTF ( 3 ,
4  )

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

◆ va_start() [2/4]

const char outctx_base_t::va_start ( va ,
format  )

◆ va_end() [2/4]

outctx_base_t::va_end ( va )

◆ gen_empty_line()

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

◆ gen_border_line()

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

◆ AS_PRINTF() [5/8]

virtual outctx_base_t::AS_PRINTF ( 3 ,
0  )
virtual

See gen_cmt_line()

◆ AS_PRINTF() [6/8]

outctx_base_t::AS_PRINTF ( 2 ,
0  ) const

See gen_cmt_line()

◆ AS_PRINTF() [7/8]

outctx_base_t::AS_PRINTF ( 2 ,
3  ) const

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

◆ va_start() [3/4]

outctx_base_t::va_start ( va ,
format  )

◆ va_end() [3/4]

outctx_base_t::va_end ( va )

◆ AS_PRINTF() [8/8]

outctx_base_t::AS_PRINTF ( 2 ,
3  ) const

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

◆ va_start() [4/4]

outctx_base_t::va_start ( va ,
format  )

◆ va_end() [4/4]

outctx_base_t::va_end ( va )

◆ gen_block_cmt()

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

◆ setup_outctx()

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

Initialization; normally used only by the kernel.

Reimplemented in outctx_t.

◆ retrieve_cmt()

virtual ssize_t idaapi outctx_base_t::retrieve_cmt ( void )
inlinevirtual

Reimplemented in outctx_t.

◆ retrieve_name()

virtual ssize_t idaapi outctx_base_t::retrieve_name ( qstring * ,
color_t *  )
inlinevirtual

Reimplemented in outctx_t.

◆ gen_xref_lines()

virtual bool idaapi outctx_base_t::gen_xref_lines ( void )
inlinevirtual

Reimplemented in outctx_t.

◆ init_lines_array()

virtual void idaapi outctx_base_t::init_lines_array ( qstrvec_t * answers,
int maxsize )
virtual

◆ get_stkvar()

virtual ssize_t idaapi outctx_base_t::get_stkvar ( const op_t & x,
uval_t v,
sval_t * vv,
int * is_sp_based,
tinfo_t * _frame )
virtual

◆ gen_empty_line_without_annotations()

void outctx_base_t::gen_empty_line_without_annotations ( void )
inline

◆ getF()

flags64_t outctx_base_t::getF ( ) const
inline

◆ flush_and_reinit()

virtual bool idaapi outctx_base_t::flush_and_reinit ( void )
protectedvirtual

◆ append_user_prefix()

virtual void idaapi outctx_base_t::append_user_prefix ( const char * ,
int  )
inlineprotectedvirtual

◆ add_aux_prefix()

virtual void idaapi outctx_base_t::add_aux_prefix ( const char * ,
int  )
inlineprotectedvirtual

◆ out_label_addr_tag()

virtual void idaapi outctx_base_t::out_label_addr_tag ( void )
inlineprotectedvirtual

◆ out_aux_cmts()

virtual void idaapi outctx_base_t::out_aux_cmts ( void )
inlineprotectedvirtual

Member Data Documentation

◆ _eah

ea_helper_t& outctx_base_t::_eah

◆ insn_ea

ea_t outctx_base_t::insn_ea

◆ outbuf

qstring outctx_base_t::outbuf

buffer for the current output line once ready, it is moved to lnar

◆ regname_idx

ssize_t outctx_base_t::regname_idx = -1

to rename registers

◆ suspop

int outctx_base_t::suspop

controls color for out_long()

◆ F32

flags_t outctx_base_t::F32

please use outctx_t::F instead

◆ outvalues

uval_t* outctx_base_t::outvalues = nullptr

at least 2*UA_MAXOP elements

◆ outvalue_getn_flags

int outctx_base_t::outvalue_getn_flags = 0

additional flags for print_operand()

◆ user_data

void* outctx_base_t::user_data = nullptr

pointer to be used by the processor module for any purpose

◆ kern_data

void* outctx_base_t::kern_data = nullptr

internal info used by the kernel

◆ lnar

qstrvec_t* outctx_base_t::lnar = nullptr

vector of output lines

◆ lnar_maxsize

int outctx_base_t::lnar_maxsize = 0

max permitted size of lnar

◆ default_lnnum

int outctx_base_t::default_lnnum = -1

index of the most important line in lnar

◆ line_prefix

qstring outctx_base_t::line_prefix

usually segname:offset

◆ prefix_len

ssize_t outctx_base_t::prefix_len = 0

visible length of line_prefix

◆ ctxflags

int outctx_base_t::ctxflags = 0

various bits

◆ ind0

int outctx_base_t::ind0 = 0

◆ cmt_ea

ea_t outctx_base_t::cmt_ea = BADADDR

indirectly referenced address (used to generate cmt)

◆ cmtbuf

qstring outctx_base_t::cmtbuf

indented comment

◆ cmtptr

const char* outctx_base_t::cmtptr = nullptr

rest of indented comment

◆ cmtcolor

color_t outctx_base_t::cmtcolor = 0xFF

comment color

◆ len [1/2]

size_t outctx_base_t::len = out_vprintf(format, va)

◆ len [2/2]

return outctx_base_t::len

◆ va [1/3]

const char va_list outctx_base_t::va

◆ format [1/2]

const char * outctx_base_t::format

◆ va [2/3]

virtual const char va_list outctx_base_t::va

◆ format [2/2]

const char* outctx_base_t::format

◆ code [1/2]

return outctx_base_t::code = gen_vprintf(indent, format, va)

◆ code [2/2]

return outctx_base_t::code

◆ va [3/3]

va_list outctx_base_t::va
Initial value:
{
return gen_colored_cmt_line_v(COLOR_AUTOCMT, format, va)
const color_t COLOR_AUTOCMT
Automatic comment.
Definition lines.hpp:102
idaman THREAD_SAFE va_list va
See qsscanf()
Definition err.h:21
idaman THREAD_SAFE const char * format
Definition fpro.h:78

◆ answer [1/2]

bool outctx_base_t::answer = gen_colored_cmt_line_v(COLOR_COLLAPSED, format, va)

◆ answer [2/2]

return outctx_base_t::answer

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