The previous few talk about GDB Debug program's post, all to disassembly vague. Here's a detailed discussion of the Disassemble/disass command.
Disassembly a function
Disass Func_name
Disassemble a memory address, the 1th parameter is the start address, and the 2nd is the terminating address
Disassemble 0x0 0x10
First look at document debugging with GDB
Http://sourceware.org/gdb/download/onlinedocs/gdb.html
Source and Machine code
You can use the info command to map a source line to a program address, and then use the command disassemble to display a machine instruction for an address range.
For example, I want to see where the main function starts.
(GDB) Info Line Main
Line ' RANK.C ' starts at address 0x804847f
and ends at 0x8048493.
(GDB) Info line *0x804847f
Line ' RANK.C ' starts at address 0x804847f
and ends at 0x8048493.
Also, Info line modifies the default start address of the x/i command
Disassemble with no parameters, the default disassembly range is the function near the PC of the selected frame
A single parameter is a PC, and of course it can be a function name, because the function name is also an address; So the range is the function near the PC.
Two parameters, which is the memory address range
Set Disassembly-flavor Intel formats the assembly instruction in Intel format, the default is ATT
(GDB) Show Disassembly-flavor
The disassembly flavor is "att".
Next breakpoint:
b *0x00007fffab642
Another way to view disassembly instructions is to use X
X/3i $pc
X/100U $pc
3 Instructions for displaying PC start
Single Step Execution:
Si
Single-Line execution:
Ni
[Go] GDB disassemble