By default, the assembly language for your machine may use ATT syntax, to set gdb use Intel syntax assembly language, use this command when in gdb:
set disassembly intel (if not working, try this: set disassebmly-flavor intel)
You may try to configure this setting to run every time GDB start up by putting the command in the file .gdbinit in your home directory.
echo "set disassembly-flavor intel" > ~/.gdbinit
To view the value at memory address (e.g. 0x1004010dd), use x (examine) command. This command requires 2 arguments: the memory address and the display format (o: octal, x: hex, u: base-10 decimal, t: binary).
x/x 0x1004010dd
The x command may be also used to display assembly instruction at the memory address
x/i 0x1004010dd (i short for instruction)
To use objdump*:
objdump -D a.out
objdump -M intel -D a.out (display with Intel syntax, otherwise AT&T syntax by default)
Note: * for Mac OSX, objdump is not installed by default. To install it, use this command:
sudo port install binutils
And installation location: /opt/local/x86_64-apple-darwin11.3.0/bin
No comments:
Post a Comment