Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Running Insure++ on command line

rerrer Posts: 9

Hi all,

I am rather new to insure++ and will like to check whether is it possible to run insure++ on a visual studio solution through the command line? If yes how should I go about doing it?

Because now I am only aware of using the IDEs to run the insure++ test


  • Rich
    Rich Posts: 34 ✭✭

    The easiest way to do this is to set an environment variable:
    then build your solution:
    devenv /Build foo.sln

    In fact, if you look in the install directory there should be a file named "insdevenv.bat", which does this for you. You use it instead of devenv, and you get what you want.

  • rerrer
    rerrer Posts: 9

    So I either had to set up an environment variable "INSURE_INSTRUMENT_ALL" with the value "true" first, then build the solution using devenv /Build foo.sln?
    I did this however I didn't receive any notification about insure++ being run, the solution just built per normal.


    I can run "insdevenv.bat" on the solution file? i.e. at cmd>> insdevenv.bat foo.sln? How does this works?

  • Rich
    Rich Posts: 34 ✭✭

    For all of this to work, you need to be in a visual studio command-shell, insure++ must be on your PATH. IOW: You should be able to type "insure" on the command-prompt, and see something like this:

          Insure++ Version 7.5.2 (build 2018-11-14)
          Copyright 1993-2018 Parasoft Corporation
          Technical support is available at:
                Telephone: (626) 305-0041
                Fax:       (626) 305-9048

    You use insdevenv.bat just the same way you'd use devenv to build your application.

    So, if you normally type: devenv /Build foo
    You'd type: insdevenv /Build foo

    There's also a hook in the Insure control panel. On the "General" tab, you'll find a box labeled: "Microsoft Visual C++ Integration", and inside there is a checkbox: "Instrument all builds in Visual C++". If you check that box then you get instrumented builds when you invoke devenv.

    Alternatively, if you want to invoke the compiler, "CL", yourself, then you just make sure that the correct CL is on the path, and invoke "insure" instead

    If you normally type: cl /Zi /EHsc foo.cpp /o foo.exe
    Then you'd type: insure /Zi /EHsc foo.cpp /o foo.exe

    Naturally, adjust things for your command-line.

  • Rich
    Rich Posts: 34 ✭✭

    All of the above only refers to BUILDING an instrumented application.
    If it's already built, you can RUN the application from the command-line by using inject.exe or inject_x64.exe (for 64-bit applications)

    If your application is foo.exe, and you normally start foo.exe on the command-line like so:

    C> foo /bar /quux /zork

    Then, you can start an instrumented, (or even non-instrumented), version of foo.exe like so:

    C> inject foo /bar /quux /zork
  • rerrer
    rerrer Posts: 9

    @Rich Alright. Much thanks for your help