Search code examples
eclipseassemblyeclipse-cdtdisassembly

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?


Solution

  • 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.