|
IDA C++ SDK 9.2
|
These functions use ea_t instead of func_t pointers, avoiding pointer-lifetime issues. More...
Topics | |
| Flags for get_func_entry_info() | |
| Specify which optional string fields to populate. | |
Classes | |
| class | lock_func_ea |
| RAII helper to lock a function by address. More... | |
| class | lock_func |
| Helper class to lock a function pointer so it stays valid. More... | |
| class | lock_func_with_tails_t |
| class | func_tail_iterator_t |
| Class to enumerate all function tails sorted by addresses. More... | |
| class | func_item_iterator_t |
| Class to enumerate all function instructions and data sorted by addresses. More... | |
| class | func_parent_iterator_t |
| Class to enumerate all function parents sorted by addresses. More... | |
| class | fchunk_info_t |
| Describes a function chunk (entry or tail). More... | |
| class | func_entry_info_t |
| Describes a function entry chunk. More... | |
| class | func_tail_info_t |
| Describes a function tail chunk. More... | |
| class | function_tail_iterator_t |
| Class to enumerate all function tails sorted by addresses. More... | |
| class | function_parent_iterator_t |
| Class to enumerate all function parents sorted by addresses. More... | |
| class | function_item_iterator_t |
| Class to enumerate all function instructions and data sorted by addresses. More... | |
Functions | |
| DECLARE_FUNC_ITERATORS (idaman) inline THREAD_SAFE bool idaapi f_any(flags64_t | |
| Helper function to accept any address. | |
| idaman DEPRECATED void ida_export | iterate_func_chunks (func_t *pfn, void(idaapi *func)(ea_t ea1, ea_t ea2, void *ud), void *ud=nullptr, bool include_parents=false) |
| Function to iterate function chunks (all of them including the entry chunk) | |
| idaman bool ida_export | get_fchunk_info (fchunk_info_t *out, ea_t ea) |
| Get the range of the function chunk (entry or tail) containing 'ea'. | |
| idaman bool ida_export | get_prev_fchunk_info (fchunk_info_t *out, ea_t ea) |
| Get the previous function chunk before the one containing 'ea'. | |
| idaman bool ida_export | get_next_fchunk_info (fchunk_info_t *out, ea_t ea) |
| Get the next function chunk after the one containing 'ea'. | |
| idaman bool ida_export | get_func_entry_info (func_entry_info_t *out, ea_t ea, int flags=0) |
| Get function entry info by address. | |
| idaman bool ida_export | get_func_entry_info_by_num (func_entry_info_t *out, size_t n, int flags=0) |
| Get function entry info by ordinal number. | |
| idaman bool ida_export | set_func_entry_info (const func_entry_info_t *fi) |
| Update function entry info in the database. | |
| idaman bool ida_export | add_function_ex (func_entry_info_t *fi) |
| Add a new function using func_entry_info_t. | |
| bool | add_func (ea_t ea1, ea_t ea2=BADADDR) |
| Add a new function. | |
| idaman int ida_export | find_function_bounds (func_entry_info_t *fi, int flags) |
| Determine the boundaries of a new function. | |
| idaman ea_t ida_export | calc_thunk_function_target (func_entry_info_t *fi, ea_t *fptr) |
| Calculate thunk function target. | |
| idaman bool ida_export | get_func_tail_info (func_tail_info_t *out, ea_t ea) |
| Get function tail info by address. | |
| idaman size_t ida_export | get_tail_referer_qty (ea_t tail_ea) |
| Get the number of referers (parent functions) for a tail chunk. | |
| idaman ea_t ida_export | get_tail_referer (ea_t tail_ea, size_t n) |
| Get a tail chunk referer by index. | |
| idaman bool ida_export | get_tail_referers (eavec_t *out, ea_t tail_ea) |
| Get all referers (parent functions) for a tail chunk. | |
ea-based chunk manipulation | |
Manipulate function tail chunks using addresses instead of pointers. | |
| typedef std::function< void(ea_t chunk_start, ea_t chunk_end)> | func_chunk_visitor_t |
| Callback type for iterate_func_chunks_ea(). | |
| idaman bool ida_export | append_func_tail_ea (ea_t func_ea, ea_t ea1, ea_t ea2) |
| Append a new tail chunk to the function at func_ea. | |
| idaman bool ida_export | remove_func_tail_ea (ea_t func_ea, ea_t tail_ea) |
| Remove a function tail. | |
| idaman bool ida_export | set_tail_owner_ea (ea_t tail_ea, ea_t new_owner) |
| Set a new owner of a function tail. | |
| idaman int ida_export | get_func_chunknum_ea (ea_t func_ea, ea_t ea) |
| Get the containing chunk number. | |
| idaman size_t ida_export | get_func_tail_qty (ea_t func_ea) |
| Get the number of function tail chunks. | |
| idaman bool ida_export | get_func_tails (rangevec_t *out, ea_t func_ea) |
| Get all function tail ranges. | |
| bool | function_contains (ea_t func_ea, ea_t ea) |
| Does the function at func_ea contain ea? | |
| bool | is_same_func (ea_t ea1, ea_t ea2) |
| Do two addresses belong to the same function? | |
| idaman bool ida_export | is_same_fchunk (ea_t ea1, ea_t ea2) |
| Do two addresses belong to the same function chunk? | |
| DEPRECATED bool | func_contains (func_t *pfn, ea_t ea) |
| Does the given function contain the given address? | |
| idaman void ida_export | iterate_func_chunks_ea (ea_t fchunk_ea, const func_chunk_visitor_t &visitor, bool include_parents=false) |
| Function to iterate function chunks (all of them including the entry chunk) | |
| idaman ea_t ida_export | get_prev_function_addr (ea_t func_ea, ea_t ea) |
| Get previous address belonging to the function, respecting linear ordering. | |
| idaman ea_t ida_export | get_next_function_addr (ea_t func_ea, ea_t ea) |
| Get next address belonging to the function, respecting linear ordering. | |
ea-based navigation | |
Get function/chunk addresses without using pointers. | |
| idaman ea_t ida_export | get_func_start (ea_t ea) |
| Get start address of the function containing 'ea'. | |
| idaman ea_t ida_export | get_prev_func_ea (ea_t ea) |
| Get start address of the previous function. | |
| idaman ea_t ida_export | get_next_func_ea (ea_t ea) |
| Get start address of the next function. | |
| idaman ea_t ida_export | get_fchunk_start (ea_t ea) |
| Get start address of the function chunk containing 'ea'. | |
| idaman ea_t ida_export | get_prev_fchunk_ea (ea_t ea) |
| Get start address of the previous function chunk. | |
| idaman ea_t ida_export | get_next_fchunk_ea (ea_t ea) |
| Get start address of the next function chunk. | |
| idaman ea_t ida_export | get_func_ea_by_num (size_t n) |
| Get function start address by ordinal number. | |
| idaman ea_t ida_export | get_fchunk_ea_by_num (int n) |
| Get function chunk start address by ordinal number. | |
ea-based property accessors | |
Read/write function properties by address. | |
| idaman uint64 ida_export | get_func_flags (ea_t ea) |
| Get function chunk flags. | |
| bool | is_visible_func (ea_t ea) |
| Is the function visible (not hidden)? | |
| bool | is_finally_visible_func (ea_t ea) |
| Is the function visible (event after considering #SCF_SHHID_FUNC)? | |
| DEPRECATED bool | is_visible_func (func_t *pfn) |
| Is the function visible (not hidden)? | |
| DEPRECATED bool | is_finally_visible_func (func_t *pfn) |
| Is the function visible (event after considering #SCF_SHHID_FUNC)? | |
| idaman bool ida_export | set_func_flags (ea_t ea, uint64 flags) |
| Set function chunk flags. | |
| idaman bool ida_export | set_func_flag (ea_t ea, uint64 flag, bool on_off=true) |
| Set or clear a single function chunk flag. | |
| idaman bool ida_export | is_function_entry (ea_t ea) |
| Is there a function entry chunk at 'ea'? | |
| idaman bool ida_export | is_function_tail (ea_t ea) |
| Is there a function tail chunk at 'ea'? | |
| idaman ea_t ida_export | get_tail_owner (ea_t tail_ea) |
| Get the owner function of a tail chunk. | |
ea-based wrappers | |
ea_t versions of functions that previously required func_t pointers. | |
| idaman ssize_t ida_export | get_func_cmt_ea (qstring *buf, ea_t ea, bool repeatable) |
| Get function comment by address. | |
| idaman bool ida_export | set_func_cmt_ea (ea_t ea, const char *cmt, bool repeatable) |
| Set function comment by address. | |
| idaman int ida_export | get_func_bitness_ea (ea_t ea) |
| Get function bitness by address. | |
| int idaapi | get_func_bits_ea (ea_t ea) |
| Get number of bits in the function addressing. | |
| int idaapi | get_func_bytes_ea (ea_t ea) |
| Get number of bytes in the function addressing. | |
| DEPRECATED int idaapi | get_func_bits (const func_t *pfn) |
| Get number of bits in the function addressing. | |
| DEPRECATED int idaapi | get_func_bytes (const func_t *pfn) |
| Get number of bytes in the function addressing. | |
| idaman asize_t ida_export | calc_func_size_ea (ea_t ea) |
| Calculate function size by address. | |
| idaman ea_t ida_export | get_func_ranges_ea (rangeset_t *ranges, ea_t ea) |
| Get function ranges by address. | |
| idaman void ida_export | set_visible_func_ea (ea_t ea, bool visible) |
| Set function visibility by address. | |
| idaman bool ida_export | set_function_name_if_jumpfunc (ea_t func_ea, const char *oldname) |
| Give a meaningful name to function if it consists of only 'jump' instruction. | |
| idaman void ida_export | reanalyze_function_ea (ea_t func_ea, ea_t ea1=0, ea_t ea2=BADADDR, bool analyze_parents=false) |
| Reanalyze function by address. | |
| idaman void ida_export | add_func_regarg (ea_t func_ea, int reg, const tinfo_t &tif, const char *name) |
| Add a temporary register argument definition. | |
| idaman size_t ida_export | get_func_regarg_qty (ea_t func_ea) |
| Get the number of register arguments for a function. | |
| idaman bool ida_export | get_func_regarg (regarg_t *out, ea_t func_ea, size_t n) |
| Get a register argument by index. | |
| idaman bool ida_export | get_func_regargs (regargs_t *out, ea_t func_ea) |
| Get all register arguments for a function. | |
ea-based locking | |
Lock function ranges by address to prevent invalidation. | |
| idaman void ida_export | lock_func_range_ea (ea_t ea, bool lock) |
| Lock function range by address. | |
| idaman bool ida_export | is_func_locked_ea (ea_t ea) |
| Is the function at ea locked? | |
Get prev/next address in function | |
Unlike func_item_iterator_t which always enumerates the main function chunk first, these functions respect linear address ordering. | |
| idaman DEPRECATED ea_t ida_export | get_prev_func_addr (func_t *pfn, ea_t ea) |
| idaman DEPRECATED ea_t ida_export | get_next_func_addr (func_t *pfn, ea_t ea) |
These functions use ea_t instead of func_t pointers, avoiding pointer-lifetime issues.
The pointer can be invalidated by del_func(), add_func(), set_func_start/end(), undo operations, and recursive IDB event callbacks.
| typedef std::function<void(ea_t chunk_start, ea_t chunk_end)> func_chunk_visitor_t |
Callback type for iterate_func_chunks_ea().
| chunk_start | start address of the chunk |
| chunk_end | end address of the chunk (exclusive) |
Get start address of the function containing 'ea'.
If ea is in a tail chunk, returns the owning function's start address.
| ea | any address in a function |
Get start address of the previous function.
| ea | any address in the program |
Get start address of the next function.
| ea | any address in the program |
Get start address of the function chunk containing 'ea'.
Unlike get_func_start(), does not follow tail owners.
| ea | any address in a function chunk |
Get start address of the previous function chunk.
| ea | any address in the program |
Get start address of the next function chunk.
| ea | any address in the program |
| idaman ea_t ida_export get_func_ea_by_num | ( | size_t | n | ) |
Get function start address by ordinal number.
| n | number of function, is in range 0..get_func_qty()-1 |
Get function chunk start address by ordinal number.
| n | number of function chunk, is in range 0..get_fchunk_qty()-1 |
Get function chunk flags.
| ea | any address in a function chunk |
Is the function visible (event after considering #SCF_SHHID_FUNC)?
Is the function visible (not hidden)?
Is the function visible (event after considering #SCF_SHHID_FUNC)?
Set function chunk flags.
| ea | start address of the function chunk |
| flags | new flags value |
Set or clear a single function chunk flag.
| ea | start address of the function chunk |
| flag | flag bit(s) to modify (e.g. #FUNC_NORET) |
| on_off | true to set, false to clear |
Get the owner function of a tail chunk.
| tail_ea | any address inside the tail chunk |
Get function comment by address.
| buf | buffer for the comment |
| ea | any address in a function chunk |
| repeatable | get repeatable comment? |
Set function comment by address.
| ea | any address in a function chunk |
| cmt | comment string, may be multiline (with '\n'). Use empty str ("") to delete comment |
| repeatable | set repeatable comment? |
Get function bitness by address.
| ea | any address in a function |
| 0 | 16bit or if no function at ea |
| 1 | 32bit |
| 2 | 64bit |
Get number of bits in the function addressing.
Get number of bytes in the function addressing.
Calculate function size by address.
This function takes into account all fragments of the function.
| ea | any address in a function |
Get function ranges by address.
| ranges | buffer to receive the range info |
| ea | any address in a function |
Set function visibility by address.
| ea | any address in a function |
| visible | new visibility state |
Give a meaningful name to function if it consists of only 'jump' instruction.
| func_ea | start address of the function (may be BADADDR) |
| oldname | old name of function. if old name was in "j_..." form, then we may discard it and set a new name. if oldname is not known, you may pass nullptr. |
| idaman void ida_export reanalyze_function_ea | ( | ea_t | func_ea, |
| ea_t | ea1 = 0, | ||
| ea_t | ea2 = BADADDR, | ||
| bool | analyze_parents = false ) |
Reanalyze function by address.
This function plans to analyze all chunks of the given function. Optional parameters (ea1, ea2) may be used to narrow the analyzed range.
| func_ea | start address of the function |
| ea1 | start of the range to analyze |
| ea2 | end of range to analyze |
| analyze_parents | meaningful only if func_ea points to a function tail. if true, all tail parents will be reanalyzed. if false, only the given tail will be reanalyzed. |
| idaman void ida_export add_func_regarg | ( | ea_t | func_ea, |
| int | reg, | ||
| const tinfo_t & | tif, | ||
| const char * | name ) |
Add a temporary register argument definition.
| func_ea | start address of the function |
| reg | register number |
| tif | type of the register argument |
| name | name of the register argument |
| idaman size_t ida_export get_func_regarg_qty | ( | ea_t | func_ea | ) |
Get the number of register arguments for a function.
Register arguments are transient: they are destroyed when the full function type is determined. This function ensures they are loaded before returning.
| func_ea | function start address |
Get a register argument by index.
Register arguments are transient: they are destroyed when the full function type is determined. This function ensures they are loaded before returning.
| out | output regarg_t (caller owns memory, use free_regarg to clean up) |
| func_ea | function start address |
| n | 0-based index |
Get all register arguments for a function.
Register arguments are transient: they are destroyed when the full function type is determined. This function ensures they are loaded before returning.
| out | output vector of regarg_t |
| func_ea | function start address |
Append a new tail chunk to the function at func_ea.
If the tail already exists, then it will simply be added to the function tail list. Otherwise a new tail will be created and its owner will be set to the function. If a new tail cannot be created, then this function will fail.
| func_ea | start address of the function |
| ea1 | start of the tail |
| ea2 | end of the tail |
Remove a function tail.
If the tail belongs only to one function, it will be completely removed. Otherwise if the function was the tail owner, the first function using this tail becomes the owner of the tail.
| func_ea | start address of the function |
| tail_ea | any address inside the tail to remove |
Set a new owner of a function tail.
The new owner function must be already referring to the tail (after append_func_tail).
| tail_ea | any address inside the tail |
| new_owner | the entry point of the new owner function |
Get the containing chunk number.
| func_ea | start address of the function |
| ea | address to check |
| -1 | does not contain ea |
| 0 | the entry chunk contains ea |
| >0 | the number of the containing function tail chunk |
| idaman size_t ida_export get_func_tail_qty | ( | ea_t | func_ea | ) |
Get the number of function tail chunks.
| func_ea | function start address |
| idaman bool ida_export get_func_tails | ( | rangevec_t * | out, |
| ea_t | func_ea ) |
Get all function tail ranges.
| out | output vector of ranges |
| func_ea | function start address |
Do two addresses belong to the same function chunk?
| ea1 | first address |
| ea2 | second address |
Does the given function contain the given address?
| idaman void ida_export iterate_func_chunks_ea | ( | ea_t | fchunk_ea, |
| const func_chunk_visitor_t & | visitor, | ||
| bool | include_parents = false ) |
Function to iterate function chunks (all of them including the entry chunk)
| fchunk_ea | address inside of the function chunk |
| visitor | callback to invoke for each chunk |
| include_parents | meaningful only if FCHUNK_EA points to a function tail. if true, all tail parents will be iterated. if false, only the given tail will be iterated. |
Get previous address belonging to the function, respecting linear ordering.
Unlike function_item_iterator_t which always enumerates the main function chunk first, this function respects linear address ordering.
| func_ea | any address of the function |
| ea | current address |
Get next address belonging to the function, respecting linear ordering.
Unlike function_item_iterator_t which always enumerates the main function chunk first, this function respects linear address ordering.
| func_ea | any address of the function |
| ea | current address |
Lock function range by address.
Locked ranges are guaranteed to remain valid until they are unlocked. Ranges with locked pointers cannot be deleted or moved.
| ea | any address in a function chunk |
| lock | true to lock, false to unlock |
Is the function at ea locked?
| ea | any address in a function chunk |
| DECLARE_FUNC_ITERATORS | ( | idaman | ) |
Helper function to accept any address.
| idaman DEPRECATED void ida_export iterate_func_chunks | ( | func_t * | pfn, |
| void(idaapi *func)(ea_t ea1, ea_t ea2, void *ud) | , | ||
| void * | ud = nullptr, | ||
| bool | include_parents = false ) |
Function to iterate function chunks (all of them including the entry chunk)
| pfn | pointer to the function |
| func | function to call for each chunk |
| ud | user data for 'func' |
| include_parents | meaningful only if pfn points to a function tail. if true, all tail parents will be iterated. if false, only the given tail will be iterated. |
| idaman bool ida_export get_fchunk_info | ( | fchunk_info_t * | out, |
| ea_t | ea ) |
Get the range of the function chunk (entry or tail) containing 'ea'.
| out | pointer to output buffer, may be nullptr |
| ea | any address in a function chunk |
| idaman bool ida_export get_prev_fchunk_info | ( | fchunk_info_t * | out, |
| ea_t | ea ) |
Get the previous function chunk before the one containing 'ea'.
| out | pointer to output buffer, may be nullptr |
| ea | any address in the program |
| idaman bool ida_export get_next_fchunk_info | ( | fchunk_info_t * | out, |
| ea_t | ea ) |
Get the next function chunk after the one containing 'ea'.
| out | pointer to output buffer, may be nullptr |
| ea | any address in the program |
| idaman bool ida_export get_func_entry_info | ( | func_entry_info_t * | out, |
| ea_t | ea, | ||
| int | flags = 0 ) |
Get function entry info by address.
| out | pointer to output buffer, may be nullptr |
| ea | any address in a function |
| flags | combination of Flags for get_func_entry_info() flags to control which optional string fields to populate |
| idaman bool ida_export get_func_entry_info_by_num | ( | func_entry_info_t * | out, |
| size_t | n, | ||
| int | flags = 0 ) |
Get function entry info by ordinal number.
| out | pointer to output buffer, may be nullptr |
| n | number of function, is in range 0..get_func_qty()-1 |
| flags | combination of Flags for get_func_entry_info() flags |
| idaman bool ida_export set_func_entry_info | ( | const func_entry_info_t * | fi | ) |
Update function entry info in the database.
You cannot use this function to change the range boundaries. Uses start_ea to identify the function, applies only modified fields.
| fi | entry info to update |
| idaman bool ida_export add_function_ex | ( | func_entry_info_t * | fi | ) |
Add a new function using func_entry_info_t.
If fi->end_ea is #BADADDR, then IDA will try to determine the function bounds by calling find_func_bounds(..., #FIND_FUNC_DEFINE). Uses fi->start_ea, fi->end_ea, and fi->get_flags(). On success, fi is updated with the resulting function properties.
| fi | entry info describing the function to create |
Add a new function.
If the function end address is #BADADDR, then IDA will try to determine the function bounds by calling find_func_bounds(..., #FIND_FUNC_DEFINE).
| ea1 | start address |
| ea2 | end address |
| idaman int ida_export find_function_bounds | ( | func_entry_info_t * | fi, |
| int | flags ) |
Determine the boundaries of a new function.
This function tries to find the start and end addresses of a new function. It calls the module with processor_t::func_bounds in order to fine tune the function boundaries.
| fi | entry info to fill with information. \ fi->start_ea points to the start address of the new function. |
| flags | Find function bounds flags |
fi is updated with the resulting function properties. | idaman ea_t ida_export calc_thunk_function_target | ( | func_entry_info_t * | fi, |
| ea_t * | fptr ) |
Calculate thunk function target.
| fi | function entry info |
| fptr | out: will hold address of a function pointer (if indirect jump) |
| idaman bool ida_export get_func_tail_info | ( | func_tail_info_t * | out, |
| ea_t | ea ) |
Get function tail info by address.
| out | pointer to output buffer, may be nullptr |
| ea | any address in a function tail chunk |
| idaman size_t ida_export get_tail_referer_qty | ( | ea_t | tail_ea | ) |
Get the number of referers (parent functions) for a tail chunk.
| tail_ea | any address in a function tail chunk |
Get a tail chunk referer by index.
| tail_ea | any address in a function tail chunk |
| n | 0-based index |