Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Convert assembly instructions to bytes in gdb

Is there any way I can convert an assembly instruction such as

cmp %rdx,%rbp

to bytes, but from text, not memory (so not by going to an address, printing it as an instruction and then printing it as bytes). Alternatively using some other tool than gdb.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There is a tool called compiler explorer:
https://godbolt.org/

Using it you can choose the input and output of your code.
For example, for this case, you can insert the input as "Assembly" and in the output choose the flag of "compile to binary" to see for any instruction what is the relevant bytes for it.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading