Locating source

When you debug an application, the debug engine attempts to find the source for the application. If the debug engine can locate the source, it opens the source in the debugger editor. If the debug engine cannot locate the source, it opens a Disassembly view of the source in the debugger editor.

About this task

You can use these methods to help the debug engine locate source files:
  • For C/C++ programs, you can compile them with the -qfullpath compiler option.
  • In the Debug view or the debugger editor, you can add a source location. For example, Edit Source Lookup opens the Edit Source Lookup Path dialog in which you can select the type of source location to add. Alternatively, you can alter the source location list. To do this, right-click a stack frame or thread in the Debug view and select the Edit Source Lookup action.

Altering the source location list

About this task

After you have launched a debug session, you can modify or add to the source location list by completing these steps:

Procedure

  1. Right-click the debug target (or one of its threads or stack frames) and choose Edit Source Lookup. The Edit Source Lookup Path window opens.
  2. Do one of these steps:
    • To add a source location, click Add. The Add Source dialog opens. Choose one of these options:
      • File System Directory adds a local file system directory to the source location list. To also search subdirectories, select Search subfolders.
      • Debug engine adds the debug engine to the source location list.
      • Debug engine path adds the path specified on the debug engine to the source location list. If you specify multiple paths, separate them with a semi-colon (;) if using a Windows client or a colon (:) if using a Linux client. Changes to the Debug engine path setting will take effect in subsequent debug sessions.
    • To remove an entry, select a source location and click Remove.
    • To change the order of entries, select a source location and click Up or Down.
  3. To search for all instances of the source file name in the source location list, select Search for duplicate source files on the path. If the debugger finds multiple instances of the file name, you are prompted to choose the correct source file.
  4. To save the changes, click OK.

Changing the source file in the editor

About this task

If your program was not compiled with -qfullpath, the source has moved, or you are debugging on a system other than the one on which your program was built, the debugger may locate the incorrect source for the current stack frame. If this happens, you can change the text file that opens in the editor:

Procedure

  1. In the editor, right-click and select Change Text File.
  2. Enter or browse for the path and name of the file that you want to open.
    Note: If you are specifying a file on your local workstation, enter the fully-qualified path and filename.
  3. To load the specified source file in the editor and close the window, click OK.

Locating the source file in the editor

About this task

When source cannot be found, the editor opens without source.

To locate the source, do either of these steps:
  • To specify a different editor source file name, click Change Text File. Browse or enter the path and name of the file that you want to open.
    Note: To specify a file on your workstation, type the fully qualified path and file name. The ability to change the editor source file depends on the language, environment, and platform on which you are debugging.
  • To edit the source lookup path, select Add Source Location. The Edit Source Lookup Path window opens. For instructions for adding a source location see Altering the source location list

To open a Disassembly view of the source, click Show Disassembly.


Feedback