VisualGDB - Automatic source file downloading

When you debug Linux applications with VisualGDB some source files may be not a part of your project, e.g. third-party libraries, system include files. Starting from VisualGDB 2.8 those files will be automatically downloaded to a folder inside %LOCALAPPDATA% and will be displayed in Visual Studio automatically.

The download process is one-way. You cannot change the files on the Windows machine and get them uploaded back. To prevent accidental editing VisualGDB flags those files as read-only:

The files are always downloaded into the following directory:

%LOCALAPPDATA%\VisualGDB\AutoDownloadedSources\<Hostname>\<File name>

If multiple source files with the same name exist in different locations, the local directories will be suffixed with \0000, \0001 and so on. Each directory contains the source file itself and a text file called $remote_path containing the path on the Linux machine of the downloaded file.

To clean the auto-downloaded files you can safely delete the AutoDownloadedSources directory or any subdirectories inside it.

The file downloading is triggered by one of the following events:

  • A breakpoint is hit inside a file that has not been downloaded yet
  • You have stepped into a file that has not been downloaded yet
  • You have selected a frame in the call stack window that refers to a file that has not been downloaded yet
  • You have opened a remote file from the VisualGDB Source Browser.

Note that if a source file changes while the debugging session is in progress, VisualGDB will not re-fetch it until the next session is started.

You can browse all files reported by GDB using the VisualGDB Source Browser window. To open it, click on the source list icon in the VisualGDB session pane:

The Source File Manager allows browsing through all source files in either plain list or hierarchical mode. Each file can be opened in Visual Studio by double-clicking on it or pressing the Open button.

Missing files from the remote machine will be automatically downloaded when you open them.