Using Source Files
The debugger engine maintains a source path, which is a list of directories and source servers that contain source code files associated with the current targets. The debugger engine can search these directories and source servers for the source files. With the help of symbol files, the debugger engine can match lines in the source files with locations in the target's memory.
For an overview of using source files with debuggers, see Debugging in Source Mode. For an overview of source paths, see Source Path. For an overview of using source servers from the debugger engine, see Using a Source Server.
To add a directory or source server to the source path, use the method AppendSourcePath. The whole source path is returned by GetSourcePath and can be changed using SetSourcePath. A single directory or source server can be retrieved from the source path using GetSourcePathElement.
To find a source file relative to the source path, use FindSourceFile or, for more advanced options when using source servers, use FindSourceFileAndToken. FindSourceFileAndToken can also be used along with GetSourceFileInformation to retrieve variables related to a file on a source server.
The debugger engine provides three methods for locating the memory locations that correspond to lines in a source file. To map a single line of source code to a memory location, use GetOffsetByLine. To search for memory locations for more than one source line or for nearby source lines, use GetSourceEntriesByLine. The GetSourceFileLineOffsets method will return the memory location of every line in a source file.
To perform the opposite operation and find the line of a source file that matches a location in the target's memory, use GetLineByOffset.