Permanently Change Disassembly Flavor in Gdb

Permanently Change Disassembly Flavor in GDB

gdb executes a ~/.gdbinit file when it starts, if present; you should be able to add the line

set disassembly-flavor intel

to it.

How to change the disassembly syntax to intel using gdb?

Please use:

set disassembly-flavor intel

see GDB Manual for more details

How to make Eclipse disassemble the code in Intel syntax

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:

Sample Image

Globally

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

Sample Image

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



Related Topics



Leave a reply



Submit