Copies the groups from @imap to @MI->flat_insn. Already present groups will be preserved.
| 138 | /// Copies the groups from @imap to @MI->flat_insn. |
| 139 | /// Already present groups will be preserved. |
| 140 | void map_groups(MCInst *MI, const insn_map *imap) |
| 141 | { |
| 142 | #ifndef CAPSTONE_DIET |
| 143 | if (!MI->flat_insn->detail) |
| 144 | return; |
| 145 | |
| 146 | cs_detail *detail = MI->flat_insn->detail; |
| 147 | unsigned Opcode = MCInst_getOpcode(MI); |
| 148 | unsigned i = 0; |
| 149 | uint16_t group = imap[Opcode].groups[i]; |
| 150 | while (group != 0) { |
| 151 | if (detail->groups_count >= MAX_NUM_GROUPS) { |
| 152 | printf("ERROR: Too many groups defined in instruction mapping.\n"); |
| 153 | return; |
| 154 | } |
| 155 | detail->groups[detail->groups_count++] = group; |
| 156 | group = imap[Opcode].groups[++i]; |
| 157 | } |
| 158 | #endif // CAPSTONE_DIET |
| 159 | } |
| 160 | |
| 161 | // Search for the CS instruction id for the given @MC_Opcode in @imap. |
| 162 | // return -1 if none is found. |
no test coverage detected
searching dependent graphs…