show directories

Print the source path and display the directories it

 

contains.

If your source path is cluttered with directories that are no longer of interest, GDB can end up detecting the wrong version of the source. To correct this situation, follow these steps:

1.Use directory with no arguments to reset the source path to empty.

2.Use directory with suitable arguments to reinstall the directories you want in the source path. You can add all the directories in one command.

7.4Source and machine code

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 mode, the info line command causes the arrow to point to the line specified. Also, info line prints addresses in symbolic form as well as hex.

info line linespec Print the starting and ending addresses of the compiled code for source line linespec. You can specify source lines in any of the ways understood by the list command (see “Printing source lines” (page 77)).

For example, we can use info line to discover the location of the object code for the first line of function.

m4_changequote:

((gdb)) info line m4_changequote

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. For example,

((gdb)) info line *0x63ff

Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404.

After info line, the default address for the x command is changed to the starting address of the line, so that 'x/i' is sufficient to begin examining the machine code (see Section 8.5 (page 87)). Also, this address is saved as the value of the convenience variable $_ (see Section 8.9 (page 96)).

disassemble This specialized command dumps a range of memory as machine instructions. The default memory range is the function surrounding the program counter of the selected frame. A single argument to this command is a program counter value; GDB dumps the function surrounding this value. Two arguments specify a range of addresses (first inclusive, second exclusive) to dump.

80 Examining Source Files

Page 80
Image 80
HP gnu source-level debugger 5992-4701 manual Source and machine code, Show directories, Contains