Customizing
instrumentation
Purify uses one of the following error-checking instrumentation
levels as the default for each module, depending on the module's size and the
availability of debug and relocation data:
- Precise
instrumentation provides full run-time error detection, to
pinpoint problems in any component in your program.
- Minimal
instrumentation improves Purify's performance while providing a
basic level of error detection.
For coverage monitoring, Purify uses one of the following levels as the default:
- Line-level
instrumentation, which reports line-by-line coverage data
- Function-level instrumentation, which improves performance but reports only
function-by-function coverage data
Purify sets a default level for each module
based on module size and the availability of debug and relocation
data. However, you can override the default and specify
instrumentation levels for each module to meet your own
requirements.
Click to enlarge
You can, however, override the default and
specify the level for each module to meet your own
requirements.
Click to enlarge
More
information?
Look
up instrumentation levels and powercheck in
the Purify online Help index.
Using just-in-time debugging
Purify's just-in-time debugging
support provides instant access to your debugger when you need to solve tough problems.
Click to enable Break on
Error. Purify now stops your program just before an error executes so that you can debug
it. You can also run a Purify'd program directly under the debugger.
Click to enlarge
To quickly debug only the most critical errors in your
program, use Break on Error together with Purify filters. First, filter out all the less
critical messages, then enable Break on Error. Purify breaks only for the unfiltered
messages. When you're ready to debug the remaining errors, just disable the filters.
More information?
Look up break on error tool in the Purify online Help index.
Using
Purify standalone
When you don't need all of Microsoft Developer Studio's resources,
you can use Purify standalone. Purify's independent user interface provides the same
error-detection and coverage capabilities as when you use Purify integrated with Developer
Studio.
Note:
You can also use Purify's independent user interface while continuing
to work integrated with Developer Studio by deselecting Embed Data Browsers
in the
Purify Settings menu.
To start Purify as a standalone application, double-click and then click Run
in the Purify Welcome Screen to display the Run Program
dialog.
Click to enlarge
Purify instruments your code and displays the results in a Data Browser window.
More information? For information about a tool, menu
command, or dialog, click and then
click the item.
Testing with Purify's command-line interface
Using Purify's command-line interface, you can use Purify
with existing makefiles, batch files, and Perl scripts. For example, if you have a test
script that runs a program, you can easily modify the script to instrument and run the
program. To do this, change the line that runs Exename.exe
to:
purify Exename.exe
Alternatively, to run the instrumented version of Exename.exe
consistently throughout your tests, add this line to the beginning of your test script:
purify /Replace=yes /Run=no Exename.exe
This line instructs Purify to save the
original Exename.exe
to a .bak
file, and to instrument Exename.exe
but not to run it at this time. Now, whenever your test script runs
Exename.exe, it runs the instrumented version
of the program, providing Purify's detailed diagnostics.
To collect coverage data as well as error
data when you run a program from the command line, use the
/Coverage option:
purify /Coverage=yes Exename.exe
You can run Purify without the graphical
interface by using the /SaveTextData
option. This option saves Purify's diagnostic messages to a text output file. You can
use the error and warning messages in this file as additional criteria for your test
results.
More information? Look up command line
in the Purify online
Help index.
Extending
error checking with Purify API functions
Purify includes a set of API functions that extend its error
checking capabilities and give you greater control over tracking errors.
Using Purify's API functions, you can set and test memory
state, and search for memory and handle leaks. For example, by
default Purify reports memory leaks only when you exit your program.
But you can use the API function PurifyNewLeaks
to check for leaks
more frequently. Click the NewLeaks tool to call PurifyNewLeaks
while your program is
running, or include PurifyNewLeaks at key points in your code. Purify reports any new memory
leaks it has detected since the last time you called the function.
This periodic checking enables you to track memory leaks more
closely.
You can call Purify API functions from the Purify View menu as
your program executes. You can also call them from the QuickWatch dialog in the Developer
Studio debugger as well as by including them in your code. More
information? For the complete listing of
Purify API functions related to coverage monitoring, look up api
function list. For instructions on using the functions, look up api
functions, using in the Purify online Help index.
Using Purify in an integrated environment
Rational Software tools integrate into your working environment to help you do your
job more effectively and efficiently. For example, without leaving Purify or Developer
Studio, you can make full use of:
- Rational ClearQuest™, Rational's change request management tool
- Rational Visual Test®, Rational's automated test scripting tool
Using Purify with ClearQuest
If you have ClearQuest installed,
you can submit a defect as soon as Purify detects an error or warning, or when you find a
coverage problem.
Click to enlarge
Purify automatically supplies entries for a number of fields in the submit form and
specifies the category of error. You can easily attach Purify data files ( .pfy) to further document the
error.Using Purify with
Visual Test
If you have Visual Test
installed, you can Purify the program that Visual Test is exercising. To do this, you must
include the file TOOLS.INC
in your Visual Test script file (.mst),
select Purify > Run Visual Test Scripts with Purify, and run your script as
usual in the Developer Studio interface.
If you are using a test harness to run Visual Test scripts, you can easily modify it to
run Purify automatically as it exercises the program.
More information? Look up clearquest and visual test in
the online Help index, and refer to the ClearQuest and Visual Test documentation.
Now you're ready to put Purify to work. Remember that Purify's online Help contains
detailed information to assist you.
Back| Index| Table of contents
|