Search code examples
linuxassemblyx86gdbintel-syntax

Permanently Change Disassembly Flavor in GDB


How can I permanently change the disassembly flavor in GDB. I tried:set disassembly-flavor intel in GDB, but when I fire up GDB later it still has the att flavor.


Solution

  • gdb executes a ~/.gdbinit file when it starts, if present. You can add this line to it:

    set disassembly-flavor intel
    

    From the shell, this command will append that line, creating the file if it doesn't exist:

    echo "set disassembly-flavor intel" >> ~/.gdbinit
    

    The GDB manual's page on machine code and disassembly documents the command, and that the default is set disassembly-flavor att.


    For more tips on asm debugging in GDB, like layout reg+layout next, or layout asm TUI mode, see the debugging section at the bottom of the x86 tag wiki.

    The chosen disassembly-flavor is used for the disassembly pane in asm and asm+reg layouts, as well as for disas and x /i commands.