This section describes solutions for several problems that may arise while you are using lprof.
Sometimes if you are compiling with one or more forms of optimization together with the profiling option, you will get an error warning that there is an incompatibility between obtaining profiling information and optimization. This is usually a permissible combination of options, but occasionally the compiler does not accept it.
You may not need to have the function in question profiled. If not, ignore this warning; data will be collected in the data file for all other functions. If you do want data for the function in question, compile your program again with the profiling option but without optimization. The warning should not reappear.
If the profiled program does not terminate normally, no profiling data will be saved. The profiling data is saved at termination by the system call exit(S). If exit is never called, no profiling data is saved.
If a program has been recompiled, a new data file will be created in a temporary directory. The path name of the new file will be printed to stderr.
At the end of execution, you may see the following error message:
dumping profiling data from process 'a.out' . . . ***unable to seek to symbol tableUsually this is caused by running a stripped version of a profiled program. Never strip files to be profiled. If necessary, change ``makefiles'' so that they do not produce stripped files.
Sometimes you may get no data after running a profiled program. The program terminates normally, and you receive neither a message about data being saved, nor an error message. This may be caused by one of two problems:
Occasionally, lprof may not be able to find the data file, despite the fact that the profiled program has terminated normally and you have received a message saying that the data file has been created.
The profiled program creates the data file in the directory in which the program is located when it terminates. If the program changes directories, the data file may be created in a directory different from both the one from which you executed the program and the one in which the shell is located when the program terminates.
Use the dir option of PROFOPTS to specify exactly where the data file is to be created, so you will be able to find it.
Program-generators such as lex and yacc make use of the #line preprocessor directive to change line numbering. This generally disrupts line profiling such as is done with lprof.
It is recommended that when profiling with lprof, you use archived versions of libraries rather than shared versions.