MCPcopy Create free account
hub / github.com/KasperskyLab/hrtng / convert

Function convert

src/deinline.cpp:274–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272 return res;
273 }
274 sBB* convert(eBBKind newKind, minsn_t *from, minsn_t *to, qstring* errorStr)
275 {
276 if(kind == eBBK_whole && newKind != eBBK_whole) {
277#if IDA_SDK_VERSION >= 830
278 minsn_t *copylst = nullptr;
279 if(!from)
280 from = minsnlst;
281 MSG_DI2(("[hrt] convert blk at %a to %s (%a-%a)\n", bgn, newKind == eBBK_tail ? "tail" : newKind == eBBK_head ? "head" : "single", from->ea, to ? to->ea : 0));
282
283 minsn_t *prev = nullptr;
284 for(minsn_t *mi = getf_reginsn(from); mi != getf_reginsn(to); mi = getf_reginsn(mi->next)) {
285 if((newKind == eBBK_tail || newKind == eBBK_single) && (is_mcode_jcond(mi->opcode) || mi->opcode == m_jtbl)) {
286 errorStr->sprnt("Not allowed branch in block %d at %a", idx, mi->ea);
287 //del copylst
288 minsn_t *i = copylst;
289 while(i != nullptr) {
290 minsn_t *next = i->next;
291 delete i;
292 i = next;
293 }
294 return nullptr;
295 }
296
297 minsn_t *copy = new minsn_t(*mi);
298 if(!prev) {
299 copylst = copy;
300 } else {
301 prev->next = copy;
302 copy->prev = prev;
303 }
304 prev = copy;
305 }
306 sBB* newBB = new sBB(*this);
307 newBB->kind = newKind;
308 newBB->minsnlst = copylst;
309 return newBB;
310#else
311 errorStr->sprnt("Not allowed partially block selection for IDA version less 8.3");
312 return nullptr;
313#endif //IDA_SDK_VERSION >= 830
314 }
315 errorStr->sprnt("Not suitable BBKind convert of block %d", idx);
316 return nullptr;
317 }
318 bool match_mop(mop_t &mo, mop_t &other) const
319 {
320 //ignore variable placement

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected