How to get instruction information from libopcodes?

前端 未结 3 1467
后悔当初
后悔当初 2020-12-09 19:42

I am writing a tool which uses libbfd and libopcodes in x86-32 and x86-64 Linux to perform disassembly. The problem is that whilst I am able to get

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 20:03

    Unfortunately, as of binutils libopcodes 2.22, insn_type is not filled in on either i386 or x86_64. The only widespread supported architectures are MIPS, Sparc, and the Cell’s SPU. This is still true as of current CVS HEAD.

    It's hard to prove that something does not exist, but for instance, in the Sparc disassembler source you can see several occurrences of insn_type being set, for instance info->insn_type = dis_branch, whereas in the i386 disassembler source there are no occurrences of insn_type nor any of the values it would be expected to have (dis_branch, dis_nonbranch etc.).

    Checking for all the libopcodes files that support insn_type you get:

    • opcodes/mips-dis.c
    • opcodes/spu-dis.c
    • opcodes/microblaze-dis.c
    • opcodes/cris-dis.c
    • opcodes/sparc-dis.c
    • opcodes/mmix-dis.c

提交回复
热议问题