-
While trying to map a IT EQ instruction to the corresponding LLIL instruction, I found out that BNGetLowLevelILForInstruction() is not able to find the corresponding LLIL index for these instructions. I also attached the corresponding binary: |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
This isn't actually a bug, as there is no LLIL instruction that would make sense to have that address. The effect of There is no strict correspondence between assembly and IL instructions. One native instruction can have 0 or many IL instructions. |
Beta Was this translation helpful? Give feedback.
-
Well, it seems that the corresponding LLIL_IF instruction has as address 0x20b5a (the MOV). I would expect that the IF maps to the IT EQ, not the MOV... |
Beta Was this translation helpful? Give feedback.
-
The lifter holds onto some state internally for |
Beta Was this translation helpful? Give feedback.
-
I agree that there is no guarantee that a native instruction always maps to a LLIL instruction and I know that IT EQ is bit of an odd instruction. But for example in ARM mode an ADD followed by a CMP is also merged into a single LLIL_IF. Asking the corresponding LLIL instruction index results in both cases in the index for the same IF. Therefore, I was expecting the same behavior here, instead of failing to map it at all. |
Beta Was this translation helpful? Give feedback.
-
I see why it would be surprising, but there were a few reasons that doing it this way wound up making things cleaner in more situations. By deferring insertion of the IF/GOTOs as far as possible we wind up being able to cut out edges in a few extra cases (it comes into play more often when both a condition and its inverse are used in a single block, or when condition flag modifying instructions are themselves used in the block). Since the outgoing 'edge' doesn't really belong to either the first instruction in the block or the It would be possible to 'rewind' the address when adding the IF/GOTO statements, but since it was more work and wasn't necessarily more 'right' decided not to. |
Beta Was this translation helpful? Give feedback.
-
To expand slightly on the above: with the way it works right now, we wind up treating instructions in We basically don't use |
Beta Was this translation helpful? Give feedback.
I see why it would be surprising, but there were a few reasons that doing it this way wound up making things cleaner in more situations. By deferring insertion of the IF/GOTOs as far as possible we wind up being able to cut out edges in a few extra cases (it comes into play more often when both a condition and its inverse are used in a single block, or when condition flag modifying instructions are themselves used in the block).
Since the outgoing 'edge' doesn't really belong to either the first instruction in the block or the
it
instruction itself, I wound up just always putting it in the higher address, and that way the behavior is consistent even when something in theit
block modifies…