Decompiled function. Decompilation result is kept here. More...
#include <hexrays.hpp>
Public Member Functions | |
cfunc_t (mba_t *mba) | |
void | release (void) |
void | build_c_tree (void) |
Generate the function body. More... | |
void | verify (allow_unused_labels_t aul, bool even_without_debugger) const |
Verify the ctree. More... | |
void | print_dcl (qstring *vout) const |
Print function prototype. More... | |
void | print_func (vc_printer_t &vp) const |
Print function text. More... | |
bool | get_func_type (tinfo_t *type) const |
Get the function type. More... | |
lvars_t * | get_lvars (void) |
Get vector of local variables. More... | |
sval_t | get_stkoff_delta (void) |
Get stack offset delta. More... | |
citem_t * | find_label (int label) |
Find the label. More... | |
void | remove_unused_labels (void) |
Remove unused labels. More... | |
const char * | get_user_cmt (const treeloc_t &loc, cmt_retrieval_type_t rt) const |
Retrieve a user defined comment. More... | |
void | set_user_cmt (const treeloc_t &loc, const char *cmt) |
Set a user defined comment. More... | |
int32 | get_user_iflags (const citem_locator_t &loc) const |
Retrieve citem iflags. More... | |
void | set_user_iflags (const citem_locator_t &loc, int32 iflags) |
Set citem iflags. More... | |
bool | has_orphan_cmts (void) const |
Check if there are orphan comments. More... | |
int | del_orphan_cmts (void) |
Delete all orphan comments. More... | |
bool | get_user_union_selection (ea_t ea, intvec_t *path) |
Retrieve a user defined union field selection. More... | |
void | set_user_union_selection (ea_t ea, const intvec_t &path) |
Set a union field selection. More... | |
void | save_user_labels () const |
Save user-defined labels into the database. More... | |
void | save_user_cmts () const |
Save user-defined comments into the database. More... | |
void | save_user_numforms () const |
Save user-defined number formats into the database. More... | |
void | save_user_iflags () const |
Save user-defined iflags into the database. More... | |
void | save_user_unions () const |
Save user-defined union field selections into the database. More... | |
bool | get_line_item (const char *line, int x, bool is_ctree_line, ctree_item_t *phead, ctree_item_t *pitem, ctree_item_t *ptail) |
Get ctree item for the specified cursor position. More... | |
hexwarns_t & | get_warnings (void) |
Get information about decompilation warnings. More... | |
eamap_t & | get_eamap (void) |
Get pointer to ea->insn map. More... | |
boundaries_t & | get_boundaries (void) |
Get pointer to map of instruction boundaries. More... | |
const strvec_t & | get_pseudocode (void) |
Get pointer to decompilation output: the pseudocode. More... | |
void | refresh_func_ctext (void) |
Refresh ctext after a ctree modification. More... | |
bool | gather_derefs (const ctree_item_t &ci, udt_type_data_t *udm=nullptr) const |
bool | find_item_coords (const citem_t *item, int *px, int *py) |
bool | locked (void) const |
Public Attributes | |
ea_t | entry_ea |
function entry address More... | |
mba_t * | mba |
underlying microcode More... | |
cinsn_t | body |
function body, must be a block More... | |
intvec_t & | argidx |
list of arguments (indexes into vars) More... | |
ctree_maturity_t | maturity |
maturity level More... | |
user_labels_t * | user_labels |
user-defined labels. More... | |
user_cmts_t * | user_cmts |
user-defined comments. More... | |
user_numforms_t * | numforms |
user-defined number formats. More... | |
user_iflags_t * | user_iflags |
user-defined item flags ctree item iflags bits More... | |
user_unions_t * | user_unions |
user-defined union field selections. More... | |
int | refcnt |
reference count to this object. use cfuncptr_t More... | |
int | statebits |
current cfunc_t state. More... | |
eamap_t * | eamap |
ea->insn map. use get_eamap More... | |
boundaries_t * | boundaries |
map of instruction boundaries. use get_boundaries More... | |
strvec_t | sv |
decompilation output: function text. use get_pseudocode More... | |
int | hdrlines |
number of lines in the declaration area More... | |
ctree_items_t | treeitems |
vector of ctree items More... | |
char | reserved [] |
Detailed Description
Decompiled function. Decompilation result is kept here.
- Examples
- hexrays_sample2.cpp, hexrays_sample3.cpp, hexrays_sample6.cpp, and hexrays_sample7.cpp.
Definition at line 6924 of file hexrays.hpp.
Constructor & Destructor Documentation
◆ ~cfunc_t()
cfunc_t::~cfunc_t | ( | void | ) |
Definition at line 6960 of file hexrays.hpp.
Member Function Documentation
◆ build_c_tree()
void cfunc_t::build_c_tree | ( | void | ) |
Generate the function body.
This function (re)generates the function body from the underlying microcode.
Definition at line 12054 of file hexrays.hpp.
◆ del_orphan_cmts()
int cfunc_t::del_orphan_cmts | ( | void | ) |
Delete all orphan comments.
The save_user_cmts() function must be called after this call.
Definition at line 12140 of file hexrays.hpp.
◆ find_item_coords()
bool cfunc_t::find_item_coords | ( | const citem_t * | item, |
int * | px, | ||
int * | py | ||
) |
Definition at line 12230 of file hexrays.hpp.
◆ find_label()
citem_t * cfunc_t::find_label | ( | int | label | ) |
Find the label.
- Returns
- pointer to the ctree item with the specified label number.
Definition at line 12098 of file hexrays.hpp.
◆ gather_derefs()
bool cfunc_t::gather_derefs | ( | const ctree_item_t & | ci, |
udt_type_data_t * | udm = nullptr |
||
) | const |
Definition at line 12224 of file hexrays.hpp.
◆ get_boundaries()
boundaries_t & cfunc_t::get_boundaries | ( | void | ) |
Get pointer to map of instruction boundaries.
This function initializes the boundary map if not done yet.
Definition at line 12206 of file hexrays.hpp.
◆ get_eamap()
eamap_t & cfunc_t::get_eamap | ( | void | ) |
Get pointer to ea->insn map.
This function initializes eamap if not done yet.
Definition at line 12200 of file hexrays.hpp.
◆ get_func_type()
bool cfunc_t::get_func_type | ( | tinfo_t * | type | ) | const |
Get the function type.
- Parameters
-
type variable where the function type is returned
- Returns
- false if failure
Definition at line 12078 of file hexrays.hpp.
◆ get_line_item()
bool cfunc_t::get_line_item | ( | const char * | line, |
int | x, | ||
bool | is_ctree_line, | ||
ctree_item_t * | phead, | ||
ctree_item_t * | pitem, | ||
ctree_item_t * | ptail | ||
) |
Get ctree item for the specified cursor position.
- Returns
- false if failed to get the current item
- Parameters
-
line line of decompilation text (element of sv) x x cursor coordinate in the line is_ctree_line does the line belong to statement area? (if not, it is assumed to belong to the declaration area) phead ptr to the first item on the line (used to attach block comments). May be nullptr pitem ptr to the current item. May be nullptr ptail ptr to the last item on the line (used to attach indented comments). May be nullptr
- See also
- vdui_t::get_current_item()
Definition at line 12188 of file hexrays.hpp.
◆ get_lvars()
lvars_t * cfunc_t::get_lvars | ( | void | ) |
Get vector of local variables.
- Returns
- pointer to the vector of local variables. If you modify this vector, the ctree must be regenerated in order to have correct cast operators. Use build_c_tree() for that. Removing lvars should be done carefully: all references in ctree and microcode must be corrected after that.
Definition at line 12084 of file hexrays.hpp.
◆ get_pseudocode()
const strvec_t & cfunc_t::get_pseudocode | ( | void | ) |
Get pointer to decompilation output: the pseudocode.
This function generates pseudocode if not done yet.
Definition at line 12212 of file hexrays.hpp.
◆ get_stkoff_delta()
sval_t cfunc_t::get_stkoff_delta | ( | void | ) |
Get stack offset delta.
The local variable stack offsets retrieved by v.location.stkoff() should be adjusted before being used as stack frame offsets in IDA.
- Returns
- the delta to apply. example: ida_stkoff = v.location.stkoff() - f->get_stkoff_delta()
Definition at line 12090 of file hexrays.hpp.
◆ get_user_cmt()
const char * cfunc_t::get_user_cmt | ( | const treeloc_t & | loc, |
cmt_retrieval_type_t | rt | ||
) | const |
Retrieve a user defined comment.
- Parameters
-
loc ctree location rt should already retrieved comments retrieved again?
- Returns
- pointer to the comment string or nullptr
Definition at line 12110 of file hexrays.hpp.
◆ get_user_iflags()
int32 cfunc_t::get_user_iflags | ( | const citem_locator_t & | loc | ) | const |
Retrieve citem iflags.
- Parameters
-
loc citem locator
- Returns
- ctree item iflags bits or 0
Definition at line 12122 of file hexrays.hpp.
◆ get_user_union_selection()
bool cfunc_t::get_user_union_selection | ( | ea_t | ea, |
intvec_t * | path | ||
) |
Retrieve a user defined union field selection.
- Parameters
-
ea address path out: path describing the union selection.
- Returns
- pointer to the path or nullptr
Definition at line 12146 of file hexrays.hpp.
◆ get_warnings()
hexwarns_t & cfunc_t::get_warnings | ( | void | ) |
Get information about decompilation warnings.
- Returns
- reference to the vector of warnings
Definition at line 12194 of file hexrays.hpp.
◆ has_orphan_cmts()
bool cfunc_t::has_orphan_cmts | ( | void | ) | const |
Check if there are orphan comments.
Definition at line 12134 of file hexrays.hpp.
◆ locked()
bool cfunc_t::locked | ( | void | ) | const |
Definition at line 7106 of file hexrays.hpp.
◆ print_dcl()
void cfunc_t::print_dcl | ( | qstring * | vout | ) | const |
Print function prototype.
- Parameters
-
vout output buffer
Definition at line 12066 of file hexrays.hpp.
◆ print_func()
void cfunc_t::print_func | ( | vc_printer_t & | vp | ) | const |
Print function text.
- Parameters
-
vp printer helper class to receive the generated text.
Definition at line 12072 of file hexrays.hpp.
◆ refresh_func_ctext()
void cfunc_t::refresh_func_ctext | ( | void | ) |
Refresh ctext after a ctree modification.
This function informs the decompiler that ctree (body) have been modified and ctext (sv) does not correspond to it anymore. It also refreshes the pseudocode windows if there is any.
Definition at line 12218 of file hexrays.hpp.
◆ release()
void cfunc_t::release | ( | void | ) |
Definition at line 6961 of file hexrays.hpp.
◆ remove_unused_labels()
void cfunc_t::remove_unused_labels | ( | void | ) |
Remove unused labels.
This function checks what labels are really used by the function and removes the unused ones. You must call it after deleting a goto statement.
Definition at line 12104 of file hexrays.hpp.
◆ save_user_cmts()
void cfunc_t::save_user_cmts | ( | void | ) | const |
Save user-defined comments into the database.
Definition at line 12164 of file hexrays.hpp.
◆ save_user_iflags()
void cfunc_t::save_user_iflags | ( | void | ) | const |
Save user-defined iflags into the database.
Definition at line 12176 of file hexrays.hpp.
◆ save_user_labels()
void cfunc_t::save_user_labels | ( | void | ) | const |
Save user-defined labels into the database.
Definition at line 12158 of file hexrays.hpp.
◆ save_user_numforms()
void cfunc_t::save_user_numforms | ( | void | ) | const |
Save user-defined number formats into the database.
Definition at line 12170 of file hexrays.hpp.
◆ save_user_unions()
void cfunc_t::save_user_unions | ( | void | ) | const |
Save user-defined union field selections into the database.
Definition at line 12182 of file hexrays.hpp.
◆ set_user_cmt()
void cfunc_t::set_user_cmt | ( | const treeloc_t & | loc, |
const char * | cmt | ||
) |
Set a user defined comment.
This function stores the specified comment in the cfunc_t structure. The save_user_cmts() function must be called after it.
- Parameters
-
loc ctree location cmt new comment. if empty or nullptr, then an existing comment is deleted.
Definition at line 12116 of file hexrays.hpp.
◆ set_user_iflags()
void cfunc_t::set_user_iflags | ( | const citem_locator_t & | loc, |
int32 | iflags | ||
) |
Set citem iflags.
- Parameters
-
loc citem locator iflags new iflags
Definition at line 12128 of file hexrays.hpp.
◆ set_user_union_selection()
void cfunc_t::set_user_union_selection | ( | ea_t | ea, |
const intvec_t & | path | ||
) |
Set a union field selection.
The save_user_unions() function must be called after calling this function.
- Parameters
-
ea address path in: path describing the union selection.
Definition at line 12152 of file hexrays.hpp.
◆ verify()
void cfunc_t::verify | ( | allow_unused_labels_t | aul, |
bool | even_without_debugger | ||
) | const |
Verify the ctree.
This function verifies the ctree. If the ctree is malformed, an internal error is generated. Use it to verify the ctree after your modifications.
- Parameters
-
aul Are unused labels acceptable? even_without_debugger if false and there is no debugger, the verification will be skipped
Definition at line 12060 of file hexrays.hpp.
Member Data Documentation
◆ argidx
intvec_t& cfunc_t::argidx |
list of arguments (indexes into vars)
Definition at line 6929 of file hexrays.hpp.
◆ body
cinsn_t cfunc_t::body |
function body, must be a block
- Examples
- hexrays_sample2.cpp, hexrays_sample3.cpp, and hexrays_sample7.cpp.
Definition at line 6928 of file hexrays.hpp.
◆ boundaries
boundaries_t* cfunc_t::boundaries |
map of instruction boundaries. use get_boundaries
Definition at line 6950 of file hexrays.hpp.
◆ eamap
eamap_t* cfunc_t::eamap |
ea->insn map. use get_eamap
Definition at line 6949 of file hexrays.hpp.
◆ entry_ea
ea_t cfunc_t::entry_ea |
function entry address
Definition at line 6926 of file hexrays.hpp.
◆ hdrlines
int cfunc_t::hdrlines |
number of lines in the declaration area
Definition at line 6952 of file hexrays.hpp.
◆ maturity
ctree_maturity_t cfunc_t::maturity |
maturity level
Definition at line 6930 of file hexrays.hpp.
◆ mba
mba_t* cfunc_t::mba |
underlying microcode
Definition at line 6927 of file hexrays.hpp.
◆ numforms
user_numforms_t* cfunc_t::numforms |
user-defined number formats.
Definition at line 6935 of file hexrays.hpp.
◆ refcnt
int cfunc_t::refcnt |
reference count to this object. use cfuncptr_t
Definition at line 6942 of file hexrays.hpp.
◆ reserved
char cfunc_t::reserved[] |
Definition at line 6956 of file hexrays.hpp.
◆ statebits
int cfunc_t::statebits |
◆ sv
strvec_t cfunc_t::sv |
decompilation output: function text. use get_pseudocode
- Examples
- hexrays_sample6.cpp.
Definition at line 6951 of file hexrays.hpp.
◆ treeitems
|
mutable |
vector of ctree items
Definition at line 6953 of file hexrays.hpp.
◆ user_cmts
user_cmts_t* cfunc_t::user_cmts |
user-defined comments.
Definition at line 6934 of file hexrays.hpp.
◆ user_iflags
user_iflags_t* cfunc_t::user_iflags |
user-defined item flags ctree item iflags bits
Definition at line 6936 of file hexrays.hpp.
◆ user_labels
user_labels_t* cfunc_t::user_labels |
user-defined labels.
Definition at line 6933 of file hexrays.hpp.
◆ user_unions
user_unions_t* cfunc_t::user_unions |
user-defined union field selections.
Definition at line 6937 of file hexrays.hpp.