New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CBZ & CBNZ decoded as unconditional jumps #578
Comments
what is the input (hexcode format) exposing this issue? |
For CBNZ consider for example |
for the record, can you please list all similar instructions having this issue? |
So far, these are the only ones. Condition code for all other branch instructions seems to be set properly in my tests. Additionally, |
I just meet with the same issue. I'd like to know that whether you will fix it recently? @aquynh |
I raised this issue only because building a CFG requires linking basic blocks that end with conditional jumps with their direct successors. That test can simply be done by checking the condition code of the jump instruction to be not equal to However, it's worth mentioning that CBZ/CBNZ themselves can not be conditional. That is, there execution doesn't depend on a condition code being set. Under this interpretation, Capstone's behavior is correct. If we adopt the latter interpretation, then we should close this issue and the related issue #368. |
This issue does depend on the interpretation for the cc field. Though the CBZ/CBNZ themselves are not conditional, the jump is conditional. Maybe I misunderstood the meaning of cc field in capstone before. As I could not find precise document for each field in capstone, I just guessed the meaning. Hoping there will be a more detailed document for capstone. |
The condition flag of Thumb instructions
CBZ
&CBNZ
instructions is alwaysARM_CC_AL
. Basically, it should beARM_CC_EQ
andARM_CC_NE
respectively.I noticed that both instructions lack setting
MCID_Predicable
in fileARMGenInstrInfo.inc
as can be found here. Adding that didn't fix the issue.Function
AddThumbPredicate
assume that their predicate should be properly set. Therefore, it doesn't modify it. What is the best way for fixing this issue?The text was updated successfully, but these errors were encountered: