Table of Contents
One of possible options to start work with WinGDB is using a project template from the New Project dialog. Here you can choose from several project types: executable program, static library or shared library (shared libraries are not supported on some kinds of platforms).
This option creates the project and opens Project configuration wizard described below.
You can also work with remote Linux using WinGDB without any special project type. Just use any C++ project type that Visual Studio offers, e.g. Console application. This facilitates multiplatform development. Your application can be compiled and run both under Windows and Linux. You can also use WinGDB for existing Windows project, e.g. for porting.
WinGDB works with Visual Studio solution configurations. After creating the project, it is recommended you review configurations that Visual Studio creates. By default, these are Debug and Release configurations. If you want only to work on single platform, you may configure WinGDB for these configurations. If you plan multiplatform development, please read remarks on multiple configurations and platforms here.
The rest of this document covers the detailed configuration mode. You do not need to perform the steps described below while using the wizard, as it does them for you. It is however recommended to read the following sections and other documentation chapters, as they explain the Properties interface required to to utilise full capabilities of WinGDB. Some settings are also adjustable globally, using the Preferences dialog from main WinGDB menu.
To be able to debug with WinGDB, you must let it know the debugger location. To set that information, choose Preferences option from WinGDB menu. There is Default debugger location field in the preferences. You can enter full path to the debugger executable, or only the executable name. In the second case you have to configure your PATH variable on remote host, so that the executable can be found. For Linux systems this name is usually just "gdb".
Alternatively you can specify the debugger path in project or solution properties (Debugger path setting on Environment tab). This will override the global setting described above. Thus, you can use a different debugger in different projects or configurations. To return to default debugger, reset the Properties setting to default value.
The most important properties adjustable for a project or solution, are Target Type and Debug host login. Other machine roles (Debug Target and Build Host) are fulfilled by the same machine, so you do not specify the logins.
WinGDB supports many possible scenarios of debugging with GDB. You have to select which one suits you. In this case, it will be "Linux native application (SSH connection)".
In order to connect to the remote machine, WinGDB needs to know connection details. You specify them in the following format:
Parts in brackets are optional. If you do not specify the port, default one equal to 22 will be assumed, If you do not specify the password, WinGDB will ask you for one later. You can specify either host name or IP address. You can find more information about supported authentication methods in this section.
Another important thing for remote development is to tell WinGDB which directories on the local side correspond to which ones on the remote side. It's called a source directory mapping. You can establish those mappings using the "Map source directories" option from WinGDB menu. It shows the Mapping Manager window.
As you can build/debug on many machines or user accounts, Mapping Manager allows you to set mappings separately for each machine you use. To add a machine, click "Add login" button, and enter login information in usual format.
Next, click "Add Mapping" button. It will show another window in which you enter actual mapping information. It consists of three components:
You can enter as many mappings as you need. Usually one mapping for entire solution will suffice, but if your sources structure does not match perfectly between Windows and Linux, you may need more.
WinGDB includes a simple makefile generator. This generator automatically creates a makefile from current project. Generated makefiles can be used with standard GNU make. Other build systems are in plans. The generator is optional, you can write your makefile by hand if you wish, or use a build system which is currently not supported.
You can find more information about the makefile generator in this section.
WinGDB offers the means to transfer solution files to the remote machine (and back). See this section for more details.
WinGDB has a simple mechanism to control compilation using make or any other build system. It works both in remote and local mode. It can start any build command, however if you want to be able to locate errors and warning in the source code, the build command output must be compatible with standard make and gcc message format. For best results, use standard GNU make.
You have to set some additional properties before using it. Go to the General tab in the Properties dialog. Since you can build on different machine than the one you debug your program on, there exists a separate field to enter the build login information. You can also enter the same login as for debug, or leave the field empty which also means these logins are the same.
Next, go to the Project build tab. Here you can set the following properties:
If you click on solution instead of project, there will also be shown another tab, Solution build. On that tab there is a similar set of options, this time concerning the whole solution. There is also one new option, Solution build mode. You can choose whether the soluton build will execute a build command for each project (with respect to their dependencies), or run build commands configured by the remaining options. Use the first possibility when you do not have a separate makefile for the whole solution, and the second one when you do have.
Apart from Solution build, there is also regular Project build tab. On that tab you can set default settings for the projects, which can be then selectively overridden on any project settings page.
To start the build, choose one of options from the Build submenu from WinGDB menu on any project or solution in Solution Explorer. You will see results in the console. When you click on an error or warning, the code editor will jump to appropriate place in the code.
You can also use Rebuild and Clean and Deploy options to perform these actions.
You can also set some optional parameters, like program Arguments, additional Environment variables and Working directory. If you set Stop in main() option, the program will stop at the beginning of main() function. This option is added for convenience, as you can achieve the same effect by setting a function breakpoint in Visual Studio before starting the program.
Table of Contents