| IDA SDK

Public Attributes | Public Member Functions | List of all members
macro_constructor_t Struct Referenceabstract

## Detailed Description

Helper class for processor modules to build macro instructions.

## Public Attributes
size_t | reserved = 0

## Public Member Functions
bool | construct_macro (insn_t *insn, bool enable)
| Construct a macro instruction. More...
virtual bool idaapi | build_macro (insn_t *insn, bool may_go_forward)=0
| Try to extend the instruction. More...

## Member Function Documentation

## ◆ construct_macro()

bool macro_constructor_t::construct_macro | ( | insn_t * | insn,
|  | bool | enable
| ) |  |
| inline

Construct a macro instruction.

This function may be called from ana() to generate a macro instruction.

The real work is done by the 'build_macro()' virtual function. It must be defined by the processor module.

construct_macro() modifies the database using the info provided by build_macro(). It verifies if the instruction can really be created (for example, that other items do not hinder), may plan to reanalyze the macro, etc. If the macro instructions are disabled by the user, construct_macro() will destroy the macro instruction. Note: if INSN_MODMAC is not set in insn.flags, the database will not be modified.

Parameters

  insn | the instruction to modify into a macro
  enable | enable macro generation

Return values

  true | the macro instruction is generated in 'insn'
  false | did not create a macro

## ◆ build_macro()

virtual bool idaapi macro_constructor_t::build_macro | ( | insn_t * | insn,
|  | bool | may_go_forward
| ) |  |
| pure virtual

Try to extend the instruction.

This function may modify 'insn' and return false; these changes will be accepted by the kernel but the instruction will not be considered as a macro.

Parameters

  insn | Instruction to modify, usually the first instruction of the macro
  may_go_forward | Is it ok to consider the next instruction for the macro? This argument may be false, for example, if there is a cross reference to the end of INSN. In this case creating a macro is not desired. However, it may still be useful to perform minor tweaks to the instruction using the information about the surrounding instructions.

Returns
  true if created an macro instruction.

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

- ua.hpp