diff --git a/src/drivers/idapro/SMPStaticAnalyzer.cpp b/src/drivers/idapro/SMPStaticAnalyzer.cpp index ee4fb309a46c49847cec0b03341e23e02b663c68..756a65140e1c11045255983b5c4dbd6c857af60e 100644 --- a/src/drivers/idapro/SMPStaticAnalyzer.cpp +++ b/src/drivers/idapro/SMPStaticAnalyzer.cpp @@ -1422,22 +1422,16 @@ void FindOrphanedCode(STARS_Segment_t *CurrSeg, FILE *AnnotFile, FILE *InfoAnnot // If instruction is an indirect branch, emit an XREF // annotation for each of its targets. SMPitype CurrDataFlow = CurrInst.GetDataFlowType(); - if ((CurrDataFlow == INDIR_JUMP) || (CurrDataFlow == INDIR_CALL)) { - SMP_xref_t xrefs; - for (bool ok = xrefs.SMP_first_from(addr, XREF_ALL); ok; ok = xrefs.SMP_next_from()) { - if (xrefs.GetTo() != 0) { - if (xrefs.GetIscode() && (xrefs.GetType() != fl_F)) { - // Found a code target, with its address in xrefs.to - global_STARS_program->PrintCodeToCodeXref(addr, xrefs.GetTo(), CurrInst.GetSize()); - } - } - } + bool IndirCallFlag = (CurrDataFlow == INDIR_CALL); + if ((CurrDataFlow == INDIR_JUMP) || IndirCallFlag) { + global_STARS_program->PrintAllCodeToCodeXrefs(addr, CurrInst.GetSize(), IndirCallFlag); } // If the address of this instruction appeared in data, emit an IBT annotation. if (global_STARS_program->IsCodeAddressTaken(addr)) { global_STARS_program->PrintUnknownCodeXref(addr, CurrInst.GetSize()); } - } + } // end if inst is Analyzeable + // Emit IBT annotations for instructions that fit computed-goto patterns in libc/glibc, such // as prefetch instructions and the instructions that follow them (computed goto often chooses // between going to the prefetch or jumping just past it, and IDA Pro cannot analyze these libc