How to locate the source code
In this topic:
•Locating files from View / Symbols
•Locate files from an open Editor document
•Original path to the source files is known
•Original path to the source files is unknown
•Use relative paths to make the workspace configuration portable
Use the Directories page to:
•Locate the source code referenced in Symbol Files, which is necessary to allow source-level debugging or
•Use these examples to share a winIDEA workspace between your coworkers from a computer where the application was compiled to a computer where you want to start debugging.
You can locate files:
•From View | Symbols
•From an open Editor document
•If the original path to the source files is known
•If the original path to the source files is unknown
•Use relative paths to make the workspace configuration portable
The Symbols view shows Modules whose source are not found in grayed color.
Right-click and select Locate Source. |
---|
Browse to the actual location of the clicked file and select it. |
---|
winIDEA will:
•Determine the correct path conversion.
•Adjust configuration in Debug | Configure Session | Switch to Full | Application | Directories.
•Try locating the sources (without breaking live session).
•Symbols window and editor LoC (Line of Code) markers will be refreshed.
This use case assumes that you opened the correct source files manually.
Right-click in the Editor to open the context menu. |
---|
Via Associate to symbol file, select one of the presented paths |
---|
These are the paths that are reported in the Symbols File. If multiple applications or symbol files contain a file with this name, all will be presented. Make sure to select the one(s) who actually contain this exact file.
winIDEA will:
•Determine the correct path conversion.
•Adjust configuration in Debug | Configure Session | Switch to Full | Application | Directories.
•Try locating the sources (without breaking live session).
•Symbols window and editor LoC (Line of Code) markers will be refreshed.
For these examples we use:
•Source files location of a compiled application: C:\Project
•Source files location of a debugged application: L:\Mirror\Project
•
In the Directories page you can define source files if you know where the source files are located on both computers or if you don’t know the original path to the source files.
Go to Debug | Configure Session | Switch to Full | Application | Directories. |
---|
Enable Convert source file paths. |
---|
Replace the old path with the new path. |
---|
Type into the field C:\Project=L:\Mirror\Project.
Perform a Download. |
---|
You can use the Demo Mode.
Go to the View | Debug | Symbols Browser and select Modules. |
---|
Click on one of the files and the path displays under the list of files. |
---|
Compare this path to the actual path and identify the required replacement. |
Open Debug | Configure Session | Switch to Full | Application | Directories. |
Enable Convert source file paths. |
Replace the old path with the new path. |
Type into the field C:\Project=L:\Mirror\Project.
You may specify the new path relative to the workspace file, when the workspace file is located in the same folder hierarchy.
If a winIDEA directory is created next to the sources the relative path from the workspace file in this case is ..\Project.
If you specify the relative path it will allow you to copy the entire L:\Mirror directory to any other location or PC and winIDEA will still locate the source code correctly.