Supported on windows
Supported on linux
Supported on embedded
Supported on android

set disassembly-flavor command

Controls the disassembly style used by the disassemble and x commands.

Syntax

set disassembly-flavor att
set disassembly-flavor intel
show disassembly-flavor

Modes

att
GDB will use the AT&T disassembly style (e.g. mov 0xc(%ebp),%eax) that is popular among Linux users.
intel
GDB will use the Intel disassembly style (e.g. mov eax, DWORD PTR [ebp+0xc]) that is popular among Windows users.

Default mode

The default value for the disassembly-flavor setting is 'att'.

Examples

In this example we will disassemble a simple function using both AT&T and Intel styles:

int func(int a, int b)
{
    return a + b;
}

We will compile it without optimization and load into GDB:

(gdb) show disassembly-flavor
The disassembly flavor is "att".
(gdb) disassemble func
Dump of assembler code for function func:
0x080483ed <+0>: push %ebp
0x080483ee <+1>: mov %esp,%ebp
0x080483f0 <+3>: mov 0xc(%ebp),%eax
0x080483f3 <+6>: mov 0x8(%ebp),%edx
0x080483f6 <+9>: add %edx,%eax
0x080483f8 <+11>: pop %ebp
0x080483f9 <+12>: ret
End of assembler dump.
(gdb) set disassembly-flavor intel
(gdb) disassemble func
Dump of assembler code for function func:
0x080483ed <+0>: push ebp
0x080483ee <+1>: mov ebp,esp
0x080483f0 <+3>: mov eax,DWORD PTR [ebp+0xc]
0x080483f3 <+6>: mov edx,DWORD PTR [ebp+0x8]
0x080483f6 <+9>: add eax,edx
0x080483f8 <+11>: pop ebp
0x080483f9 <+12>: ret
End of assembler dump.
(gdb) x/2i func
0x80483ed <func>: push ebp
0x80483ee <func+1>: mov ebp,esp

Compatibility with VisualGDB

VisualGDB automatically sets the disassembly flavor to Intel so that the disassembly output similar to the native Visual Studio disassembly. You can change this by adding the set disassembly-flavor command in the GDB Startup Commands list for your project.

See also