You can use the command
info line to map source lines to program
addresses (and vice versa), and the command
disassemble to display
a range of addresses as machine instructions. When run under GNU Emacs
info line command now causes the arrow to point to the
line specified. Also,
info line prints addresses in symbolic form as
well as hex.
info line linespec
listcommand (see section Printing source lines).
For example, we can use
info line to discover the location of
the object code for the first line of function
(gdb) info line m4_changecom Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350.
We can also inquire (using
*addr as the form for
linespec) what source line covers a particular address:
(gdb) info line *0x63ff Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404.
info line, the default address for the
is changed to the starting address of the line, so that `x/i' is
sufficient to begin examining the machine code (see section Examining memory). Also, this address is saved as the value of the
$_ (see section Convenience variables).
We can use
disassemble to inspect the object code
range shown in the last
info line example (the example
shows SPARC machine instructions):
(gdb) disas 0x63e4 0x6404 Dump of assembler code from 0x63e4 to 0x6404: 0x63e4 <builtin_init+5340>: ble 0x63f8 <builtin_init+5360> 0x63e8 <builtin_init+5344>: sethi %hi(0x4c00), %o0 0x63ec <builtin_init+5348>: ld [%i1+4], %o0 0x63f0 <builtin_init+5352>: b 0x63fc <builtin_init+5364> 0x63f4 <builtin_init+5356>: ld [%o0+4], %o0 0x63f8 <builtin_init+5360>: or %o0, 0x1a4, %o0 0x63fc <builtin_init+5364>: call 0x9288 <path_search> 0x6400 <builtin_init+5368>: nop End of assembler dump.
Go to the first, previous, next, last section, table of contents.