Get size of assembly instructions
I need to read instructions one-by-one from a small code segment in memory and I have to find out the size of the instructions which I have in memory. The following is just a example of raw disassembled code to explain my problem: (gdb) disas /r 0x400281,+8 Dump of assembler code from 0x400281 to 0x400289: 0x0000000000400281: 48 89 c7 movq %rax, %rdi 0x0000000000400284: b0 00 movb $0, %al 0x0000000000400286: e8 f2 48 00 00 callq 0x10001f30a End of assembler dump. I know the memory address of the first instruction (p = 0x0000000000400281 in this case) and I can read every memory address from p.