keystone
keystone copied to clipboard
Wrong disassembly with inline comments in assembly
When I use kstool to assemble the following instruction with a comment, I got an error:
$ kstool arm64 "MOV X29, SP ;hello"
ERROR: failed on ks_asm() with count = 0, error = 'Invalid mnemonic (KS_ERR_ASM_MNEMONICFAIL)' (code = 514)
but it worked properly without a comment:
$ kstool arm64 "MOV X29, SP"
MOV X29, SP = [ fd 03 00 91 ]
Is there an expected syntax for commenting for keystone, or keystone cannot differentiate between comments and operands of an instruction? If so, I'd like to submit a patch to support inline comments.
If you take a look at the C example on http://www.keystone-engine.org/ towards the bottom you'll see it mention You can either separate assembly instructions in this string by “;” or “\n”. so I believe this is the intended behavior. I'm not a project member but I agree a patch to enable comments with a semicolon would be pretty useful.
@zeroSteiner commented on Feb 6, 2019:
I agree a patch to enable comments with a semicolon would be pretty useful.
+1