0

So I'm still new to disassembling and I've got a couple of problems that would help being taken care of.

I'm following along the book "Art of Exploitation". The author prefers using Intel syntax in 32bit mode when he objdumps and since I want to follow along I want to configure my syntax the same. Since my Ubuntu uses AT&T 64bit mode by default, I have to input optional arguments each time I objdump like:

$ objdump -M i386,intel -D a.out

Is there a way to change the default settings for objdump?

I also want to change the gdb syntax to intel so I looked for .gdbinit but couldn't find it. Instead I made a new one in the home directory by doing this:

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

but didn't seem to work. Can anyone tell me where the environment variables (or environment variable config files) for objdump and gdbinit are?

coffeeFlow
  • 179
  • 1
  • 6

1 Answers1

0

Here are my solutions to both of these questions:

To set the "-M intel" option every time for objdump, I created an alias. To create an alias, find your .bashrc file and edit it. The file should be located in your home directory, if you haven't moved it. The line that I chose to add is included below.

alias odi='objdump -M intel -d'

This alias also always sets the disassemble option and shortens the command. I didn't want to replace the regular objdump command, but 90% of the time when using it, I'm just using it for quick disassembly. Make sure you restart bash before testing any new aliases.

As for gdb, what you attempted should have worked. All that you need to do is make a file, named .gdbinit, in your home directory and include the following line in it:

set disassembly-flavor intel

You must have made a mistake somewhere else.