HomeProductsFAQEvaluationOrderCustomer Area

Combined RSS feed for site. RSS Feed

Plugin Smithy Software Blog


Integrating Purify into Visual Studio 2005 (well, sort of...)

When I recently tried IBM Rational PurifyPlus 7.0 for Windows together with Microsoft Visual Studio 2005, to my surprise there was still no integration of the PurifyPlus tools into Visual Studio 2005, like it is available for Microsoft Visual Studio .NET 2003. This means that you cannot launch any of the PurifyPlus tools directly from within Visual Studio 2005. This is especially cumbersome with Purify. The most powerful combination is to use Purify directly together with the Visual Studio debugger, in order to be able to inspect the program state that triggered an error message in Purify.

Note that the PurifyPlus integration with Visual Studio .NET 2003 was not really exciting. Also with this integration it was not possible to debug programs that were launched through the integration (see here for an explanation and a workaround).

In order to be able to launch and debug a purified program directly from Visual Studio 2005, I integrated  Purify through a post-build event. The trick is to instrument the executable in-place through the post-build event. To prevent interference with normal Debug and Release builds this should be done in a separate build configuration.

The basic steps to set this up in Visual Studio 2005 are:

  1. Create a new "Purify" build configuration as a copy of the "Debug" configuration in the Visual Studio "Configuration Manager".
  2. Create a "Post-Build Event" with the following command:
    purify /Run=no /Replace "$(TargetPath)"
  3. In the project settings under "Configuration Properties", "Debugging" extend the PATH environment variable to include the Purify product directory and the Purify cache directory (e.g. "C:\Program Files\Rational\Common" and "C:\Program Files\Rational\PurifyPlus\cache").

This is demonstrated in a Visual Studio 2005 sample project that can be downloaded here. After unzipping the project and opening it in Visual Studio 2005, step 3 must still be performed to reflect the actual installation directory of PurifyPlus on your machine. This screenshot shows how to set the PATH environment variable in the project settings under "Configuration Properties", "Debugging":

Setting the PATH Environment Variable under "Configuration Properties", "Debugging"

The sample project has the redistributable Purify API files integrated, so it is possible to directly call the Purify API functions from Visual Studio watchpoints. The following screenshot shows the result of calling the PurifyIsRunning() and PurifyWhatColors() in the Visual Studio watchpoint window, after having hit a breakpoint in the main program:

Using Visual Studio Watchpoints to Call Purify API Functions 

And this is the corresponding output in the Purify viewer:

Output of Purify API Function in Purify Viewer

With this "poor man's integration" I found the combination of Purify and Visual Studio 2005 much more useful.

Comments:

Post a Comment:
  • HTML Syntax: Allowed


« September 2010
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  
       
Today