To specify one or more additional
|BackTrack 2 Linux|
To specify one or more additional directories containing source code, start GDB using one or more -d dirname options, as this example illustrates:
$ gdb -d /source/project1 -d /oldsource/project1 -d /home/ bubba/src killerapp
To locate the next occurrence of a particular string in the current file, use the
search string command. Use reverse-search string to find the previous occurrence of
string. If you want to find the previous occurrence of the word "return" in debugme.c
(refer to Listing 29-5), for example, use the command reverse-search return. GDB obliges and displays the text:
(gdb) reverse-search return
17 return ret;
The search and reverse-search commands are especially helpful in large source files that have dozens or hundreds of lines. One common use of the reverse-search command is to find the file and/or line in which a variable is first used or in which it is defined. The search command similarly enables you to locate with relative ease each location in which a program symbol (variable, macro, or function) is used, perhaps to find the use that changes a variable unexpectedly or the place where a function is called when it shouldn't be.
This chapter took you on a whirlwind tour of a few of the most common programs and utilities used by Linux programmers. You learned how to use GCC to compile programs, how to use make to automate compiling programs, and how to find information about programming libraries using programs such as ldd, nm, and ldconfig . You also learned enough about the source code control systems RCS and CVS to be comfortable with the terminology and how to use their most basic features. Finally, you learned how to use the GNU debugger (GDB) to figure out why, or at least where, a program fails.
The continuation/full version of this article read on site www.podgrid.org - Linux Bible