Table of Contents

Working with projects

This chapter describes WinGDB integration with standard Visual Studio projects and solutions. It does not apply for Android SDK project (wgaproj), please look here for a description of this type of projects.

Project properties

WinGDB allows to store most of its settings for Visual C++ project. When you click the right mouse button on a project name inside Solution Explorer, a context menu appears. There is WinGDB sub-menu containing several options:

After activating the Properties option, a dialog will appear allowing you to set the values of most parameters related to debugging and building with WinGDB. These settings are remembered for each project.

All settings take into account currently set configuration and platform. You can enter different settings for each configuration / platform you have.

Solution properties

The Properties option also exists for the solution, providing defaults for options not set for specific project. In the Properties dialog the options which have been set for this specific project are marked bold. The remaining options which have default values (usually inherited from the solution) are displayed in gray color. If some option has not been set both in the project nor the solution, it takes some global default value, either empty, or inherited from the main Preferences settings.

Debugging the project

After setting the parameters, you can easily start debugging using one of the Start instance, Attach to process or Examine core options. The first one quickly starts the debugging, using settings saved for the project. The latter ones show usual Attach and Examine core dialogs, initialized with project settings. You can override these settings for particular session.

Building the project

There is also Build submenu, giving you an access to build commands for selected project.

You can Build, Rebuild, Clean or Deploy the project, according to the configuration options specified on Project build tab in the Properties dialog.

All of these actions can be performed for the selected project only, or for the selected project with all dependent projects. You can set the dependencies as usual in Visual Studio, with Project/Project dependencies menu option.

WinGDB also offers a command interception feature, allowing you to use standard Visual Studio build commands to start WinGDB build actions. You can find more information on this topic in this section.

Actions for the Startup project

The following options accessible from the WinGDB main menu are also project-aware: 'Start debugging', 'Launch process', 'Attach to process', 'Examine core' and 'Remote build'. These options however take settings from the Startup project (the one marked bold in the Solution Explorer), not the selected one.

Managing project properties

WinGDB offers many settings allowing it to adjust to different platforms and debugging scenarios. These settings can be remembered in several ways. Sometimes it is needed to store settings (or some of them) only per-user on single machine. Other times it is desirable to permanently remember some settings in a project file, so that they can be stored in version control system. Yet another possibility is exporting them to XML file. In order to satisfy these varied requirements, WinGDB offers a setting management system which is described below.

Most functions related to settings management are located in the Manage properties submenu available in the WinGDB context menu on a project or solution.

Persistent and user options

All of the options available in WinGDB for a project or solution can exist on two levels: persistent level and user level. These are two separate blocks of option values. Every option can have an explicitly set value on either level (or both) or stay with default value.

When an option has a default value on the user level, that means it inherits the value from the persistent level. In other words, the persistent level provides default values for the user level. If some option has a default value on persistent level, the value is equal to some reasonable predefined value, or in some cases inherited from global Preferences.

The persistent level options are stored in project and solution files (vcproj, vcxproj and sln) You can add them to your version control system and this way remember them permanently or share with other developers. Only options which have non-default values are physically stored. Hence, if you want to store some option this way, just set its value in the Properties dialog. The option value will be displayed bold to indicate that. It can even be equal to the default value, it suffices thst you explicitly provide it. You can also reset every option to default value by clicking the button and choosing Default. This way you can control which options have to be stored in your project files and which should not.

You can edit persistent options by choosing Edit persistent from the Manage properties menu.

The user level options are stored in standard suo files maintained by Visual Studio. The rules are the same as for the persistent level. If you leave any option as default, it will not be written to the suo file, but inherit the value from corresponding presistent option (which also can be default). If you set an option here, it will override the inherited value. This can be suitable for machine and user specific options, which are not desirable to persist them in source control repositories. Any option can be overriden.

You can edit user options by choosing Properties from the WinGDB context menu. Also the Project configuration wizard accessible from that menu currently alters only user properties.

Solution and project options

There is also a different option layering, independent from the persistent/user one. Any option can be set on the solution level or the project level. Solution options becomes defaults for project options in similar way as described above. The exact path of inheritance is as follows:

Persistent/solution -> user/solution -> persistent/project -> user/project.

The arrows go from base to overriding option block. Some settings are solution-wide and available only at the solution level.

Exporting and importing options

There is also way to remember options (from either level) in XML file. Open the Manage properties submenu and select Export or Export persistent. WinGDB will ask you for the destination file. Selecting Import or Import persistent allows you to load previously saved settings file.

These actions are available both for projects and the solution. The solution variant saves both the solution-level settings, and settings for all contained projects. The project variant saves only settings for selected project.

In both cases, projects are identified by names. There is a special case when you export settings for some project, and then import the file for different project. WinGDB will ask you whether it should overwrite existing properties of the destination project. This way you can copy settings between projects or levels, or use the file as a template.

There are also two other options, allowing to set all settings of currently selected project to default values. This operation may concern either current configuration only, or all configurations.

Using Visual Studio macros

You can use Visual Studio macros in all WinGDB properties which accept paths or other strings. Visual Studio macros are special variables (like $(ConfigurationName) or $(ProjectDir)) which are substituted with concrete values depending on actual project settings. All macros known by Visual Studio are supported. You can view list of them by choosing standard Visual Studio Properties option on a project, then clicking on "..." button for some property and then Macros button. Macros are supported on project level only (not single-file nor solution level).

Table of Contents


Copyright (C) 2008-2012 WinGDB.com. All rights reserved.