7.3. Preparing your application for debugging

To fully exploit any debugger, you need to compile your application with the -g compiler option and without optimization. Otherwise, the debugger cannot resolve referenced symbols in your application, and you cannot refer to variables or functions by their name while debugging.

If you run the strip command to strip symbol information from your application program, the debugger cannot resolve referenced symbols in your application either.

The latest C and C++ compilers on AIX support the following useful options:

-qfullpathThis puts the full path of the source files into the debug information. This can be very useful if you have a very large source tree, since the debugger does not need to ask for the location of the source file.
-qlinedebugThis eliminates the variable descriptions from the debug information. This is recommended if the code is optimized, since the variable monitoring in optimized code will generally give incorrect results. This option significantly reduces the size of the debug information, especially in C++ programs.
-qdbxextraThis include debug information for all symbols in your program, regardless of whether they are referenced. Normally, only debug information for referenced symbols is included. This option will significantly increase the size of the resulting executable.

When debugging information is created in an application, the size of the executable may grow dramatically. A C++ executable may grow in size by a factor of 10 or more when debug information is generated. Intelligent use of -qlinedebug and turning off debug information in uninteresting areas of the code may help in this case.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset