IDA C++ SDK 9.2
|
Contains definition of the interface to IDP modules. More...
Go to the source code of this file.
Classes | |
struct | bytes_t |
Structure used to describe byte streams (for "ret" instruction and empirics) More... | |
struct | instruc_t |
Internal representation of processor instructions. More... | |
struct | asm_t |
Describes the target assembler. More... | |
struct | event_listener_t |
struct | processor_t |
Describes a processor module (IDP). More... | |
struct | ignore_micro_t |
struct | modctx_t |
struct | procmod_t |
struct | plugmod_t |
struct | reg_info_t |
Get register number and size from register name. More... | |
struct | reg_access_t |
Information about a register accessed by an instruction. More... | |
struct | reg_accesses_t |
Namespaces | |
namespace | idb_event |
IDB event group. |
Typedefs | |
typedef qvector< reg_info_t > | reginfovec_t |
vector of register info objects | |
typedef qvector< reg_access_t > | reg_access_vec_t |
Functions | |
THREAD_SAFE bool | has_cf_chg (uint32 feature, uint opnum) |
Does an instruction with the specified feature modify the i-th operand? | |
THREAD_SAFE bool | has_cf_use (uint32 feature, uint opnum) |
Does an instruction with the specified feature use a value of the i-th operand? | |
idaman bool ida_export | has_insn_feature (uint16 icode, uint32 bit) |
Does the specified instruction have the specified feature? | |
idaman bool ida_export | is_call_insn (const insn_t &insn) |
Is the instruction a "call"? | |
idaman bool ida_export | is_ret_insn (const insn_t &insn, uchar flags=IRI_STRICT) |
idaman bool ida_export | is_indirect_jump_insn (const insn_t &insn) |
Is the instruction an indirect jump? | |
idaman bool ida_export | is_basic_block_end (const insn_t &insn, bool call_insn_stops_block) |
Is the instruction the end of a basic block? | |
CASSERT (sizeof(asm_t)==416) | |
idaman bool ida_export | hook_event_listener (hook_type_t hook_type, event_listener_t *cb, const void *owner, int hkcb_flags=0) |
Install an event listener. | |
idaman bool ida_export | unhook_event_listener (hook_type_t hook_type, event_listener_t *cb) |
Uninstall an event listener. | |
idaman void ida_export | remove_event_listener (event_listener_t *cb) |
remove all hooks in all databases for specified event_listener object | |
CASSERT (sizeof(processor_t)==144) | |
idaman processor_t *ida_export | get_ph () |
idaman asm_t *ida_export | get_ash () |
idaman ea_helper_t *ida_export | get_eah () |
idaman hexdsp_t *ida_export | get_hexdsp () |
idaman int ida_export | str2reg (const char *p) |
Get any register number (-1 on error) | |
idaman int ida_export | is_align_insn (ea_t ea) |
If the instruction at 'ea' looks like an alignment instruction, return its length in bytes. | |
idaman ssize_t ida_export | get_reg_name (qstring *buf, int reg, size_t width, int reghi=-1) |
Get text representation of a register. | |
DECLARE_TYPE_AS_MOVABLE (reg_info_t) | |
idaman bool ida_export | parse_reg_name (reg_info_t *ri, const char *regname) |
Get register info by name. | |
enum access_type_t | ENUM_SIZE (uchar) |
Possible memory and register access types. | |
DECLARE_TYPE_AS_MOVABLE (reg_access_t) | |
idaman bool ida_export | set_processor_type (const char *procname, setproc_level_t level) |
Set target processor type. | |
idaman char *ida_export | get_idp_name (char *buf, size_t bufsize) |
Get name of the current processor module. | |
idaman bool ida_export | set_target_assembler (int asmnum) |
Set target assembler. | |
void | gen_idb_event (idb_event::event_code_t code,...) |
the kernel will use this function to generate idb_events | |
idaman void *ida_export | set_module_data (int *data_id, void *data_ptr) |
Starting from IDA v7.5 all modules should use the following 3 functions to handle idb specific static data because now the kernel supports opening and working with multiple idbs files simultaneously. | |
idaman void *ida_export | clr_module_data (int data_id) |
Unregister pointer to database specific module data. | |
idaman void *ida_export | get_module_data (int data_id) |
Get pointer to the database specific module data. |
Contains definition of the interface to IDP modules.
The interface consists of two structures:
These structures contain information about target processor and assembler features.
It also defines two groups of kernel events:
The processor related events are used to communicate with the processor module. The database related events are used to inform any interested parties, like plugins or processor modules, about the changes in the database.
typedef qvector<reg_info_t> reginfovec_t |
vector of register info objects
typedef qvector<reg_access_t> reg_access_vec_t |
enum setproc_level_t |
Flags passed as 'level' parameter to set_processor_type()
enum local_type_change_t |
Enumerator | |
---|---|
LTC_NONE | no event (internal use) |
LTC_ADDED | added a local type |
LTC_DELETED | deleted a local type |
LTC_EDITED | edited a local type |
LTC_ALIASED | added a type alias |
LTC_COMPILER | changed the compiler and calling convention |
LTC_TIL_LOADED | loaded a til file |
LTC_TIL_UNLOADED | unloaded a til file |
LTC_TIL_COMPACTED | numbered types have been compacted compact_numbered_types() |
Does an instruction with the specified feature modify the i-th operand?
Does an instruction with the specified feature use a value of the i-th operand?
Does the specified instruction have the specified feature?
idaman bool ida_export is_call_insn | ( | const insn_t & | insn | ) |
Is the instruction a "call"?
idaman bool ida_export is_indirect_jump_insn | ( | const insn_t & | insn | ) |
Is the instruction an indirect jump?
Is the instruction the end of a basic block?
CASSERT | ( | sizeof(asm_t) | = =416 | ) |
idaman bool ida_export hook_event_listener | ( | hook_type_t | hook_type, |
event_listener_t * | cb, | ||
const void * | owner, | ||
int | hkcb_flags = 0 ) |
Install an event listener.
The installed listener will be called for all kernel events of the specified type (hook_type_t).
hook_type | one of hook_type_t constants |
cb | The event listener object |
owner | The listener owner. Points to an instance of: plugin_t, processor_t, or loader_t. Can be nullptr, which means undefined owner. The owner is used by the kernel for automatic removal of the event listener when the owner is unloaded from the memory. |
hkcb_flags | combination of Hook installation bits. bits |
idaman bool ida_export unhook_event_listener | ( | hook_type_t | hook_type, |
event_listener_t * | cb ) |
Uninstall an event listener.
hook_type | one of hook_type_t constants |
cb | the listener object |
idaman void ida_export remove_event_listener | ( | event_listener_t * | cb | ) |
remove all hooks in all databases for specified event_listener object
CASSERT | ( | sizeof(processor_t) | = =144 | ) |
idaman processor_t *ida_export get_ph | ( | ) |
idaman asm_t *ida_export get_ash | ( | ) |
idaman ea_helper_t *ida_export get_eah | ( | ) |
idaman hexdsp_t *ida_export get_hexdsp | ( | ) |
idaman int ida_export str2reg | ( | const char * | p | ) |
Get any register number (-1 on error)
idaman int ida_export is_align_insn | ( | ea_t | ea | ) |
If the instruction at 'ea' looks like an alignment instruction, return its length in bytes.
Otherwise return 0.
Get text representation of a register.
For most processors this function will just return processor_t::reg_names[reg]. If the processor module has implemented processor_t::get_reg_name, it will be used instead
buf | output buffer |
reg | internal register number as defined in the processor module |
width | register width in bytes |
reghi | if specified, then this function will return the register pair |
DECLARE_TYPE_AS_MOVABLE | ( | reg_info_t | ) |
idaman bool ida_export parse_reg_name | ( | reg_info_t * | ri, |
const char * | regname ) |
Get register info by name.
[out] | ri | result |
regname | name of register |
enum access_type_t ENUM_SIZE | ( | uchar | ) |
Possible memory and register access types.
DECLARE_TYPE_AS_MOVABLE | ( | reg_access_t | ) |
idaman bool ida_export set_processor_type | ( | const char * | procname, |
setproc_level_t | level ) |
Set target processor type.
Once a processor module is loaded, it cannot be replaced until we close the idb.
procname | name of processor type (one of names present in processor_t::psnames) |
level | SETPROC_ |
idaman char *ida_export get_idp_name | ( | char * | buf, |
size_t | bufsize ) |
Get name of the current processor module.
The name is derived from the file name. For example, for IBM PC the module is named "pc.w32" (windows version), then the module name is "PC" (uppercase). If no processor module is loaded, this function will return nullptr
buf | the output buffer, should be at least #QMAXFILE length |
bufsize | size of output buffer |
idaman bool ida_export set_target_assembler | ( | int | asmnum | ) |
Set target assembler.
asmnum | number of assembler in the current processor module |
|
inline |
the kernel will use this function to generate idb_events
Starting from IDA v7.5 all modules should use the following 3 functions to handle idb specific static data because now the kernel supports opening and working with multiple idbs files simultaneously.
See the source code of the processor modules in the SDK for the usage examples. Register pointer to database specific module data.
data_id | initially the pointed-to value must be 0, the kernel will fill it with a unique id. once assigned, the data_id does not change. |
data_ptr | pointer to the data to register |
idaman void *ida_export clr_module_data | ( | int | data_id | ) |
Unregister pointer to database specific module data.
data_id | an data_id that was assigned by set_module_data() |
idaman void *ida_export get_module_data | ( | int | data_id | ) |
Get pointer to the database specific module data.
data_id | data id that was initialized by set_module_data() |