Typically, applications running in a production environment are built and deployed without debug information.
However, applications without debug information provide significantly less information and
functionality in the debugger when compared to the same application built with debug information.
Debugging capability can be ensured for an application even if it is deployed without debug information.
This approach can be combined with the -O2 optimization option and the extended -g5 or -g8 option levels
to provide a compromise between application optimization and debug capability.
To enable an application for production debug:
- Compile the application with -g (or one of the extended -g5
or -g8 option levels).
- Create a copy of the application source tree.
- Create a copy of the top level directory containing the application binaries. The name of the
directory should clearly indicate that this copy of the application binaries contains the debug
information required by the debugger.
- Run the strip tool on the original application binaries. This strips the debug
information out of the application binaries to create the production version of the application. This
version of the application can be deployed to a production server or distributed to users.
- Save both the application source tree (from step 2) and the debuggable application binaries
(from step 3) in a secure location. These can be used to provide the necessary debug information
required to debug the production version of the application.
To debug a production version of an application:
- Copy the debuggable binaries to the production machine.
- If launching the production version of the application from the UI, create a
Remote Compiled Application launch configuration by selecting
for the application.
If attaching to a running production version of the application, create a
Remote Process launch configuration by selecting
.
- On the launch configuration dialog, click the Enable production debug
check box on the Advanced tab. Enter the path(s) to the debuggable
application binaries in the Debuggable binaries path list. These paths
will be searched recursively for debuggable application binaries which match the production version.
- Add the application source tree to the debugger's source lookup path. The source lookup
path can be modified on the Source tab of the application launch configuration and can be
accessed by right-clicking on the application in the Debug view and
selecting Edit Source Lookup....
When the debugger locates a matching debuggable binary, it will associate that debuggable binary with
the production version. The icons in the Modules view indicate those modules which
have been successfully associated. Opening the Properties view and clicking on a
module in the Modules view will provide additional information about the association.
A debuggable binary can also be associated with an individual module by right-clicking on the module in
the Modules view and selecting the Associate debuggable binary...
action. Enter the fully-qualified filename of the debuggable binary.