Command assemble

If you have installed keystone, then gef will provide a convenient command to assemble native instructions directly to opcodes of the architecture you are currently debugging.

Call it via assemble or its alias asm:

gef➤ asm [INSTRUCTION [; INSTRUCTION ...]]

gef-assemble

Using the -l LOCATION option, gef will write the assembly code generated by keystone directly to the memory location specified. This makes it extremely convenient to simply overwrite opcodes.

gef-assemble-overwrite