Using tools: Vc6.0,ida
When we want to output debug information in a program, we often output it as a string, for example:
printf("Some debug information here!\n");
This code outputs debug information under Debug and release, which is not what we want, and generally everyone adds a precompiled instruction as follows:
#if _DEBUG
printf("Some debug information here!\n");
#endif
This is achieved in the debug version of the program output debugging information, in the release version does not output debugging information purposes. (in release version even the printf function is not invoked) if you want to output debugging information in many places in the program, if the way above will be very troublesome;
(As for why trouble, may be unwilling to knock a few more times keyboard, hehe ...) )
So everyone thought of writing an output function, the code is as follows:
void printInfo(char *strInfo)
{
#if _DEBUG
printf(strInfo);
#endif
}
Note: This function is only demo, very simple, no other check string functionality.
Where you want to output debugging information, call the following statement on the line:
printInfo("Some debug information here!\n");
Indeed, when you run the program in debug mode, the following information is exported:
Some debug information here!
In release mode, there is no information output;
We tend to think everything is OK at this time; If you think it is, there is no need to look down;
Although in release version run the program does not output debugging information, but these debugging information is left in the binary executable file;
We can use Ida to open the release version of the executable file and see the information shown in Figure one:
Figure I: The main function after Ida disassembly
Note: This function is the main function