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
Comments
The easiest way to do this is to set an environment variable:
INSURE_INSTRUMENT_ALL=true
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.
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.
or
I can run "insdevenv.bat" on the solution file? i.e. at cmd>> insdevenv.bat foo.sln? How does this works?
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:
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.
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:
Then, you can start an instrumented, (or even non-instrumented), version of foo.exe like so:
@Rich Alright. Much thanks for your help