Looking up Items

As soon as the source of the debugged program is available, the source window displays its current source text. (see Source Path, if a source text cannot be found.)

In the source window, you can lookup and examine function and variable definitions as well as search for arbitrary occurrences in the source text.

  • Looking up Definitions: Jump towards a specific item.
  • Textual Search: Search within the current source.
  • Looking up Previous Locations: Navigate back and forth.
  • Source Path: Make DDD know where to search.

Node:Looking up Definitions, Next:Textual Search, Up:Looking up Items

Looking up Definitions

If you wish to lookup a specific function or variable definition whose name is visible in the source text, click with mouse button 1 on the function or variable name. The name is copied to the argument field. Change the name if desired and click on the Lookup button to find its definition.

PICS/ddd-source-popup.jpg

As a faster alternative, you can simply press mouse button 3 on the function name and select the Lookup item from the source popup menu.

As an even faster alternative, you can also double-click on a function call (an identifier followed by a ( character) to lookup the function definition.

If a source file is not found, See Source Path, for specifying source directories.

Node:Textual Search, Next:Looking up Previous Locations, Previous:Looking up Definitions, Up:Looking up Items

If the item you wish to search is visible in the source text, click with mouse button 1 on it. The identifier is copied to the argument field. Click on the Find >> button to find following occurrences and on Find >> => Find << () to find previous occurrences.

By default, DDD finds only complete words. To search for arbitrary substrings, change the value of the Source => Find Words Only option.

Node:Looking up Previous Locations, Next:Source Path, Previous:Textual Search, Up:Looking up Items

Looking up Previous Locations

After looking up a location, use Edit => Undo (or the Undo button on the command tool) to go back to the original locations. Edit => Redo brings you back again to the location you looked for.

PICS/ddd-source.jpg

Node:Source Path, Previous:Looking up Previous Locations, Up:Looking up Items

Specifying Source Directories

Executable programs sometimes do not record the directories of the source files from which they were compiled, just the names. Even when they do, the directories could be moved between the compilation and your debugging session.

Here's how GDB accesses source files; other inferior debuggers have similar methods.

GDB has a list of directories to search for source files; this is called the Illegal HTML tag removed : source path. Each time GDB wants a source file, it tries all the directories in the list, in the order they are present in the list, until it finds a file with the desired name. Note that the executable search path is not used for this purpose. Neither is the current working directory, unless it happens to be in the source path.

If GDB cannot find a source file in the source path, and the object program records a directory, GDB tries that directory too. If the source path is empty, and there is no record of the compilation directory, GDB looks in the current directory as a last resort.

To specify a source path for your inferior debugger, use Edit => Debugger Settings (see Debugger Settings and search for appropriate entries (in GDB, this is Search path for source files).

If Debugger Settings has no suitable entry, you can also specify a source path for the inferior debugger when invoking DDD. See Inferior Debugger Options, for details.

When using JDB, you can set the CLASSPATH environment variable to specify directories where JDB (and DDD) should search for classes.

If DDD does not find a source file for any reason, check the following issues:

  • In order to debug a program effectively, you need to generate debugging information when you compile it. Without debugging information, the inferior debugger will be unable to locate the source code. To request debugging information, specify the -g option when you run the compiler. See Compiling for Debugging, for details.
  • You may need to tell your inferior debugger where the source code files are. See Source Path, for details.

    Using GDB, you can also create a local .gdbinit file that contains a line directory Illegal HTML tag removed : path. Here, Illegal HTML tag removed : path is a colon-separated list of source paths.

Node:Customizing Source, Previous:Looking up Items, Up:Navigating

results matching ""

    No results matching ""