Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Eclipse disassemble the code in Intel syntax

I use Eclise CDT as a development environment. I use disassembly view to see assembly equivalents. But I am used to read an write assembly code in Intel syntax. Is there any option to make the Eclipse dump the assembly code in Intel syntax?

like image 201
mustafagonul Avatar asked Mar 05 '16 10:03

mustafagonul


1 Answers

Create a file with set disassembly-flavor intel in it, you can use ~/.gdbinit as the file if you want.

Then point your launch configuration at the file you created.

Without the launch configuration change your disassembly may look like:

15                  puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
000000000040053a:   mov     $0x4005d4,%edi
000000000040053f:   callq   0x400410 <puts@plt>

With the gdb init file you get the Intel syntax:

15                  puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
000000000040053a:   mov     edi,0x4005d4
000000000040053f:   call    0x400410 <puts@plt>

Note CDT does not pick up ~/.gdbinit unless you explicitly set it in the launch configuration. Here is a screenshot of the launch configuration:

enter image description here

Globally

You can make the change global (for all new launch configurations at least) by setting the GDB command file in the preferences too:

enter image description here

Credit to Permanently Change Disassembly Flavor in GDB for the GDB part of the change.

like image 80
Jonah Graham Avatar answered Nov 15 '22 09:11

Jonah Graham