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

Information about the pseudocode window. More...

#include <hexrays.hpp>

Public Member Functions

bool visible () const
 Is the pseudocode window visible?
bool valid () const
 Does the pseudocode window contain valid code?
bool locked () const
 Does the pseudocode window contain valid code?
void set_visible (bool v)
void set_valid (bool v)
bool hexapi set_locked (bool v)
 vdui_t ()
void hexapi refresh_view (bool redo_mba)
 Refresh pseudocode window.
void hexapi refresh_ctext (bool activate=true)
 Refresh pseudocode window.
void hexapi switch_to (cfuncptr_t f, bool activate)
 Display the specified pseudocode.
bool in_ctree () const
 Is the current item a statement?
cnumber_t *hexapi get_number ()
 Get current number.
int hexapi get_current_label ()
 Get current label.
void hexapi clear ()
 Clear the pseudocode window.
bool hexapi refresh_cpos (input_device_t idv)
 Refresh the current position.
bool hexapi get_current_item (input_device_t idv)
 Get current item.
bool hexapi ui_rename_lvar (lvar_t *v)
 Rename local variable.
bool hexapi rename_lvar (lvar_t *v, const char *name, bool is_user_name)
 Rename local variable.
bool hexapi ui_set_call_type (const cexpr_t *e)
 Set type of a function call This function displays a dialog box and allows the user to change the type of a function call.
bool hexapi ui_set_lvar_type (lvar_t *v)
 Set local variable type.
bool hexapi set_lvar_type (lvar_t *v, const tinfo_t &type)
 Set local variable type.
bool hexapi set_noptr_lvar (lvar_t *v)
 Inform that local variable should have a non-pointer type This function permanently sets a corresponding variable flag (NOPTR) and removes type if it was set before by function 'set_lvar_type'.
bool hexapi ui_edit_lvar_cmt (lvar_t *v)
 Set local variable comment.
bool hexapi set_lvar_cmt (lvar_t *v, const char *cmt)
 Set local variable comment.
bool hexapi ui_map_lvar (lvar_t *v)
 Map a local variable to another.
bool hexapi ui_unmap_lvar (lvar_t *v)
 Unmap a local variable.
bool hexapi map_lvar (lvar_t *from, lvar_t *to)
 Map a local variable to another.
bool hexapi set_udm_type (tinfo_t &udt_type, int udm_idx)
 Set structure field type.
bool hexapi rename_udm (tinfo_t &udt_type, int udm_idx)
 Rename structure field.
bool hexapi set_global_type (ea_t ea)
 Set global item type.
bool hexapi rename_global (ea_t ea)
 Rename global item.
bool hexapi rename_label (int label)
 Rename a label.
bool hexapi jump_enter (input_device_t idv, int omflags)
 Process the Enter key.
bool hexapi ctree_to_disasm ()
 Jump to disassembly.
cmt_type_t hexapi calc_cmt_type (size_t lnnum, cmt_type_t cmttype) const
 Check if the specified line can have a comment.
bool hexapi edit_cmt (const treeloc_t &loc)
 Edit an indented comment.
bool hexapi edit_func_cmt ()
 Edit a function comment.
bool hexapi del_orphan_cmts ()
 Delete all orphan comments.
bool hexapi set_num_radix (int base)
 Change number base.
bool hexapi set_num_enum ()
 Convert number to symbolic constant.
bool hexapi set_num_stroff ()
 Convert number to structure field offset.
bool hexapi invert_sign ()
 Negate a number.
bool hexapi invert_bits ()
 Bitwise negate a number.
bool hexapi collapse_item (bool hide)
 Collapse/uncollapse item.
bool hexapi collapse_lvars (bool hide)
 Collapse/uncollapse local variable declarations.
bool hexapi split_item (bool split)
 Split/unsplit item.

Public Attributes

int flags = 0
 Properties of pseudocode window
int view_idx
 pseudocode window index (0..)
TWidgetct = nullptr
 pseudocode view
TWidgettoplevel = nullptr
mba_tmba
 pointer to underlying microcode
cfuncptr_t cfunc
 pointer to function object
merror_t last_code
 result of the last user action. See Microcode error code
ctext_position_t cpos
 Current ctext position.
ctree_item_t head
 First ctree item on the current line (for block comments)
ctree_item_t item
 Current ctree item.
ctree_item_t tail
 Tail ctree item on the current line (for indented comments)

Detailed Description

Information about the pseudocode window.

Constructor & Destructor Documentation

◆ vdui_t()

vdui_t::vdui_t ( )

Member Function Documentation

◆ visible()

bool vdui_t::visible ( ) const
inline

Is the pseudocode window visible?

if not, it might be invisible or destroyed

◆ valid()

bool vdui_t::valid ( ) const
inline

Does the pseudocode window contain valid code?

It can become invalid if the function type gets changed in IDA.

◆ locked()

bool vdui_t::locked ( ) const
inline

Does the pseudocode window contain valid code?

We lock windows before modifying them, to avoid recursion due to the events generated by the IDA kernel.

Return values
trueThe window is locked and may have stale info

◆ set_visible()

void vdui_t::set_visible ( bool v)
inline

◆ set_valid()

void vdui_t::set_valid ( bool v)
inline

◆ set_locked()

bool vdui_t::set_locked ( bool v)
inline

◆ refresh_view()

void vdui_t::refresh_view ( bool redo_mba)
inline

Refresh pseudocode window.

This is the highest level refresh function. It causes the most profound refresh possible and can lead to redecompilation of the current function. Please consider using refresh_ctext() if you need a more superficial refresh.

Parameters
redo_mbatrue means to redecompile the current function
false means to rebuild ctree without regenerating microcode
See also
refresh_ctext()

◆ refresh_ctext()

void vdui_t::refresh_ctext ( bool activate = true)
inline

Refresh pseudocode window.

This function refreshes the pseudocode window by regenerating its text from cfunc_t. Instead of this function use refresh_func_ctext(), which refreshes all pseudocode windows for the function.

See also
refresh_view(), refresh_func_ctext()

◆ switch_to()

void vdui_t::switch_to ( cfuncptr_t f,
bool activate )
inline

Display the specified pseudocode.

This function replaces the pseudocode window contents with the specified cfunc_t.

Parameters
fpointer to the function to display.
activateshould the pseudocode window get focus?

◆ in_ctree()

bool vdui_t::in_ctree ( ) const
inline

Is the current item a statement?

Returns
false if the cursor is in the local variable/type declaration area
true if the cursor is in the statement area

◆ get_number()

cnumber_t * vdui_t::get_number ( )
inline

Get current number.

If the current item is a number, return pointer to it.

Returns
nullptr if the current item is not a number This function returns non-null for the cases of a 'switch' statement Also, if the current item is a casted number, then this function will succeed.

◆ get_current_label()

int vdui_t::get_current_label ( )
inline

Get current label.

If there is a label under the cursor, return its number.

Returns
-1 if there is no label under the cursor. prereq: get_current_item() has been called

◆ clear()

void vdui_t::clear ( )
inline

Clear the pseudocode window.

It deletes the current function and microcode.

◆ refresh_cpos()

bool vdui_t::refresh_cpos ( input_device_t idv)
inline

Refresh the current position.

This function refreshes the cpos field.

Returns
false if failed
Parameters
idvkeyboard or mouse

◆ get_current_item()

bool vdui_t::get_current_item ( input_device_t idv)
inline

Get current item.

This function refreshes the cpos, item, tail fields.

Returns
false if failed
Parameters
idvkeyboard or mouse
See also
cfunc_t::get_line_item()

◆ ui_rename_lvar()

bool vdui_t::ui_rename_lvar ( lvar_t * v)
inline

Rename local variable.

This function displays a dialog box and allows the user to rename a local variable.

Returns
false if failed or cancelled
Parameters
vpointer to local variable

◆ rename_lvar()

bool vdui_t::rename_lvar ( lvar_t * v,
const char * name,
bool is_user_name )
inline

Rename local variable.

This function permanently renames a local variable.

Returns
false if failed
Parameters
vpointer to local variable
namenew variable name
is_user_nameuse true to save the new name into the database. use false to delete the saved name.
See also
rename_lvar()

◆ ui_set_call_type()

bool vdui_t::ui_set_call_type ( const cexpr_t * e)
inline

Set type of a function call This function displays a dialog box and allows the user to change the type of a function call.

Returns
false if failed or cancelled
Parameters
epointer to call expression

◆ ui_set_lvar_type()

bool vdui_t::ui_set_lvar_type ( lvar_t * v)
inline

Set local variable type.

This function displays a dialog box and allows the user to change the type of a local variable.

Returns
false if failed or cancelled
Parameters
vpointer to local variable

◆ set_lvar_type()

bool vdui_t::set_lvar_type ( lvar_t * v,
const tinfo_t & type )
inline

Set local variable type.

This function permanently sets a local variable type and clears NOPTR flag if it was set before by function 'set_noptr_lvar'

Returns
false if failed
Parameters
vpointer to local variable
typenew variable type

◆ set_noptr_lvar()

bool vdui_t::set_noptr_lvar ( lvar_t * v)
inline

Inform that local variable should have a non-pointer type This function permanently sets a corresponding variable flag (NOPTR) and removes type if it was set before by function 'set_lvar_type'.

Returns
false if failed
Parameters
vpointer to local variable

◆ ui_edit_lvar_cmt()

bool vdui_t::ui_edit_lvar_cmt ( lvar_t * v)
inline

Set local variable comment.

This function displays a dialog box and allows the user to edit the comment of a local variable.

Returns
false if failed or cancelled
Parameters
vpointer to local variable

◆ set_lvar_cmt()

bool vdui_t::set_lvar_cmt ( lvar_t * v,
const char * cmt )
inline

Set local variable comment.

This function permanently sets a variable comment.

Returns
false if failed
Parameters
vpointer to local variable
cmtnew comment

◆ ui_map_lvar()

bool vdui_t::ui_map_lvar ( lvar_t * v)
inline

Map a local variable to another.

This function displays a variable list and allows the user to select mapping.

Returns
false if failed or cancelled
Parameters
vpointer to local variable

◆ ui_unmap_lvar()

bool vdui_t::ui_unmap_lvar ( lvar_t * v)
inline

Unmap a local variable.

This function displays list of variables mapped to the specified variable and allows the user to select a variable to unmap.

Returns
false if failed or cancelled
Parameters
vpointer to local variable

◆ map_lvar()

bool vdui_t::map_lvar ( lvar_t * from,
lvar_t * to )
inline

Map a local variable to another.

This function permanently maps one lvar to another. All occurrences of the mapped variable are replaced by the new variable

Returns
false if failed
Parameters
fromthe variable being mapped
tothe variable to map to. if nullptr, unmaps the variable

◆ set_udm_type()

bool vdui_t::set_udm_type ( tinfo_t & udt_type,
int udm_idx )
inline

Set structure field type.

This function displays a dialog box and allows the user to change the type of a structure field.

Returns
false if failed or cancelled
Parameters
udt_typestructure/union type
udm_idxindex of the structure/union member

◆ rename_udm()

bool vdui_t::rename_udm ( tinfo_t & udt_type,
int udm_idx )
inline

Rename structure field.

This function displays a dialog box and allows the user to rename a structure field.

Returns
false if failed or cancelled
Parameters
udt_typestructure/union type
udm_idxindex of the structure/union member

◆ set_global_type()

bool vdui_t::set_global_type ( ea_t ea)
inline

Set global item type.

This function displays a dialog box and allows the user to change the type of a global item (data or function).

Returns
false if failed or cancelled
Parameters
eaaddress of the global item

◆ rename_global()

bool vdui_t::rename_global ( ea_t ea)
inline

Rename global item.

This function displays a dialog box and allows the user to rename a global item (data or function).

Returns
false if failed or cancelled
Parameters
eaaddress of the global item

◆ rename_label()

bool vdui_t::rename_label ( int label)
inline

Rename a label.

This function displays a dialog box and allows the user to rename a statement label.

Returns
false if failed or cancelled
Parameters
labellabel number

◆ jump_enter()

bool vdui_t::jump_enter ( input_device_t idv,
int omflags )
inline

Process the Enter key.

This function jumps to the definition of the item under the cursor. If the current item is a function, it will be decompiled. If the current item is a global data, its disassemly text will be displayed.

Returns
false if failed
Parameters
idvwhat cursor must be used, the keyboard or the mouse
omflagsOM_NEWWIN: new pseudocode window will open, 0: reuse the existing window

◆ ctree_to_disasm()

bool vdui_t::ctree_to_disasm ( )
inline

Jump to disassembly.

This function jumps to the address in the disassembly window which corresponds to the current item. The current item is determined based on the current keyboard cursor position.

Returns
false if failed

◆ calc_cmt_type()

cmt_type_t vdui_t::calc_cmt_type ( size_t lnnum,
cmt_type_t cmttype ) const
inline

Check if the specified line can have a comment.

Due to the coordinate system for comments: (https://hex-rays.com/blog/coordinate-system-for-hex-rays) some function lines cannot have comments. This function checks if a comment can be attached to the specified line.

Returns
possible comment types
Parameters
lnnumline number (0 based)
cmttypecomment types to check

◆ edit_cmt()

bool vdui_t::edit_cmt ( const treeloc_t & loc)
inline

Edit an indented comment.

This function displays a dialog box and allows the user to edit the comment for the specified ctree location.

Returns
false if failed or cancelled
Parameters
loccomment location

◆ edit_func_cmt()

bool vdui_t::edit_func_cmt ( )
inline

Edit a function comment.

This function displays a dialog box and allows the user to edit the function comment.

Returns
false if failed or cancelled

◆ del_orphan_cmts()

bool vdui_t::del_orphan_cmts ( )
inline

Delete all orphan comments.

Delete all orphan comments and refresh the screen.

Returns
true

◆ set_num_radix()

bool vdui_t::set_num_radix ( int base)
inline

Change number base.

This function changes the current number representation.

Returns
false if failed
Parameters
basenumber radix (10 or 16)
0 means a character constant

◆ set_num_enum()

bool vdui_t::set_num_enum ( )
inline

Convert number to symbolic constant.

This function displays a dialog box and allows the user to select a symbolic constant to represent the number.

Returns
false if failed or cancelled

◆ set_num_stroff()

bool vdui_t::set_num_stroff ( )
inline

Convert number to structure field offset.

Currently not implemented.

Returns
false if failed or cancelled

◆ invert_sign()

bool vdui_t::invert_sign ( )
inline

Negate a number.

This function negates the current number.

Returns
false if failed.

◆ invert_bits()

bool vdui_t::invert_bits ( )
inline

Bitwise negate a number.

This function inverts all bits of the current number.

Returns
false if failed.

◆ collapse_item()

bool vdui_t::collapse_item ( bool hide)
inline

Collapse/uncollapse item.

This function collapses the current item.

Returns
false if failed.

◆ collapse_lvars()

bool vdui_t::collapse_lvars ( bool hide)
inline

Collapse/uncollapse local variable declarations.

Returns
false if failed.

◆ split_item()

bool vdui_t::split_item ( bool split)
inline

Split/unsplit item.

This function splits the current assignment expression.

Returns
false if failed.

Member Data Documentation

◆ flags

int vdui_t::flags = 0

◆ view_idx

int vdui_t::view_idx

pseudocode window index (0..)

◆ ct

TWidget* vdui_t::ct = nullptr

pseudocode view

◆ toplevel

TWidget* vdui_t::toplevel = nullptr

◆ mba

mba_t* vdui_t::mba

pointer to underlying microcode

◆ cfunc

cfuncptr_t vdui_t::cfunc

pointer to function object

◆ last_code

merror_t vdui_t::last_code

result of the last user action. See Microcode error code

◆ cpos

ctext_position_t vdui_t::cpos

Current ctext position.

◆ head

ctree_item_t vdui_t::head

First ctree item on the current line (for block comments)

◆ item

ctree_item_t vdui_t::item

Current ctree item.

◆ tail

ctree_item_t vdui_t::tail

Tail ctree item on the current line (for indented comments)


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